Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1433125

[PATCH linux 4/8] x86/xen: use xen_vcpu_id mapping when pointing vcpu_info to the shared_info page

From Vitaly Kuznetsov <vkuznets@redhat.com>
Newsgroups linux.kernel
Subject [PATCH linux 4/8] x86/xen: use xen_vcpu_id mapping when pointing vcpu_info to the shared_info page
Date 2016-06-28 19:00 +0200
Message-ID <rP4wG-18P-13@gated-at.bofh.it> (permalink)
References <rP4n0-157-17@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


shared_info page has space for 32 vcpu info slots for first 32 vCPUs but
these are the first 32 vCPUs from Xen's perspective and we should map them
accordingly with the newly introduced xen_vcpu_id mapping.

Signed-off-by: Vitaly Kuznetsov <vkuznets@redhat.com>
---
 arch/x86/xen/enlighten.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 69f4c0c..1596626 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -189,6 +189,7 @@ static void xen_vcpu_setup(int cpu)
 	struct vcpu_register_vcpu_info info;
 	int err;
 	struct vcpu_info *vcpup;
+	int xen_cpu = per_cpu(xen_vcpu_id, cpu);
 
 	BUG_ON(HYPERVISOR_shared_info == &xen_dummy_shared_info);
 
@@ -207,8 +208,9 @@ static void xen_vcpu_setup(int cpu)
 		if (per_cpu(xen_vcpu, cpu) == &per_cpu(xen_vcpu_info, cpu))
 			return;
 	}
-	if (cpu < MAX_VIRT_CPUS)
-		per_cpu(xen_vcpu,cpu) = &HYPERVISOR_shared_info->vcpu_info[cpu];
+	if (xen_cpu < MAX_VIRT_CPUS)
+		per_cpu(xen_vcpu, cpu) =
+			&HYPERVISOR_shared_info->vcpu_info[xen_cpu];
 
 	if (!have_vcpu_info_placement) {
 		if (cpu >= MAX_VIRT_CPUS)
@@ -1752,7 +1754,7 @@ asmlinkage __visible void __init xen_start_kernel(void)
 
 void __ref xen_hvm_init_shared_info(void)
 {
-	int cpu;
+	int cpu, xen_cpu;
 	struct xen_add_to_physmap xatp;
 	static struct shared_info *shared_info_page = 0;
 
@@ -1777,10 +1779,13 @@ void __ref xen_hvm_init_shared_info(void)
 	 * online but xen_hvm_init_shared_info is run at resume time too and
 	 * in that case multiple vcpus might be online. */
 	for_each_online_cpu(cpu) {
+		xen_cpu = per_cpu(xen_vcpu_id, cpu);
+
 		/* Leave it to be NULL. */
-		if (cpu >= MAX_VIRT_CPUS)
+		if (xen_cpu >= MAX_VIRT_CPUS)
 			continue;
-		per_cpu(xen_vcpu, cpu) = &HYPERVISOR_shared_info->vcpu_info[cpu];
+		per_cpu(xen_vcpu, cpu) =
+			&HYPERVISOR_shared_info->vcpu_info[xen_cpu];
 	}
 }
 
-- 
2.5.5

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH linux 0/8] xen: pvhvm: support bootup on secondary vCPUs Vitaly Kuznetsov <vkuznets@redhat.com> - 2016-06-28 18:50 +0200
  [PATCH linux 5/8] xen/events: use xen_vcpu_id mapping in events_base Vitaly Kuznetsov <vkuznets@redhat.com> - 2016-06-28 19:00 +0200
  [PATCH linux 7/8] xen/evtchn: use xen_vcpu_id mapping Vitaly Kuznetsov <vkuznets@redhat.com> - 2016-06-28 19:00 +0200
  [PATCH linux 4/8] x86/xen: use xen_vcpu_id mapping when pointing vcpu_info to the shared_info page Vitaly Kuznetsov <vkuznets@redhat.com> - 2016-06-28 19:00 +0200
    Re: [Xen-devel] [PATCH linux 4/8] x86/xen: use xen_vcpu_id mapping  when pointing vcpu_info to the shared_info page David Vrabel <david.vrabel@citrix.com> - 2016-06-29 14:40 +0200
  [PATCH linux 8/8] xen/pvhvm: run xen_vcpu_setup() for the boot CPU Vitaly Kuznetsov <vkuznets@redhat.com> - 2016-06-28 19:00 +0200
  [PATCH linux 6/8] xen/events: fifo: use xen_vcpu_id mapping Vitaly Kuznetsov <vkuznets@redhat.com> - 2016-06-28 19:00 +0200
  Re: [PATCH linux 0/8] xen: pvhvm: support bootup on secondary vCPUs David Vrabel <david.vrabel@citrix.com> - 2016-06-28 19:40 +0200
    Re: [PATCH linux 0/8] xen: pvhvm: support bootup on secondary vCPUs Vitaly Kuznetsov <vkuznets@redhat.com> - 2016-06-29 11:20 +0200
      Re: [PATCH linux 0/8] xen: pvhvm: support bootup on secondary vCPUs David Vrabel <david.vrabel@citrix.com> - 2016-06-29 14:40 +0200
        Re: [PATCH linux 0/8] xen: pvhvm: support bootup on secondary vCPUs Vitaly Kuznetsov <vkuznets@redhat.com> - 2016-07-01 11:50 +0200

csiph-web