Messages in this thread | | | Date | Wed, 1 Feb 2023 18:51:44 -0800 | From | Ashok Raj <> | Subject | Re: [Patch v3 Part2 4/9] x86/microcode: Do not call apply_microcode() on sibling threads |
| |
On Wed, Feb 01, 2023 at 11:40:58PM +0100, Borislav Petkov wrote: > On Wed, Feb 01, 2023 at 02:21:18PM -0800, Dave Hansen wrote: > > That works great, unless T0 experiences an error. In that case, T0 will > > jump out of __reload_late() after failing to do the update. T1 will > > come bumbling along after it and will enter ->apply_microcode(), > > blissfully unaware of T0's failure. T1 will assume that it is supposed > > to do T0's job, noting "rev < mc->hdr.rev". T1 will write the MSR while > > T0 is off doing god knows what. > > > > T1 should not even be attempting to do ->apply_microcode() because T0 is > > not quiescent. > > Yah, thanks for explaining properly. > > So, if T0 fails, then we will say that it failed. The ->apply_microcode() > call on T1 was never meant to apply any microcode - just to update the > cached data.
The commit log "attempted" to convey that, replace primary with T0, and secondary with T1.
> > Now, if T0 fails, then it doesn't matter what T1 does - you have a > bigger problem: > > A subset of the cores is running with new microcode while other subset > with the old one. Now this is a shit situation I don't want to be in. > > And I don't have a good way out of it.
T1 shouldn't be sent down the apply_microcode() path, but instead just gather and update the per-cpu info reflecting the current revision.
Patch 3 and 4 attempted to that.
In addition....to ensure cores being out of sync within themselves
At wait_for_siblings: Each thread can check their rev against the BSP (yes BSP can be removed, but we can elect a core leader) and if they are different we can either warn/taint or pull the plug and panic.
> > Revert to the old patch? Maybe... > > Retry to application on all again with the hope that it works this time? > > What if some core touches a MSR being added with the new microcode > patch? > > Late loading is a big PITA. As we've been preaching for a while now. >
Cheers, Ashok
| |