From: Ingo Molnar <mingo@kernel.org>
To: linux-kernel@vger.kernel.org
Cc: Andy Lutomirski <luto@kernel.org>,
Rik van Riel <riel@surriel.com>,
"H . Peter Anvin" <hpa@zytor.com>,
Peter Zijlstra <peterz@infradead.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Andrew Morton <akpm@linux-foundation.org>,
Ingo Molnar <mingo@kernel.org>
Subject: [PATCH 6/7] x86/efi: Make efi_enter/leave_mm() use the use_/unuse_temporary_mm() machinery
Date: Wed, 2 Apr 2025 11:45:39 +0200 [thread overview]
Message-ID: <20250402094540.3586683-7-mingo@kernel.org> (raw)
In-Reply-To: <20250402094540.3586683-1-mingo@kernel.org>
From: Andy Lutomirski <luto@kernel.org>
This should be considerably more robust. It's also necessary for optimized
for_each_possible_lazymm_cpu() on x86 -- without this patch, EFI calls in
lazy context would remove the lazy mm from mm_cpumask().
[ mingo: Merged it on top of x86/alternatives ]
Signed-off-by: Andy Lutomirski <luto@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Rik van Riel <riel@surriel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Link: https://lore.kernel.org/r/20241119163035.877939834@infradead.org
---
arch/x86/platform/efi/efi_64.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/arch/x86/platform/efi/efi_64.c b/arch/x86/platform/efi/efi_64.c
index ac57259a432b..a5d3496d32a5 100644
--- a/arch/x86/platform/efi/efi_64.c
+++ b/arch/x86/platform/efi/efi_64.c
@@ -434,15 +434,12 @@ void __init efi_dump_pagetable(void)
*/
static void efi_enter_mm(void)
{
- efi_prev_mm = current->active_mm;
- current->active_mm = &efi_mm;
- switch_mm(efi_prev_mm, &efi_mm, NULL);
+ efi_prev_mm = use_temporary_mm(&efi_mm);
}
static void efi_leave_mm(void)
{
- current->active_mm = efi_prev_mm;
- switch_mm(&efi_mm, efi_prev_mm, NULL);
+ unuse_temporary_mm(efi_prev_mm);
}
void arch_efi_call_virt_setup(void)
--
2.45.2
next prev parent reply other threads:[~2025-04-02 9:46 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-02 9:45 [PATCH 0/7 -v2] Factor out, clean up and use the use_/unuse_temporary_mm() APIs some more Ingo Molnar
2025-04-02 9:45 ` [PATCH 1/7] x86/mm: Add 'mm' argument to unuse_temporary_mm() Ingo Molnar
2025-04-12 18:46 ` [tip: x86/alternatives] " tip-bot2 for Peter Zijlstra
2025-04-02 9:45 ` [PATCH 2/7] x86/events, x86/insn-eval: Remove incorrect current->active_mm references Ingo Molnar
2025-04-12 18:46 ` [tip: x86/alternatives] " tip-bot2 for Andy Lutomirski
2025-04-02 9:45 ` [PATCH 3/7] x86/mm: Make use_/unuse_temporary_mm() non-static Ingo Molnar
2025-04-12 18:46 ` [tip: x86/alternatives] " tip-bot2 for Andy Lutomirski
2025-04-02 9:45 ` [PATCH 4/7] x86/mm: Remove 'mm' argument from unuse_temporary_mm() again Ingo Molnar
2025-04-12 18:46 ` [tip: x86/alternatives] " tip-bot2 for Peter Zijlstra
2025-04-02 9:45 ` [PATCH 5/7] x86/mm: Allow temporary MMs when IRQs are on Ingo Molnar
2025-04-12 18:46 ` [tip: x86/alternatives] " tip-bot2 for Andy Lutomirski
2025-04-02 9:45 ` Ingo Molnar [this message]
2025-04-12 18:46 ` [tip: x86/alternatives] x86/efi: Make efi_enter/leave_mm() use the use_/unuse_temporary_mm() machinery tip-bot2 for Andy Lutomirski
2025-04-17 14:17 ` Borislav Petkov
2025-04-18 9:50 ` Peter Zijlstra
2025-04-18 11:43 ` Borislav Petkov
2025-04-18 12:37 ` Ingo Molnar
2025-04-18 12:48 ` [tip: x86/alternatives] x86/mm: Fix {,un}use_temporary_mm() IRQ state tip-bot2 for Peter Zijlstra
2025-04-02 9:45 ` [PATCH 7/7] x86/mm: Opt-in to IRQs-off activate_mm() Ingo Molnar
2025-04-12 18:46 ` [tip: x86/alternatives] " tip-bot2 for 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=20250402094540.3586683-7-mingo@kernel.org \
--to=mingo@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=peterz@infradead.org \
--cc=riel@surriel.com \
--cc=torvalds@linux-foundation.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