[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v6 25/44] x86/mm: introduce a per-vCPU state window in the perdomain area



On Wed, Nov 18, 2026 at 11:51 AM Jan Beulich <jbeulich@xxxxxxxx> wrote:
>
> On 03.11.2026 23:13, George Dunlap wrote:
> > --- a/xen/arch/x86/include/asm/config.h
> > +++ b/xen/arch/x86/include/asm/config.h
> > @@ -158,7 +158,7 @@
> >  /* Slot 260: per-domain mappings (including map cache). */
> >  #define PERDOMAIN_VIRT_START    (PML4_ADDR(260))
> >  #define PERDOMAIN_SLOT_MBYTES   (PML4_ENTRY_BYTES >> (20 + 
> > PAGETABLE_ORDER))
> > -#define PERDOMAIN_SLOTS         3
> > +#define PERDOMAIN_SLOTS         4
> >  #define PERDOMAIN_VIRT_SLOT(s)  (PERDOMAIN_VIRT_START + (s) * \
> >                                   (PERDOMAIN_SLOT_MBYTES << 20))
> >  /* Slot 4: mirror of per-domain mappings (for compat xlat area accesses). 
> > */
> > @@ -293,6 +293,25 @@ extern unsigned long xen_phys_start;
> >  #define ARG_XLAT_START(v)        \
> >      (ARG_XLAT_VIRT_START + ((v)->vcpu_id << ARG_XLAT_VA_SHIFT))
> >
> > +/*
> > + * Per-vCPU state window. The fourth per-domain-mapping sub-area: a small
> > + * per-vCPU stride of page slots holding long-lived per-vCPU structures 
> > kept
> > + * out of always-mapped memory, each mapped once for the life of the vCPU 
> > at
> > + * a fixed index within the stride.
> > + */
> > +#define VCPU_STATE_SLOT          3
> > +#define VCPU_STATE_VIRT_START    PERDOMAIN_VIRT_SLOT(VCPU_STATE_SLOT)
> > +#define VCPU_STATE_ORDER         3
>
> As long as this remains <= GDT_LDT_VCPU_SHIFT, it won't further constrain
> MAX_VIRT_CPUS (primarily relevant to PV, when right here you cover HVM
> stuff only, but anyway). Nevertheless I wonder whether ...
>
> > +#define VCPU_STATE_NR_PAGES      (1U << VCPU_STATE_ORDER)
> > +#define VCPU_STATE_VA_SHIFT      (VCPU_STATE_ORDER + PAGE_SHIFT)
> > +#define VCPU_STATE_START(v)      \
> > +    (VCPU_STATE_VIRT_START + ((v)->vcpu_id << VCPU_STATE_VA_SHIFT))
> > +#define VCPU_STATE_ADDR(v, idx)  \
> > +    (VCPU_STATE_START(v) + (idx) * PAGE_SIZE)
> > +#define VCPU_STATE_IDX_VMCB      0
> > +#define VCPU_STATE_IDX_N2VMCB    1
> > +#define VCPU_STATE_IDX_VMX_MSR   2
>
> ... we wouldn't better conserve on space use from the very start: VMX_MSR
> could re-use either of the other two slots.

Sure, we can have "AMD-specific", "Intel-specific", and "Common" slot
sections, where the first two are effectively a union.

 -George



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.