[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aCtWM63FyQKMJzqE@google.com>
Date: Mon, 19 May 2025 09:02:59 -0700
From: Sean Christopherson <seanjc@...gle.com>
To: Ingo Molnar <mingo@...nel.org>
Cc: Thomas Gleixner <tglx@...utronix.de>, Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>, x86@...nel.org,
Paolo Bonzini <pbonzini@...hat.com>, Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <mripard@...nel.org>, Thomas Zimmermann <tzimmermann@...e.de>,
David Airlie <airlied@...il.com>, Simona Vetter <simona@...ll.ch>, linux-kernel@...r.kernel.org,
kvm@...r.kernel.org, dri-devel@...ts.freedesktop.org,
Zheyun Shen <szy0127@...u.edu.cn>, Tom Lendacky <thomas.lendacky@....com>,
Kevin Loughlin <kevinloughlin@...gle.com>, Kai Huang <kai.huang@...el.com>,
Mingwei Zhang <mizhang@...gle.com>
Subject: Re: [PATCH v2 7/8] x86, lib: Add wbinvd and wbnoinvd helpers to
target multiple CPUs
On Sat, May 17, 2025, Ingo Molnar wrote:
>
> * Sean Christopherson <seanjc@...gle.com> wrote:
>
> > From: Zheyun Shen <szy0127@...u.edu.cn>
> >
> > Extract KVM's open-coded calls to do writeback caches on multiple CPUs to
> > common library helpers for both WBINVD and WBNOINVD (KVM will use both).
> > Put the onus on the caller to check for a non-empty mask to simplify the
> > SMP=n implementation, e.g. so that it doesn't need to check that the one
> > and only CPU in the system is present in the mask.
> >
> > Signed-off-by: Zheyun Shen <szy0127@...u.edu.cn>
> > Reviewed-by: Tom Lendacky <thomas.lendacky@....com>
> > Link: https://lore.kernel.org/r/20250128015345.7929-2-szy0127@sjtu.edu.cn
> > [sean: move to lib, add SMP=n helpers, clarify usage]
> > Acked-by: Kai Huang <kai.huang@...el.com>
> > Signed-off-by: Sean Christopherson <seanjc@...gle.com>
> > ---
> > arch/x86/include/asm/smp.h | 12 ++++++++++++
> > arch/x86/kvm/x86.c | 8 +-------
> > arch/x86/lib/cache-smp.c | 12 ++++++++++++
> > 3 files changed, 25 insertions(+), 7 deletions(-)
> >
> > diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h
> > index e08f1ae25401..fe98e021f7f8 100644
> > --- a/arch/x86/include/asm/smp.h
> > +++ b/arch/x86/include/asm/smp.h
> > @@ -113,7 +113,9 @@ void native_play_dead(void);
> > void play_dead_common(void);
> > void wbinvd_on_cpu(int cpu);
> > void wbinvd_on_all_cpus(void);
> > +void wbinvd_on_many_cpus(struct cpumask *cpus);
> > void wbnoinvd_on_all_cpus(void);
> > +void wbnoinvd_on_many_cpus(struct cpumask *cpus);
>
> Let's go with the _on_cpumask() suffix:
>
> void wbinvd_on_cpu(int cpu);
> +void wbinvd_on_cpumask(struct cpumask *cpus);
> void wbinvd_on_all_cpus(void);
>
> And the wb*invd_all_cpus() methods should probably be inlined wrappers
> with -1 as the cpumask, or so - not two separate functions?
Using two separate functions allows _on_all_cpus() to defer the mask generation
to on_each_cpu(), i.e. avoids having to duplicate the passing of cpu_online_mask.
IMO, duplicating passing __wbinvd is preferable to duplicating the use of
cpu_online_mask.
> In fact it would be nice to have the DRM preparatory patch and all the
> x86 patches at the beginning of the next version of the series, so
> those 4 patches can be applied to the x86 tree. Can make it a separate
> permanent branch based on v6.15-rc6/rc7.
Can do, assuming there's no lurking dependency I'm missing.
Powered by blists - more mailing lists