From: Peter Zijlstra <peterz@infradead.org>
To: x86@kernel.org, "To:riel"@surriel.com
Cc: linux-kernel@vger.kernel.org, peterz@infradead.org
Subject: [PATCH 4/7] x86/mm: Remove mm argument from unuse_temporary_mm() again
Date: Tue, 19 Nov 2024 17:25:31 +0100 [thread overview]
Message-ID: <20241119163035.648739178@infradead.org> (raw)
In-Reply-To: <20241119162527.952745944@infradead.org>
Now that unuse_temporary_mm() lives in tlb.c it can access loaded_mm.
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
arch/x86/include/asm/mmu_context.h | 2 +-
arch/x86/kernel/alternative.c | 2 +-
arch/x86/mm/tlb.c | 8 +++++---
3 files changed, 7 insertions(+), 5 deletions(-)
--- a/arch/x86/include/asm/mmu_context.h
+++ b/arch/x86/include/asm/mmu_context.h
@@ -268,6 +268,6 @@ typedef struct {
} temp_mm_state_t;
extern temp_mm_state_t use_temporary_mm(struct mm_struct *mm);
-extern void unuse_temporary_mm(struct mm_struct *mm, temp_mm_state_t prev_state);
+extern void unuse_temporary_mm(temp_mm_state_t prev_state);
#endif /* _ASM_X86_MMU_CONTEXT_H */
--- a/arch/x86/kernel/alternative.c
+++ b/arch/x86/kernel/alternative.c
@@ -1874,7 +1874,7 @@ static void *__text_poke(text_poke_f fun
* instruction that already allows the core to see the updated version.
* Xen-PV is assumed to serialize execution in a similar manner.
*/
- unuse_temporary_mm(poking_mm, prev);
+ unuse_temporary_mm(prev);
/*
* Flushing the TLB might involve IPIs, which would require enabled
--- a/arch/x86/mm/tlb.c
+++ b/arch/x86/mm/tlb.c
@@ -720,13 +720,15 @@ temp_mm_state_t use_temporary_mm(struct
return temp_state;
}
-void unuse_temporary_mm(struct mm_struct *mm, temp_mm_state_t prev_state)
+void unuse_temporary_mm(temp_mm_state_t prev_state)
{
lockdep_assert_irqs_disabled();
- switch_mm_irqs_off(NULL, prev_state.mm, current);
/* Clear the cpumask, to indicate no TLB flushing is needed anywhere */
- cpumask_clear_cpu(raw_smp_processor_id(), mm_cpumask(mm));
+ cpumask_clear_cpu(smp_processor_id(),
+ mm_cpumask(this_cpu_read(cpu_tlbstate.loaded_mm)));
+
+ switch_mm_irqs_off(NULL, prev_state.mm, current);
/*
* Restore the breakpoints if they were disabled before the temporary mm
next prev parent reply other threads:[~2024-11-19 16:32 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-19 16:25 [PATCH 0/7] x86/mm: Clean up and use temportary_mm more Peter Zijlstra
2024-11-19 16:25 ` [PATCH 1/7] x86/mm: Add mm argument to unuse_temporary_mm() Peter Zijlstra
2024-11-19 16:25 ` [PATCH 2/7] x86/events, x86/insn-eval: Remove incorrect active_mm references Peter Zijlstra
2024-11-19 16:25 ` [PATCH 3/7] x86/mm: Make use/unuse_temporary_mm() non-static Peter Zijlstra
2024-11-19 16:25 ` Peter Zijlstra [this message]
2024-11-19 16:25 ` [PATCH 5/7] x86/mm: Allow temporary mms when IRQs are on Peter Zijlstra
2024-11-19 16:25 ` [PATCH 6/7] x86/efi: Make efi_enter/leave_mm use the temporary_mm machinery Peter Zijlstra
2024-11-19 16:25 ` [PATCH 7/7] x86/mm: Opt in to IRQs-off activate_mm() Peter Zijlstra
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 4/7] x86/mm: Remove 'mm' argument from unuse_temporary_mm() again Ingo Molnar
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=20241119163035.648739178@infradead.org \
--to=peterz@infradead.org \
--cc="To:riel"@surriel.com \
--cc=linux-kernel@vger.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
all inboxes | Powered by JetHome®