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

[PATCH v3 1/2] xen/x86: Return virtual address from alloc_stub_page()


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jason Andryuk <jason.andryuk@xxxxxxx>
  • Date: Mon, 8 Jun 2026 20:06:37 -0400
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=h69F0/HRgHoEeubvo+fbrRYs/KCcGjkSw3JqSU3qEyg=; b=mQYBQ9EAEhx4QpUR/a2oLmdEgGaNpjG0xEXdaq7QnAii8OX6S6hcT+3/Nrvd4rMlyBYS57oVUWk0swhTjtInMsavIBS/l7Z4nZJk7w6v1NkuTrg1HkG1z7hdwmU/UYK5x7IoCpY/JMPuNBblp7hkQ3dc3m8y00yhpFDtg8El4ZWYfnxVfMJI58x5TmzvDm6FjmQVlha6t7+Z0T8gwM5E+3OK+n7JxdBeKbmC/D689JMxIkuv+g2eQA0nXrePFf9bAschcARiiMC3IV0ojip7cNzPxRjuqdDcrbrqqf54dPo4c+9sxJMrgvqzsczVaokv4rd6NwaPc7dEOBaI5p0faQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=GcCUSv5WBrwk8MjikeVDPMwe3Z4dI9k9Cildit95pqZxcNMUMg3bFgvgJFfXOCPdJHqD7uyJbzHWtaSbEmm2AdJjvNgA1lUTuW3L3oKVd+PfEg8ZEK1fGLZ159JzIcLlAkKYzdzT90x3r0tOzEXP22vOmQHKFyfmMpF15Xp1DTAgsr0WT1z/pC6ERy0rSE9Ry8LpTgNnEfwCz/5gHpihF9wLut1j/gZODqOO1Wd00y7OLAizVd6uaax6XDLfhAx/WjhfxRjDc35DTi/eNvnQPMjhOzzABmenDOraJYAzb0Chp8CK7zeWqhYiFlKNgFMgLeczs5KO0v+Q+ojAQHaEtg==
  • Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=selector1 header.d=amd.com header.i="@amd.com" header.h="From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck"
  • Cc: Jason Andryuk <jason.andryuk@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Teddy Astie <teddy.astie@xxxxxxxxxx>
  • Delivery-date: Tue, 09 Jun 2026 00:09:27 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Currently alloc_stub_page() returns the virtual address of the mapped
stubs page, and the caller adds the per-CPU offset.  Make
alloc_stub_page() return the final address.  This is in preparation for
changing the stubs allocation where the offset will not be tied to the
CPU number.

The call to alloc_stub_page() in setup.c:start_xen() did not add the
offset as it is assumed to run on CPU0.

Change the local variable stub_page to stub_va to reflect the value.

Signed-off-by: Jason Andryuk <jason.andryuk@xxxxxxx>
---
 xen/arch/x86/smpboot.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c
index ff05955bae..d7619f534b 100644
--- a/xen/arch/x86/smpboot.c
+++ b/xen/arch/x86/smpboot.c
@@ -675,7 +675,7 @@ unsigned long alloc_stub_page(unsigned int cpu, unsigned 
long *mfn)
     else if ( !*mfn )
         *mfn = mfn_x(page_to_mfn(pg));
 
-    return stub_va;
+    return stub_va ? stub_va + STUB_BUF_CPU_OFFS(cpu) : 0;
 }
 
 void cpu_exit_clear(unsigned int cpu)
@@ -1044,7 +1044,7 @@ static int cpu_smpboot_alloc(unsigned int cpu)
     unsigned int i, memflags = 0;
     nodeid_t node = cpu_to_node(cpu);
     seg_desc_t *gdt;
-    unsigned long stub_page;
+    unsigned long stub_va;
     int rc = -ENOMEM;
 
     if ( node != NUMA_NO_NODE )
@@ -1099,10 +1099,10 @@ static int cpu_smpboot_alloc(unsigned int cpu)
             break;
         }
     BUG_ON(i == cpu);
-    stub_page = alloc_stub_page(cpu, &per_cpu(stubs.mfn, cpu));
-    if ( !stub_page )
+    stub_va = alloc_stub_page(cpu, &per_cpu(stubs.mfn, cpu));
+    if ( !stub_va )
         goto out;
-    per_cpu(stubs.addr, cpu) = stub_page + STUB_BUF_CPU_OFFS(cpu);
+    per_cpu(stubs.addr, cpu) = stub_va;
 
     rc = setup_cpu_root_pgt(cpu);
     if ( rc )
-- 
2.54.0




 


Rackspace

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