[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aCxOfFSSkHYm-rYS@gmail.com>
Date: Tue, 20 May 2025 11:42:20 +0200
From: Ingo Molnar <mingo@...nel.org>
To: Sean Christopherson <seanjc@...gle.com>
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
* Sean Christopherson <seanjc@...gle.com> wrote:
> 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);
>
> How about wbinvd_on_cpus_mask(), to make it more obvious that it operates on
> multiple CPUs? At a glance, wbinvd_on_cpumask() could be mistaken for a masked
> version of wbinvd_on_cpu().
Works for me!
Thanks,
Ingo
Powered by blists - more mailing lists