Re: [PATCH 11/49] x86/alternatives: Remove the confusing, inaccurate & unnecessary 'temp_mm_state_t' abstraction

From: Ingo Molnar
Date: Wed Apr 02 2025 - 00:07:29 EST



* Ingo Molnar <mingo@xxxxxxxxxx> wrote:

>
> * Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
>
> > On Fri, Mar 28, 2025 at 02:26:26PM +0100, Ingo Molnar wrote:
> > > So the temp_mm_state_t abstraction used by use_temporary_mm() and
> > > unuse_temporary_mm() is super confusing:
> >
> > I thing I see what you're saying, but we also still have these patches
> > pending:
> >
> > https://lkml.kernel.org/r/20241119162527.952745944@xxxxxxxxxxxxx
> >
> > :-(
>
> Yeah, so I think we should do your queue on top of mine, the
> whole temp_mm_state_t abstraction was rather nonsensical,
> and we shouldn't be iterating confusing code...
>
> I've ported patches #1 and #3 from your queue on top, see
> attached below - these should be the two that represent 99%
> of the conflicts between these two efforts AFAICS.
>
> Does that work for you?

To make this an easier decision, I've ported Andy's and your patches on
top of the x86/alternatives series, into WIP.x86/mm, resolving the
conflicts, with a few touchups:

git://git.kernel.org/pub/scm/linux/kernel/git/mingo/tip.git WIP.x86/mm

Seems to work fine, after some light testing.

I'll send it out for another round of review if that's fine to you.

Thanks,

Ingo

==========>

git://git.kernel.org/pub/scm/linux/kernel/git/mingo/tip.git WIP.x86/mm

Andy Lutomirski (5):
x86/events, x86/insn-eval: Remove incorrect current->active_mm references
x86/mm: Make use/unuse_temporary_mm() non-static
x86/mm: Allow temporary mms when IRQs are on
x86/efi: Make efi_enter/leave_mm use the *_temporary_mm() machinery
x86/mm: Opt in to IRQs-off activate_mm()

Peter Zijlstra (2):
x86/mm: Add mm argument to unuse_temporary_mm()
x86/mm: Remove 'mm' argument from unuse_temporary_mm() again

arch/x86/Kconfig | 1 +
arch/x86/events/core.c | 9 ++++-
arch/x86/include/asm/mmu_context.h | 5 ++-
arch/x86/kernel/alternative.c | 64 -----------------------------------
arch/x86/lib/insn-eval.c | 13 +++++--
arch/x86/mm/tlb.c | 69 ++++++++++++++++++++++++++++++++++++++
arch/x86/platform/efi/efi_64.c | 7 ++--
7 files changed, 94 insertions(+), 74 deletions(-)