|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v7 02/50] x86/mm: introduce a per-vCPU state window in the perdomain area
On 19.11.2026 22:06, George Dunlap wrote: > Guest-owned register state that Xen keeps in always-mapped memory, on > the xenheap or in the xmalloc pool, is to move to the domain heap, > reached through mappings of its own rather than through the directmap. > The long-lived per-vCPU structures involved (the SVM VMCB, the VMX > guest MSR load/save list, the guest XSAVE area, and later the > aggregated small per-vCPU allocations) all want the same shape: one or > more domain-heap pages, mapped once at fixed per-vCPU virtual addresses > for the life of the vCPU. > > Add a fourth per-domain-mapping sub-area providing that destination: a > small per-vCPU stride of page slots, with a fixed index assigned to > each relocated structure and the page tables created at vCPU creation > time. Consumers allocate their own pages and install them with > populate_perdomain_mapping(); the backing pages remain caller-owned, > so their lifetime stays with the consumer, while the page tables are > torn down with the rest of the per-domain area. > > Before freeing their pages, consumers take them out of the window with > unmap_vcpu_state(), on failure paths as at teardown: vCPU creation can > fail once a consumer has mapped its pages, and the domain lives on. > It flushes the domain's dirty CPUs: the window is in the per-domain > area that all of the domain's vCPUs share, so these are the CPUs whose > page-tables carry it. So far that mask is empty on every call, as the > vCPU has not run or the domain is paused. A consumer reaching a page > from another context, through a transient map_domain_page() mapping, > drops the mapping with unmap_vcpu_state_page(), which also flushes this > CPU's translations of it, there and at its alias in the per-domain > mirror: the mapcache defers that flush, and the translations would > otherwise outlive the mapping. > > The window has the same domain-wide visibility as the other > per-domain sub-areas: each vCPU's stride, at virtual addresses keyed on > vcpu_id, is mapped in the page tables of all of the domain's vCPUs. > > This is infrastructure for moving the SVM VMCB, the VMX MSR load/save > lists, the saved register frames, the HVM emulator's caches and the > guest XSAVE areas off the xenheap. Slots specific to AMD or Intel can > share the same space. Nothing occupies the area yet; the only > behavioural change is the page-table allocation itself and the failure > path that comes with it: vCPU creation can now fail with -ENOMEM. > Both apply to every guest vCPU, PV ones included. A domain gets one > L2 plus an L1 per 64 vCPUs: 2 pages for up to 64 vCPUs. A PV domain's > window stays empty until the register frames and XSAVE areas move > there. > > Assisted-by: Claude Code:claude-fable-5, Claude Code:claude-opus-5-5 > Signed-off-by: George Dunlap <gwd@xxxxxxxxxxxxxx> Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |