[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v3 2/6] xen/x86: Add initial x2APIC ID to the per-vLAPIC save area
On Thu, May 30, 2024 at 12:08:26PM +0100, Andrew Cooper wrote: > On 29/05/2024 3:32 pm, Alejandro Vallejo wrote: > > diff --git a/xen/lib/x86/policy.c b/xen/lib/x86/policy.c > > index f033d22785be..b70b22d55fcf 100644 > > --- a/xen/lib/x86/policy.c > > +++ b/xen/lib/x86/policy.c > > @@ -2,6 +2,17 @@ > > > > #include <xen/lib/x86/cpu-policy.h> > > > > +uint32_t x86_x2apic_id_from_vcpu_id(const struct cpu_policy *p, uint32_t > > id) > > +{ > > + /* > > + * TODO: Derive x2APIC ID from the topology information inside `p` > > + * rather than from the vCPU ID alone. This bodge is a temporary > > + * measure until all infra is in place to retrieve or derive the > > + * initial x2APIC ID from migrated domains. > > + */ > > + return id * 2; > > +} > > + > > I'm afraid it's nonsensical to try and derive x2APIC ID from a > policy+vcpu_id. > > Take a step back, and think the data through. > > A VM has: > * A unique APIC_ID for each vCPU > * Info in CPUID describing how to decompose the APIC_ID into topology > > Right now, because this is all completely broken, we have: > * Hardcoded APIC_ID = vCPU_ID * 2 > * Total nonsense in CPUID > > > When constructing a VM, the toolstack (given suitable admin > guidance/defaults) *must* choose both: > * The APIC_ID themselves > * The CPUID topo data to match > > i.e. this series should be editing the toolstack's call to > xc_domain_hvm_setcontext(). > > It's not, because AFAICT you're depending on the migration compatibility > logic and inserting a new hardcoded assumption about symmetry of the layout. > > > The data flows we need are: > > (New) create: > * Toolstack chooses both parts of topo information > * Xen needs a default, which reasonably can be APIC_ID=vCPU_ID when the > rest of the data flow has been cleaned up. But this is needs to be > explicit in vcpu_create() and without reference to the policy. Doesn't using APIC_ID=vCPU_ID limits us to only being able to expose certain typologies? (as vCPU IDs are contiguous). For example exposing a topology with 3 cores per package won't be possible? Not saying it's a bad move to start this way, but if we want to support exposing more exotic topology sooner or later we will need some kind of logic that assigns the APIC IDs based on the knowledge of the expected topology. Whether is gets such knowledge from the CPU policy or directly from the toolstack is another question. Thanks, Roger.
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |