SMP initialization?
Posted: Mon Feb 01, 2021 4:29 am
This is going to be one of the very rare occasions when I ask a question instead of answering them
Does anybody have a reliable SMP implementation? I'm asking this because there are no clear cut instructions in the MP spec, and even worse, the spec changed significantly over time. I've checked so many source codes, and there seem to be no consensus how to do it properly (one sets warm reset code in CMOS, others don't, one sets up MSR, others don't, some does masking the LAPIC register while others don't, some disable the NMI others don't, some has wait loops for delivery others don't, some implement delays, other's don't, one in particular even writes to mysterious IO ports too. It also does an LAPIC ID read after every single LAPIC register write. I haven't seen that in any other code.) I've studied the Linux kernel, but the SMP code is a real mess, with contradicting implementations, heavy with unfollowable callbacks. It's almost impossible to figure out that which method is used and which functions are called on a particular machine during boot up. And the comments are not helping either. One comment for example says that delays are not needed (above the code that does the delay, of course).
My current SMP code works most of the time. On all virtual machines, and on all my testbeds. BUT. From time to time, an issue pops up that on a certain hardware, one time out of 20 it doesn't boot up, rather freezes or reboots. I couldn't figure exactly out why. And specially, why does it only fail occasionally when all the parameters are supposedly the same?
So, does anyone have a good tutorial / source code / specification, which clearly describes what to do? I mean it has things like: if your machine is older than X, follow these steps, if it's model Y, do this, otherwise do Z. When do we need to set up CMOS registers? Probably not on UEFI, which doesn't have those. When is there a need to configure MSRs? What CPU family requires the delays, and which one don't? etc. Anything a bit more readable than the Linux source would do.
Thanks,
bzt
Does anybody have a reliable SMP implementation? I'm asking this because there are no clear cut instructions in the MP spec, and even worse, the spec changed significantly over time. I've checked so many source codes, and there seem to be no consensus how to do it properly (one sets warm reset code in CMOS, others don't, one sets up MSR, others don't, some does masking the LAPIC register while others don't, some disable the NMI others don't, some has wait loops for delivery others don't, some implement delays, other's don't, one in particular even writes to mysterious IO ports too. It also does an LAPIC ID read after every single LAPIC register write. I haven't seen that in any other code.) I've studied the Linux kernel, but the SMP code is a real mess, with contradicting implementations, heavy with unfollowable callbacks. It's almost impossible to figure out that which method is used and which functions are called on a particular machine during boot up. And the comments are not helping either. One comment for example says that delays are not needed (above the code that does the delay, of course).
My current SMP code works most of the time. On all virtual machines, and on all my testbeds. BUT. From time to time, an issue pops up that on a certain hardware, one time out of 20 it doesn't boot up, rather freezes or reboots. I couldn't figure exactly out why. And specially, why does it only fail occasionally when all the parameters are supposedly the same?
So, does anyone have a good tutorial / source code / specification, which clearly describes what to do? I mean it has things like: if your machine is older than X, follow these steps, if it's model Y, do this, otherwise do Z. When do we need to set up CMOS registers? Probably not on UEFI, which doesn't have those. When is there a need to configure MSRs? What CPU family requires the delays, and which one don't? etc. Anything a bit more readable than the Linux source would do.
Thanks,
bzt