[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a68b378a40310c38f731f4bc7f0a9cc0d89efe92.camel@intel.com>
Date: Mon, 28 Mar 2022 14:57:59 +1300
From: Kai Huang <kai.huang@...el.com>
To: "Tian, Kevin" <kevin.tian@...el.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>
Cc: "Hansen, Dave" <dave.hansen@...el.com>,
"Christopherson,, Sean" <seanjc@...gle.com>,
"pbonzini@...hat.com" <pbonzini@...hat.com>,
"kirill.shutemov@...ux.intel.com" <kirill.shutemov@...ux.intel.com>,
"sathyanarayanan.kuppuswamy@...ux.intel.com"
<sathyanarayanan.kuppuswamy@...ux.intel.com>,
"peterz@...radead.org" <peterz@...radead.org>,
"Luck, Tony" <tony.luck@...el.com>,
"ak@...ux.intel.com" <ak@...ux.intel.com>,
"Williams, Dan J" <dan.j.williams@...el.com>,
"Yamahata, Isaku" <isaku.yamahata@...el.com>
Subject: Re: [PATCH v2 04/21] x86/virt/tdx: Add skeleton for detecting and
initializing TDX on demand
On Wed, 2022-03-23 at 19:49 +1300, Tian, Kevin wrote:
> > From: Kai Huang <kai.huang@...el.com>
> > Sent: Sunday, March 13, 2022 6:50 PM
> > +static bool seamrr_enabled(void)
> > +{
> > + /*
> > + * To detect any BIOS misconfiguration among cores, all logical
> > + * cpus must have been brought up at least once. This is true
> > + * unless 'maxcpus' kernel command line is used to limit the
> > + * number of cpus to be brought up during boot time. However
> > + * 'maxcpus' is basically an invalid operation mode due to the
> > + * MCE broadcast problem, and it should not be used on a TDX
> > + * capable machine. Just do paranoid check here and WARN()
> > + * if not the case.
> > + */
> > + if (WARN_ON_ONCE(!cpumask_equal(&cpus_booted_once_mask,
> > + cpu_present_mask)))
> > + return false;
> > +
>
> cpu_present_mask doesn't always represent BIOS-enabled CPUs as it
> can be further restricted by 'nr_cpus' and 'possible_cpus'. From this
> angle above check doesn't capture all misconfigured boot options
> which is incompatible with TDX. Then is such partial check still useful
> or better to just document those restrictions and let TDX module
> capture any violation later as what you explained in __init_tdx()?
>
> Thanks
> Kevin
The purpose of checking cpus_booted_once_mask aganist cpu_present_mask is NOT to
check whether all BIOS-enabled CPUs are brought up at least once. Instead, the
purpose is to check whether all cpus that kernel can use are brought up at least
once (TDX-capable machine doesn't support ACPI CPU hotplug and all cpus are
marked as enabled in MADT table, therefore cpu_present_mask is used instead of
cpu_possible_mask). This is used to make sure SEAMRR has been detected on all
cpus that kernel can use.
Checking whether "all BIOS-enabled cpus are up" is not done here (neither in
this series as we discussed it seems there's no appropriate variable to
represent it). And we just let TDH.SYS.CONFIG to fail if TDH.SYS.LP.INIT is not
done on all BIOS-enabled CPUs.
--
Thanks,
-Kai
Powered by blists - more mailing lists