Message ID | 20210325200942.GJ31322@zn.tnic (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | x86/tlb: Flush global mappings when KAISER is disabled | expand |
On Thu, Mar 25, 2021 at 09:09:42PM +0100, Borislav Petkov wrote: >Hi stable folks, > >the patch below fixes kernels 4.4 and 4.9 booting on AMD platforms with >PCID support. It doesn't have an upstream counterpart because it patches >the KAISER code which didn't go upstream. It applies fine to both of the >aforementioned kernels - please pick it up. Queued up for 4.9 and 4.4, thanks! >Jim Mattson reported that Debian 9 guests using a 4.9-stable kernel >are exploding during alternatives patching: (Cc Ben & Salvatore) I'm not sure if 4.9 or Debian is still alive or not, but FYI...
On Thu, Mar 25, 2021 at 04:36:55PM -0400, Sasha Levin wrote: >On Thu, Mar 25, 2021 at 09:09:42PM +0100, Borislav Petkov wrote: >>Hi stable folks, >> >>the patch below fixes kernels 4.4 and 4.9 booting on AMD platforms with >>PCID support. It doesn't have an upstream counterpart because it patches >>the KAISER code which didn't go upstream. It applies fine to both of the >>aforementioned kernels - please pick it up. > >Queued up for 4.9 and 4.4, thanks! > >>Jim Mattson reported that Debian 9 guests using a 4.9-stable kernel >>are exploding during alternatives patching: > >(Cc Ben & Salvatore) > >I'm not sure if 4.9 or Debian is still alive or not, but FYI... *on :)
On Thu, 2021-03-25 at 19:19 -0400, Sasha Levin wrote: > On Thu, Mar 25, 2021 at 04:36:55PM -0400, Sasha Levin wrote: > > On Thu, Mar 25, 2021 at 09:09:42PM +0100, Borislav Petkov wrote: > > > Hi stable folks, > > > > > > the patch below fixes kernels 4.4 and 4.9 booting on AMD platforms with > > > PCID support. It doesn't have an upstream counterpart because it patches > > > the KAISER code which didn't go upstream. It applies fine to both of the > > > aforementioned kernels - please pick it up. > > > > Queued up for 4.9 and 4.4, thanks! > > > > > Jim Mattson reported that Debian 9 guests using a 4.9-stable kernel > > > are exploding during alternatives patching: > > > > (Cc Ben & Salvatore) > > > > I'm not sure if 4.9 or Debian is still alive or not, but FYI... > *on > > :) We're supporting both 4.9 and 4.19 in Debian 9. The general rule is we carry on with the same stable kernel branch for the whole 5 year support period, but add the option of using the kernel version from the next stable release. Ben.
diff --git a/arch/x86/include/asm/tlbflush.h b/arch/x86/include/asm/tlbflush.h index f5ca15622dc9..2bfa4deb8cae 100644 --- a/arch/x86/include/asm/tlbflush.h +++ b/arch/x86/include/asm/tlbflush.h @@ -245,12 +245,15 @@ static inline void __native_flush_tlb_single(unsigned long addr) * ASID. But, userspace flushes are probably much more * important performance-wise. * - * Make sure to do only a single invpcid when KAISER is - * disabled and we have only a single ASID. + * In the KAISER disabled case, do an INVLPG to make sure + * the mapping is flushed in case it is a global one. */ - if (kaiser_enabled) + if (kaiser_enabled) { invpcid_flush_one(X86_CR3_PCID_ASID_USER, addr); - invpcid_flush_one(X86_CR3_PCID_ASID_KERN, addr); + invpcid_flush_one(X86_CR3_PCID_ASID_KERN, addr); + } else { + asm volatile("invlpg (%0)" ::"r" (addr) : "memory"); + } } static inline void __flush_tlb_all(void)