[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


  • To: George Dunlap <gwd@xxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 23 Nov 2026 14:29:01 +0100
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=google header.d=suse.com header.i="@suse.com" header.h="Content-Transfer-Encoding:Content-Type:In-Reply-To:Autocrypt:From:Content-Language:References:Cc:To:Subject:User-Agent:MIME-Version:Date:Message-ID"
  • Autocrypt: addr=jbeulich@xxxxxxxx; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRwcZQM32aZK 7Pj2XbGWIUrZrd70x1eAP9QE3P79Y2oLrsCgbZJfEwCgvz9JjGmQqQkRiTVzlZVCJYcyGGsD /0tbFCzD2h20ahe8rC1gbb3K3qk+LpBtvjBu1RY9drYk0NymiGbJWZgab6t1jM7sk2vuf0Py O9Hf9XBmK0uE9IgMaiCpc32XV9oASz6UJebwkX+zF2jG5I1BfnO9g7KlotcA/v5ClMjgo6Gl MDY4HxoSRu3i1cqqSDtVlt+AOVBJBACrZcnHAUSuCXBPy0jOlBhxPqRWv6ND4c9PH1xjQ3NP nxJuMBS8rnNg22uyfAgmBKNLpLgAGVRMZGaGoJObGf72s6TeIqKJo/LtggAS9qAUiuKVnygo 3wjfkS9A3DRO+SpU7JqWdsveeIQyeyEJ/8PTowmSQLakF+3fote9ybzd880fSmFuIEJldWxp Y2ggPGpiZXVsaWNoQHN1c2UuY29tPsJgBBMRAgAgBQJZN5xEAhsDBgsJCAcDAgQVAggDBBYC AwECHgECF4AACgkQoDSui/t3IH4J+wCfQ5jHdEjCRHj23O/5ttg9r9OIruwAn3103WUITZee e7Sbg12UgcQ5lv7SzsFNBFk3nEQQCACCuTjCjFOUdi5Nm244F+78kLghRcin/awv+IrTcIWF hUpSs1Y91iQQ7KItirz5uwCPlwejSJDQJLIS+QtJHaXDXeV6NI0Uef1hP20+y8qydDiVkv6l IreXjTb7DvksRgJNvCkWtYnlS3mYvQ9NzS9PhyALWbXnH6sIJd2O9lKS1Mrfq+y0IXCP10eS FFGg+Av3IQeFatkJAyju0PPthyTqxSI4lZYuJVPknzgaeuJv/2NccrPvmeDg6Coe7ZIeQ8Yj t0ARxu2xytAkkLCel1Lz1WLmwLstV30g80nkgZf/wr+/BXJW/oIvRlonUkxv+IbBM3dX2OV8 AmRv1ySWPTP7AAMFB/9PQK/VtlNUJvg8GXj9ootzrteGfVZVVT4XBJkfwBcpC/XcPzldjv+3 HYudvpdNK3lLujXeA5fLOH+Z/G9WBc5pFVSMocI71I8bT8lIAzreg0WvkWg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger@xxxxxxxxxxxxxx>, Teddy Astie <teddy.astie@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 23 Nov 2026 13:29:10 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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>




 


Rackspace

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