Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Sep 2018 07:08:31 +0000 (UTC)
From:      =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= <royger@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r338626 - head/sys/x86/xen
Message-ID:  <201809130708.w8D78WAP022863@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: royger
Date: Thu Sep 13 07:08:31 2018
New Revision: 338626
URL: https://svnweb.freebsd.org/changeset/base/338626

Log:
   xen: remove xenpv_set_ids
  
  The vcpu_id for legacy PVH mode can be set from the output of cpuid,
  so there's no need to have a special function to set it.
  
  Also note that xenpv_set_ids should have been executed only for PV
  guests, but was executed for all guests types and vcpu_id was later
  fixed up for HVM guests.
  
  Reported by:		cperciva
  Approved by:		re (gjb)
  Sponsored by:		Citrix Systems R&D

Modified:
  head/sys/x86/xen/hvm.c
  head/sys/x86/xen/pvcpu_enum.c

Modified: head/sys/x86/xen/hvm.c
==============================================================================
--- head/sys/x86/xen/hvm.c	Thu Sep 13 07:07:13 2018	(r338625)
+++ head/sys/x86/xen/hvm.c	Thu Sep 13 07:08:31 2018	(r338626)
@@ -419,6 +419,9 @@ xen_hvm_cpu_init(void)
 	 */
 	KASSERT(cpuid_base != 0, ("Invalid base Xen CPUID leaf"));
 	cpuid_count(cpuid_base + 4, 0, regs);
+	KASSERT((regs[0] & XEN_HVM_CPUID_VCPU_ID_PRESENT) ||
+	    !xen_pv_domain(),
+	    ("Xen PV domain without vcpu_id in cpuid"));
 	PCPU_SET(vcpu_id, (regs[0] & XEN_HVM_CPUID_VCPU_ID_PRESENT) ?
 	    regs[1] : PCPU_GET(acpi_id));
 

Modified: head/sys/x86/xen/pvcpu_enum.c
==============================================================================
--- head/sys/x86/xen/pvcpu_enum.c	Thu Sep 13 07:07:13 2018	(r338625)
+++ head/sys/x86/xen/pvcpu_enum.c	Thu Sep 13 07:08:31 2018	(r338626)
@@ -249,19 +249,3 @@ xenpv_register(void *dummy __unused)
 	}
 }
 SYSINIT(xenpv_register, SI_SUB_TUNABLES - 1, SI_ORDER_FIRST, xenpv_register, NULL);
-
-/*
- * Setup per-CPU vCPU IDs
- */
-static void
-xenpv_set_ids(void *dummy)
-{
-	struct pcpu *pc;
-	int i;
-
-	CPU_FOREACH(i) {
-		pc = pcpu_find(i);
-		pc->pc_vcpu_id = i;
-	}
-}
-SYSINIT(xenpv_set_ids, SI_SUB_CPU, SI_ORDER_MIDDLE, xenpv_set_ids, NULL);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201809130708.w8D78WAP022863>