From: tip-bot for Peter Zijlstra <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: dave.hansen@intel.com, mingo@kernel.org, tglx@linutronix.de,
hpa@zytor.com, mark.gross@intel.com, peterz@infradead.org,
linux-kernel@vger.kernel.org, bin.yang@intel.com
Subject: [tip:x86/mm] x86/mm/cpa: Move flush_tlb_all()
Date: Thu, 27 Sep 2018 11:52:29 -0700 [thread overview]
Message-ID: <tip-c0a759abf5a686a37b9204c13b7e281fe516c8f0@git.kernel.org> (raw)
In-Reply-To: <20180919085947.882287392@infradead.org>
Commit-ID: c0a759abf5a686a37b9204c13b7e281fe516c8f0
Gitweb: https://git.kernel.org/tip/c0a759abf5a686a37b9204c13b7e281fe516c8f0
Author: Peter Zijlstra <peterz@infradead.org>
AuthorDate: Wed, 19 Sep 2018 10:50:18 +0200
Committer: Thomas Gleixner <tglx@linutronix.de>
CommitDate: Thu, 27 Sep 2018 20:39:40 +0200
x86/mm/cpa: Move flush_tlb_all()
There is an atom errata, where we do a local TLB invalidate right
before we return and then do a global TLB invalidate.
Move the global invalidate up a little bit and avoid the local
invalidate entirely.
This does put the global invalidate under pgd_lock, but that shouldn't
matter.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Dave Hansen <dave.hansen@intel.com>
Cc: Bin Yang <bin.yang@intel.com>
Cc: Mark Gross <mark.gross@intel.com>
Link: https://lkml.kernel.org/r/20180919085947.882287392@infradead.org
---
arch/x86/mm/pageattr.c | 44 +++++++++++++++++---------------------------
1 file changed, 17 insertions(+), 27 deletions(-)
diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c
index a22f6b71a308..b6a4c638f086 100644
--- a/arch/x86/mm/pageattr.c
+++ b/arch/x86/mm/pageattr.c
@@ -999,14 +999,24 @@ __split_large_page(struct cpa_data *cpa, pte_t *kpte, unsigned long address,
__set_pmd_pte(kpte, address, mk_pte(base, __pgprot(_KERNPG_TABLE)));
/*
- * Intel Atom errata AAH41 workaround.
+ * Do a global flush tlb after splitting the large page
+ * and before we do the actual change page attribute in the PTE.
*
- * The real fix should be in hw or in a microcode update, but
- * we also probabilistically try to reduce the window of having
- * a large TLB mixed with 4K TLBs while instruction fetches are
- * going on.
+ * Without this, we violate the TLB application note, that says:
+ * "The TLBs may contain both ordinary and large-page
+ * translations for a 4-KByte range of linear addresses. This
+ * may occur if software modifies the paging structures so that
+ * the page size used for the address range changes. If the two
+ * translations differ with respect to page frame or attributes
+ * (e.g., permissions), processor behavior is undefined and may
+ * be implementation-specific."
+ *
+ * We do this global tlb flush inside the cpa_lock, so that we
+ * don't allow any other cpu, with stale tlb entries change the
+ * page attribute in parallel, that also falls into the
+ * just split large page entry.
*/
- __flush_tlb_all();
+ flush_tlb_all();
spin_unlock(&pgd_lock);
return 0;
@@ -1531,28 +1541,8 @@ repeat:
* We have to split the large page:
*/
err = split_large_page(cpa, kpte, address);
- if (!err) {
- /*
- * Do a global flush tlb after splitting the large page
- * and before we do the actual change page attribute in the PTE.
- *
- * With out this, we violate the TLB application note, that says
- * "The TLBs may contain both ordinary and large-page
- * translations for a 4-KByte range of linear addresses. This
- * may occur if software modifies the paging structures so that
- * the page size used for the address range changes. If the two
- * translations differ with respect to page frame or attributes
- * (e.g., permissions), processor behavior is undefined and may
- * be implementation-specific."
- *
- * We do this global tlb flush inside the cpa_lock, so that we
- * don't allow any other cpu, with stale tlb entries change the
- * page attribute in parallel, that also falls into the
- * just split large page entry.
- */
- flush_tlb_all();
+ if (!err)
goto repeat;
- }
return err;
}
next prev parent reply other threads:[~2018-09-27 18:53 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-19 8:50 [PATCH 0/8] x86/mm/cpa: Further optimizations Peter Zijlstra
2018-09-19 8:50 ` [PATCH 1/8] x86/mm/cpa: Use flush_tlb_all() Peter Zijlstra
2018-09-19 9:15 ` Peter Zijlstra
2018-09-19 10:08 ` Thomas Gleixner
2018-09-27 18:51 ` [tip:x86/mm] " tip-bot for Peter Zijlstra
2018-09-19 8:50 ` [PATCH 2/8] x86/mm/cpa: Move flush_tlb_all() Peter Zijlstra
2018-09-21 21:34 ` Dave Hansen
2018-09-22 10:37 ` Peter Zijlstra
2018-09-24 16:11 ` Dave Hansen
2018-09-27 18:52 ` tip-bot for Peter Zijlstra [this message]
2018-09-19 8:50 ` [PATCH 3/8] x86/mm/cpa: Unconditionally avoid WBINDV when we can Peter Zijlstra
2018-09-27 18:53 ` [tip:x86/mm] " tip-bot for Peter Zijlstra
2018-09-19 8:50 ` [PATCH 4/8] x86/mm/cpa: Use flush_tlb_kernel_range() Peter Zijlstra
2018-09-27 18:53 ` [tip:x86/mm] " tip-bot for Peter Zijlstra
2018-09-19 8:50 ` [PATCH 5/8] x86/mm/cpa: Move CLFLUSH test into cpa_flush_range() Peter Zijlstra
2018-09-27 18:54 ` [tip:x86/mm] " tip-bot for Peter Zijlstra
2018-09-19 8:50 ` [PATCH 6/8] x86/mm/cpa: Move CLFLUSH test into cpa_flush_array() Peter Zijlstra
2018-09-27 18:54 ` [tip:x86/mm] " tip-bot for Peter Zijlstra
2018-09-19 8:50 ` [PATCH 7/8] x86/mm/cpa: Factor common code between cpa_flush_*() Peter Zijlstra
2018-09-27 18:55 ` [tip:x86/mm] " tip-bot for Peter Zijlstra
2018-09-19 8:50 ` [PATCH 8/8] x86/mm/cpa: Optimize __cpa_flush_range() Peter Zijlstra
2018-09-27 18:55 ` [tip:x86/mm] " tip-bot for Peter Zijlstra
2018-09-21 22:50 ` [PATCH 0/8] x86/mm/cpa: Further optimizations Dave Hansen
2018-09-21 22:50 ` Dave Hansen
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=tip-c0a759abf5a686a37b9204c13b7e281fe516c8f0@git.kernel.org \
--to=tipbot@zytor.com \
--cc=bin.yang@intel.com \
--cc=dave.hansen@intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mark.gross@intel.com \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
/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;
as well as URLs for NNTP newsgroup(s).