From: Dave Hansen <dave.hansen@linux.intel.com>
To: linux-kernel@vger.kernel.org
Cc: linux-mm@kvack.org, Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, luto@kernel.org
Subject: [PATCH] x86, mm: make alternatives code do stronger TLB flush
Date: Tue, 31 Oct 2017 11:07:57 -0700 [thread overview]
Message-ID: <20171031180757.8B5DA496@viggo.jf.intel.com> (raw)
From: Dave Hansen <dave.hansen@linux.intel.com>
local_flush_tlb() does a CR3 write. But, that kind of TLB flush is
not guaranteed to invalidate global pages. The entire kernel is
mapped with global pages.
Also, now that we have PCIDs, local_flush_tlb() will only flush the
*current* PCID. It would not flush the entries for all PCIDs.
At the moment, this is a moot point because all kernel pages are
_PAGE_GLOBAL which do not really *have* a particular PCID.
Use the stronger __flush_tlb_all() which does flush global pages.
This was found because of a warning I added to __native_flush_tlb()
to look for calls to it when PCIDs are enabled. This patch does
not fix any bug known to be hit in practice.
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Cc: x86@kernel.org
Cc: Andy Lutomirski <luto@kernel.org>
---
b/arch/x86/kernel/alternative.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff -puN arch/x86/kernel/alternative.c~x86-mm-text-poke-misses-global-pages arch/x86/kernel/alternative.c
--- a/arch/x86/kernel/alternative.c~x86-mm-text-poke-misses-global-pages 2017-10-31 10:28:44.306557256 -0700
+++ b/arch/x86/kernel/alternative.c 2017-10-31 10:28:44.309557393 -0700
@@ -722,7 +722,8 @@ void *text_poke(void *addr, const void *
clear_fixmap(FIX_TEXT_POKE0);
if (pages[1])
clear_fixmap(FIX_TEXT_POKE1);
- local_flush_tlb();
+ /* Make sure to flush Global pages: */
+ __flush_tlb_all();
sync_core();
/* Could also do a CLFLUSH here to speed up CPU recovery; but
that causes hangs on some VIA CPUs. */
_
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next reply other threads:[~2017-10-31 18:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-31 18:07 Dave Hansen [this message]
2017-11-01 8:12 ` Andy Lutomirski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20171031180757.8B5DA496@viggo.jf.intel.com \
--to=dave.hansen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=luto@kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox