* Sean Christopherson <sea...@google.com> wrote:
> On Sat, May 17, 2025, Ingo Molnar wrote: > > > > * Sean Christopherson <sea...@google.com> wrote: > > > > > From: Zheyun Shen <szy0...@sjtu.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 <szy0...@sjtu.edu.cn> > > > Reviewed-by: Tom Lendacky <thomas.lenda...@amd.com> > > > Link: https://lore.kernel.org/r/20250128015345.7929-2-szy0...@sjtu.edu.cn > > > [sean: move to lib, add SMP=n helpers, clarify usage] > > > Acked-by: Kai Huang <kai.hu...@intel.com> > > > Signed-off-by: Sean Christopherson <sea...@google.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