[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BL1PR11MB59789A024CFA9E9DE715C2F1F7DD9@BL1PR11MB5978.namprd11.prod.outlook.com>
Date: Mon, 13 Feb 2023 21:19:07 +0000
From: "Huang, Kai" <kai.huang@...el.com>
To: "Hansen, Dave" <dave.hansen@...el.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>
CC: "linux-mm@...ck.org" <linux-mm@...ck.org>,
"peterz@...radead.org" <peterz@...radead.org>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"Christopherson,, Sean" <seanjc@...gle.com>,
"pbonzini@...hat.com" <pbonzini@...hat.com>,
"Williams, Dan J" <dan.j.williams@...el.com>,
"Wysocki, Rafael J" <rafael.j.wysocki@...el.com>,
"kirill.shutemov@...ux.intel.com" <kirill.shutemov@...ux.intel.com>,
"Huang, Ying" <ying.huang@...el.com>,
"Chatre, Reinette" <reinette.chatre@...el.com>,
"Brown, Len" <len.brown@...el.com>,
"Luck, Tony" <tony.luck@...el.com>,
"ak@...ux.intel.com" <ak@...ux.intel.com>,
"Yamahata, Isaku" <isaku.yamahata@...el.com>,
"Gao, Chao" <chao.gao@...el.com>,
"sathyanarayanan.kuppuswamy@...ux.intel.com"
<sathyanarayanan.kuppuswamy@...ux.intel.com>,
"david@...hat.com" <david@...hat.com>,
"bagasdotme@...il.com" <bagasdotme@...il.com>,
"Shahar, Sagi" <sagis@...gle.com>,
"imammedo@...hat.com" <imammedo@...hat.com>
Subject: RE: [PATCH v9 07/18] x86/virt/tdx: Do TDX module per-cpu
initialization
> On 2/13/23 03:59, Kai Huang wrote:
> > To avoid duplicated code, add a
> > helper to call SEAMCALL on all online cpus one by one but with a skip
> > function to check whether to skip certain cpus, and use that helper to
> > do the per-cpu initialization.
> ...
> > +/*
> > + * Call @func on all online cpus one by one but skip those cpus
> > + * when @skip_func is valid and returns true for them.
> > + */
> > +static int tdx_on_each_cpu_cond(int (*func)(void *), void *func_data,
> > + bool (*skip_func)(int cpu, void *),
> > + void *skip_data)
>
> I only see one caller of this. Where is the duplicated code?
The other caller is in patch 15 (x86/virt/tdx: Configure global KeyID on all packages).
I kinda mentioned this in the changelog:
" Similar to the per-cpu module initialization, a later step to config the key for the global KeyID..."
If we don't have this helper, then we can end up with having below loop in two functions:
for_each_online(cpu) {
if (should_skip(cpu))
continue;
// call @func on @cpu.
}
Powered by blists - more mailing lists