kaiser: x86_cr3_pcid_noflush and x86_cr3_pcid_user
authorHugh Dickins <hughd@google.com>
Sun, 27 Aug 2017 23:24:27 +0000 (16:24 -0700)
committerYves-Alexis Perez <corsac@debian.org>
Thu, 4 Jan 2018 11:12:40 +0000 (11:12 +0000)
commita60a7a6c0022b48e136a02db0251b4e15ce6d5c4
treea518170b656e4b479c9d77fcb76414e185a7ae89
parent2ad3b096c42be4be6c4f769de3a3339680274c2e
kaiser: x86_cr3_pcid_noflush and x86_cr3_pcid_user

Mostly this commit is just unshouting X86_CR3_PCID_KERN_VAR and
X86_CR3_PCID_USER_VAR: we usually name variables in lower-case.

But why does x86_cr3_pcid_noflush need to be __aligned(PAGE_SIZE)?
Ah, it's a leftover from when kaiser_add_user_map() once complained
about mapping the same page twice.  Make it __read_mostly instead.
(I'm a little uneasy about all the unrelated data which shares its
page getting user-mapped too, but that was so before, and not a big
deal: though we call it user-mapped, it's not mapped with _PAGE_USER.)

And there is a little change around the two calls to do_nmi().
Previously they set the NOFLUSH bit (if PCID supported) when
forcing to kernel context before do_nmi(); now they also have the
NOFLUSH bit set (if PCID supported) when restoring context after:
nothing done in do_nmi() should require a TLB to be flushed here.

Signed-off-by: Hugh Dickins <hughd@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Gbp-Pq: Topic features/all/kpti
Gbp-Pq: Name kaiser-x86_cr3_pcid_noflush-and-x86_cr3_pcid_user.patch
arch/x86/entry/entry_64.S
arch/x86/include/asm/kaiser.h
arch/x86/mm/kaiser.c