On 22.04.2024 20:14, Andrew Cooper wrote: > @@ -322,12 +334,9 @@ > ALTERNATIVE "", __stringify(DO_SPEC_CTRL_ENTRY maybexen=1), \ > X86_FEATURE_SC_MSR_PV > > - testb $SCF_entry_bhb, %bl > - jz .L\@_skip_bhb > - ALTERNATIVE_2 "", \ > - "call clear_bhb_loops", X86_SPEC_BHB_LOOPS, \ > - "call clear_bhb_tsx", X86_SPEC_BHB_TSX > -.L\@_skip_bhb: > + ALTERNATIVE_2 "", \ > + "DO_COND_BHB_SEQ clear_bhb_loops", X86_SPEC_BHB_LOOPS, \ > + "DO_COND_BHB_SEQ clear_bhb_tsx", X86_SPEC_BHB_TSX
Only spotting this while doing the 456 backport to 4.9: While this is all usual and fine, ... > @@ -433,13 +442,9 @@ > * Clear the BHB to mitigate BHI. Used on eIBRS parts, and uses RETs > * itself so must be after we've perfomed all the RET-safety we can. > */ > - testb $SCF_entry_bhb, %bl > - jz .L\@_skip_bhb > - > - ALTERNATIVE_2 "", \ > - "call clear_bhb_loops", X86_SPEC_BHB_LOOPS, \ > - "call clear_bhb_tsx", X86_SPEC_BHB_TSX > -.L\@_skip_bhb: > + ALTERNATIVE_2 "", \ > + "DO_COND_BHB_SEQ clear_bhb_loops", X86_SPEC_BHB_LOOPS, \ > + "DO_COND_BHB_SEQ clear_bhb_tsx", X86_SPEC_BHB_TSX > > lfence ... the original use of ALTERNATIVE_2 here is safe only because for the idle domain SCF_entry_bhb will not be set, and hence any patching done here will not affect NMI or #MC taken while doing the patching. Therefore I think this hunk needs dropping. Jan