From: "tip-bot2 for Will Deacon" <tip-bot2@linutronix.de> To: linux-tip-commits@vger.kernel.org Cc: Will Deacon <will@kernel.org>, "Peter Zijlstra (Intel)" <peterz@infradead.org>, Yu Zhao <yuzhao@google.com>, Linus Torvalds <torvalds@linux-foundation.org>, x86@kernel.org, linux-kernel@vger.kernel.org Subject: [tip: core/mm] x86/ldt: Use tlb_gather_mmu_fullmm() when freeing LDT page-tables Date: Mon, 01 Feb 2021 11:32:25 -0000 [thread overview] Message-ID: <161217914514.23325.15895050534940378697.tip-bot2@tip-bot2> (raw) In-Reply-To: <20210127235347.1402-7-will@kernel.org> The following commit has been merged into the core/mm branch of tip: Commit-ID: 8cf55f24ce6cf90eb8828421e15e9efcd508bd2c Gitweb: https://git.kernel.org/tip/8cf55f24ce6cf90eb8828421e15e9efcd508bd2c Author: Will Deacon <will@kernel.org> AuthorDate: Wed, 27 Jan 2021 23:53:47 Committer: Peter Zijlstra <peterz@infradead.org> CommitterDate: Fri, 29 Jan 2021 20:02:29 +01:00 x86/ldt: Use tlb_gather_mmu_fullmm() when freeing LDT page-tables free_ldt_pgtables() uses the MMU gather API for batching TLB flushes over the call to free_pgd_range(). However, tlb_gather_mmu() expects to operate on user addresses and so passing LDT_{BASE,END}_ADDR will confuse the range setting logic in __tlb_adjust_range(), causing the gather to identify a range starting at TASK_SIZE. Such a large range will be converted into a 'fullmm' flush by the low-level invalidation code, so change the caller to invoke tlb_gather_mmu_fullmm() directly. Signed-off-by: Will Deacon <will@kernel.org> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Reviewed-by: Yu Zhao <yuzhao@google.com> Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org> Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Link: https://lkml.kernel.org/r/20210127235347.1402-7-will@kernel.org --- arch/x86/kernel/ldt.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/ldt.c b/arch/x86/kernel/ldt.c index 7ad9834..aa15132 100644 --- a/arch/x86/kernel/ldt.c +++ b/arch/x86/kernel/ldt.c @@ -398,7 +398,13 @@ static void free_ldt_pgtables(struct mm_struct *mm) if (!boot_cpu_has(X86_FEATURE_PTI)) return; - tlb_gather_mmu(&tlb, mm); + /* + * Although free_pgd_range() is intended for freeing user + * page-tables, it also works out for kernel mappings on x86. + * We use tlb_gather_mmu_fullmm() to avoid confusing the + * range-tracking logic in __tlb_adjust_range(). + */ + tlb_gather_mmu_fullmm(&tlb, mm); free_pgd_range(&tlb, start, end, start, end); tlb_finish_mmu(&tlb); #endif
next prev parent reply other threads:[~2021-02-01 11:33 UTC|newest] Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-01-27 23:53 [PATCH v3 0/6] tlb: Fix (soft-)dirty bit management & clean up API Will Deacon 2021-01-27 23:53 ` [PATCH v3 1/6] mm: proc: Invalidate TLB after clearing soft-dirty page state Will Deacon 2021-02-01 11:32 ` [tip: core/mm] " tip-bot2 for Will Deacon 2021-01-27 23:53 ` [PATCH v3 2/6] tlb: mmu_gather: Remove unused start/end arguments from tlb_finish_mmu() Will Deacon 2021-02-01 11:32 ` [tip: core/mm] " tip-bot2 for Will Deacon 2021-01-27 23:53 ` [PATCH v3 3/6] tlb: mmu_gather: Introduce tlb_gather_mmu_fullmm() Will Deacon 2021-02-01 11:32 ` [tip: core/mm] " tip-bot2 for Will Deacon 2021-01-27 23:53 ` [PATCH v3 4/6] tlb: mmu_gather: Remove start/end arguments from tlb_gather_mmu() Will Deacon 2021-01-27 23:53 ` [PATCH v3 5/6] tlb: arch: Remove empty __tlb_remove_tlb_entry() stubs Will Deacon 2021-02-01 11:32 ` [tip: core/mm] " tip-bot2 for Will Deacon 2021-01-27 23:53 ` [PATCH v3 6/6] x86/ldt: Use tlb_gather_mmu_fullmm() when freeing LDT page-tables Will Deacon 2021-02-01 11:32 ` tip-bot2 for Will Deacon [this message] 2021-01-28 17:14 ` [PATCH v3 0/6] tlb: Fix (soft-)dirty bit management & clean up API Linus Torvalds 2021-01-28 17:14 ` Linus Torvalds 2021-01-29 11:09 ` Peter Zijlstra
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=161217914514.23325.15895050534940378697.tip-bot2@tip-bot2 \ --to=tip-bot2@linutronix.de \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-tip-commits@vger.kernel.org \ --cc=peterz@infradead.org \ --cc=torvalds@linux-foundation.org \ --cc=will@kernel.org \ --cc=x86@kernel.org \ --cc=yuzhao@google.com \ --subject='Re: [tip: core/mm] x86/ldt: Use tlb_gather_mmu_fullmm() when freeing LDT page-tables' \ /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
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.