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

[PATCH xenbus 7/7] Register memory for struct vcpu_info



From: Paul Durrant <pdurrant@xxxxxxxxxx>

This must only be done once for each vCPU in the lifetime of the VM. The
PFNs of the allocated memory are therefore saved in the registry such that
they can be recovered if XEN.SYS is unloaded and re-loaded.

References to the legacy vcpu_info structures embedded in the shared_info are
replaced and the limit of XEN_LEGACY_MAX_VCPUS is removed from the 2-level
event channel implementation.

NOTE: SystemVirtualCpuIndex() is also renamed to SystemProcessorVcpuId()
      for consistency, and it is co-located with the new
      SystemProcessorVcpuInfo() function.
      It is also necessary to disable warning C4146 (unary minus operator
      applied to unsigned type) in xen.vcxproj as this is done by the
      P2ROUNDUP() macro.

Signed-off-by: Paul Durrant <pdurrant@xxxxxxxxxx>
---
 include/xen.h            |  16 ++-
 src/xen/system.c         | 224 +++++++++++++++++++++++++++++++++++----
 src/xenbus/evtchn.c      |   8 +-
 src/xenbus/evtchn_2l.c   |   7 +-
 src/xenbus/evtchn_fifo.c |   8 +-
 src/xenbus/fdo.c         |   4 +-
 src/xenbus/shared_info.c |  52 +++++----
 src/xenbus/suspend.c     |   7 +-
 vs2015/xen/xen.vcxproj   |   2 +-
 vs2017/xen/xen.vcxproj   |   2 +-
 vs2019/xen/xen.vcxproj   |   2 +-
 11 files changed, 268 insertions(+), 64 deletions(-)

diff --git a/include/xen.h b/include/xen.h
index 8fb55c753c55..674c285fe9f0 100644
--- a/include/xen.h
+++ b/include/xen.h
@@ -456,11 +456,25 @@ SystemProcessorCount(
 
 XEN_API
 NTSTATUS
-SystemVirtualCpuIndex(
+SystemProcessorVcpuId(
     IN  ULONG           Cpu,
     OUT unsigned int    *vcpu_id
     );
 
+XEN_API
+NTSTATUS
+SystemProcessorVcpuInfo(
+    IN  ULONG       Cpu,
+    OUT vcpu_info_t **vcpu_info
+    );
+
+XEN_API
+NTSTATUS
+SystemProcessorRegisterVcpuInfo(
+    IN  ULONG   Cpu,
+    IN  BOOLEAN Force
+    );
+
 XEN_API
 PHYSICAL_ADDRESS
 SystemMaximumPhysicalAddress(
diff --git a/src/xen/system.c b/src/xen/system.c
index 7bd7cb381f38..14de3a2de015 100644
--- a/src/xen/system.c
+++ b/src/xen/system.c
@@ -45,6 +45,7 @@
 #include "dbg_print.h"
 #include "assert.h"
 #include "util.h"
+#include "driver.h"
 
 #define XEN_SYSTEM_TAG  'TSYS'
 
@@ -55,6 +56,8 @@ typedef struct _SYSTEM_PROCESSOR {
     UCHAR       ProcessorID;
     NTSTATUS    Status;
     KEVENT      Event;
+    vcpu_info_t *Vcpu;
+    PBOOLEAN    Registered;
 } SYSTEM_PROCESSOR, *PSYSTEM_PROCESSOR;
 
 typedef struct _SYSTEM_WATCHDOG {
@@ -72,6 +75,7 @@ typedef struct _SYSTEM_CONTEXT {
     PHYSICAL_ADDRESS    MaximumPhysicalAddress;
     BOOLEAN             RealTimeIsUniversal;
     SYSTEM_WATCHDOG     Watchdog;
+    PMDL                Mdl;
 } SYSTEM_CONTEXT, *PSYSTEM_CONTEXT;
 
 static SYSTEM_CONTEXT   SystemContext;
@@ -635,6 +639,139 @@ __SystemProcessorCount(
     return Context->ProcessorCount;
 }
 
+XEN_API
+NTSTATUS
+SystemProcessorVcpuId(
+    IN  ULONG           Cpu,
+    OUT unsigned int    *vcpu_id
+    )
+{
+    PSYSTEM_CONTEXT     Context = &SystemContext;
+    PSYSTEM_PROCESSOR   Processor = &Context->Processor[Cpu];
+    NTSTATUS            status;
+
+    status = STATUS_UNSUCCESSFUL;
+    if (Cpu >= __SystemProcessorCount())
+        goto fail1;
+
+    *vcpu_id = Processor->ProcessorID;
+    return STATUS_SUCCESS;
+
+fail1:
+    return status;
+}
+
+XEN_API
+NTSTATUS
+SystemProcessorVcpuInfo(
+    IN  ULONG           Cpu,
+    OUT vcpu_info_t     **Vcpu
+    )
+{
+    PSYSTEM_CONTEXT     Context = &SystemContext;
+    PSYSTEM_PROCESSOR   Processor = &Context->Processor[Cpu];
+    NTSTATUS            status;
+
+    status = STATUS_UNSUCCESSFUL;
+    if (Cpu >= __SystemProcessorCount())
+        goto fail1;
+
+    ASSERT(*Processor->Registered);
+    *Vcpu = Processor->Vcpu;
+
+    return STATUS_SUCCESS;
+
+fail1:
+    return status;
+}
+
+XEN_API
+NTSTATUS
+SystemProcessorRegisterVcpuInfo(
+    IN  ULONG           Cpu,
+    IN  BOOLEAN         Force
+    )
+{
+    PSYSTEM_CONTEXT     Context = &SystemContext;
+    PSYSTEM_PROCESSOR   Processor = &Context->Processor[Cpu];
+    PMDL                Mdl = Context->Mdl;
+    ULONG               Offset;
+    PFN_NUMBER          Pfn;
+    PHYSICAL_ADDRESS    Address;
+    PUCHAR              MdlMappedSystemVa;
+    NTSTATUS            status;
+
+    status = STATUS_UNSUCCESSFUL;
+    if (Cpu >= __SystemProcessorCount())
+        goto fail1;
+
+    ASSERT(Mdl->MdlFlags & MDL_MAPPED_TO_SYSTEM_VA);
+    MdlMappedSystemVa = Mdl->MappedSystemVa;
+
+    Offset = sizeof (vcpu_info_t) * HVM_MAX_VCPUS;
+    Offset += sizeof (BOOLEAN) * Cpu;
+
+    Processor->Registered = (PBOOLEAN)(MdlMappedSystemVa + Offset);
+
+    Offset = sizeof (vcpu_info_t) * Cpu;
+
+    Processor->Vcpu = (vcpu_info_t *)(MdlMappedSystemVa + Offset);
+
+    Pfn = MmGetMdlPfnArray(Context->Mdl)[Offset >> PAGE_SHIFT];
+    Offset = Offset & (PAGE_SIZE - 1);
+
+    if (!*Processor->Registered || Force) {
+        unsigned int    vcpu_id;
+
+        status = SystemProcessorVcpuId(Cpu, &vcpu_id);
+        ASSERT(NT_SUCCESS(status));
+
+        status = VcpuRegisterVcpuInfo(vcpu_id, Pfn, Offset);
+        if (!NT_SUCCESS(status))
+            goto fail2;
+
+        LogPrintf(LOG_LEVEL_INFO,
+                  "XEN: REGISTER vcpu_info[%u]\n",
+                  Cpu);
+
+        *Processor->Registered = TRUE;
+    }
+
+    Address.QuadPart = (ULONGLONG)Pfn << PAGE_SHIFT;
+    Address.QuadPart += Offset;
+
+    LogPrintf(LOG_LEVEL_INFO,
+              "XEN: vcpu_info[%u] @ %08x.%08x\n",
+              Cpu,
+              Address.HighPart,
+              Address.LowPart);
+
+    return STATUS_SUCCESS;
+
+fail2:
+    Error("fail2\n");
+
+    Processor->Vcpu = NULL;
+    Processor->Registered = NULL;
+
+fail1:
+    Error("fail1 (%08x)\n", status);
+
+    return status;
+}
+
+static VOID
+SystemProcessorDeregisterVcpuInfo(
+    IN  ULONG           Cpu
+    )
+{
+    PSYSTEM_CONTEXT     Context = &SystemContext;
+    PSYSTEM_PROCESSOR   Processor = &Context->Processor[Cpu];
+
+    Processor->Vcpu = NULL;
+    Processor->Registered = NULL;
+}
+
 static
 _Function_class_(KDEFERRED_ROUTINE)
 _IRQL_requires_max_(DISPATCH_LEVEL)
@@ -653,6 +790,7 @@ SystemProcessorDpc(
     ULONG               Cpu;
     PROCESSOR_NUMBER    ProcNumber;
     PSYSTEM_PROCESSOR   Processor;
+    NTSTATUS            status;
 
     UNREFERENCED_PARAMETER(Dpc);
     UNREFERENCED_PARAMETER(_Context);
@@ -669,10 +807,22 @@ SystemProcessorDpc(
 
     SystemProcessorInitialize(Cpu);
 
+    status = SystemProcessorRegisterVcpuInfo(Cpu, FALSE);
+    if (!NT_SUCCESS(status))
+        goto fail1;
+
     Info("<==== (%u:%u)\n", ProcNumber.Group, ProcNumber.Number);
 
     Processor->Status = STATUS_SUCCESS;
     KeSetEvent(&Processor->Event, IO_NO_INCREMENT, FALSE);
+
+    return;
+
+fail1:
+    Error("fail1 (%08x)\n", status);
+
+    Processor->Status = status;
+    KeSetEvent(&Processor->Event, IO_NO_INCREMENT, FALSE);
 }
 
 static
@@ -772,6 +922,44 @@ SystemProcessorChangeCallback(
           ProcessorChangeName(Change->State));
 }
 
+static NTSTATUS
+SystemAllocateVcpuInfo(
+    VOID
+    )
+{
+    PSYSTEM_CONTEXT Context = &SystemContext;
+    ULONG           Size;
+    NTSTATUS        status;
+
+    Size = sizeof (vcpu_info_t) * HVM_MAX_VCPUS;
+    Size += sizeof (BOOLEAN) * HVM_MAX_VCPUS;
+    Size = P2ROUNDUP(Size, PAGE_SIZE);
+
+    Context->Mdl = DriverGetNamedPages("VCPU_INFO", Size >> PAGE_SHIFT);
+
+    status = STATUS_NO_MEMORY;
+    if (Context->Mdl == NULL)
+        goto fail1;
+
+    return STATUS_SUCCESS;
+
+fail1:
+    Error("fail1 (%08x)\n", status);
+
+    return status;
+}
+
+static VOID
+SystemFreeVcpuInfo(
+    VOID
+    )
+{
+    PSYSTEM_CONTEXT Context = &SystemContext;
+
+    DriverPutNamedPages(Context->Mdl);
+    Context->Mdl = NULL;
+}
+
 static NTSTATUS
 SystemRegisterProcessorChangeCallback(
     VOID
@@ -781,18 +969,27 @@ SystemRegisterProcessorChangeCallback(
     PVOID           Handle;
     NTSTATUS        status;
 
+    status = SystemAllocateVcpuInfo();
+    if (!NT_SUCCESS(status))
+        goto fail1;
+
     Handle = KeRegisterProcessorChangeCallback(SystemProcessorChangeCallback,
                                                NULL,
                                                
KE_PROCESSOR_CHANGE_ADD_EXISTING);
 
     status = STATUS_UNSUCCESSFUL;
     if (Handle == NULL)
-        goto fail1;
+        goto fail2;
 
     Context->ProcessorChangeHandle = Handle;
 
     return STATUS_SUCCESS;
 
+fail2:
+    Error("fail2\n");
+
+    SystemFreeVcpuInfo();
+
 fail1:
     Error("fail1 (%08x)\n", status);
 
@@ -813,6 +1010,7 @@ SystemDeregisterProcessorChangeCallback(
     for (Cpu = 0; Cpu < __SystemProcessorCount(); Cpu++) {
         PSYSTEM_PROCESSOR   Processor = &Context->Processor[Cpu];
 
+        SystemProcessorDeregisterVcpuInfo(Cpu);
         SystemProcessorTeardown(Cpu);
 
         RtlZeroMemory(&Processor->Dpc, sizeof (KDPC));
@@ -825,6 +1023,8 @@ SystemDeregisterProcessorChangeCallback(
     __SystemFree(Context->Processor);
     Context->Processor = NULL;
     Context->ProcessorCount = 0;
+
+    SystemFreeVcpuInfo();
 }
 
 static NTSTATUS
@@ -1153,28 +1353,6 @@ SystemProcessorCount(
     return __SystemProcessorCount();
 }
 
-XEN_API
-NTSTATUS
-SystemVirtualCpuIndex(
-    IN  ULONG           Cpu,
-    OUT unsigned int    *vcpu_id
-    )
-{
-    PSYSTEM_CONTEXT     Context = &SystemContext;
-    PSYSTEM_PROCESSOR   Processor = &Context->Processor[Cpu];
-    NTSTATUS            status;
-
-    status = STATUS_UNSUCCESSFUL;
-    if (Cpu >= __SystemProcessorCount())
-        goto fail1;
-
-    *vcpu_id = Processor->ProcessorID;
-    return STATUS_SUCCESS;
-
-fail1:
-    return status;
-}
-
 XEN_API
 PHYSICAL_ADDRESS
 SystemMaximumPhysicalAddress(
diff --git a/src/xenbus/evtchn.c b/src/xenbus/evtchn.c
index 662ca038fc31..55c16b73212a 100644
--- a/src/xenbus/evtchn.c
+++ b/src/xenbus/evtchn.c
@@ -283,7 +283,7 @@ EvtchnOpenVirq(
     if (!Processor->UpcallEnabled && Cpu != 0)
         goto fail1;
 
-    status = SystemVirtualCpuIndex(Cpu, &vcpu_id);
+    status = SystemProcessorVcpuId(Cpu, &vcpu_id);
     ASSERT(NT_SUCCESS(status));
 
     status = EventChannelBindVirq(Index, vcpu_id, &LocalPort);
@@ -768,7 +768,7 @@ EvtchnBind(
 
     LocalPort = Channel->LocalPort;
 
-    status = SystemVirtualCpuIndex(Cpu, &vcpu_id);
+    status = SystemProcessorVcpuId(Cpu, &vcpu_id);
     ASSERT(NT_SUCCESS(status));
 
     status = EventChannelBindVirtualCpu(LocalPort, vcpu_id);
@@ -1290,7 +1290,7 @@ EvtchnInterruptEnable(
         if (Processor->Interrupt == NULL)
             continue;
 
-        status = SystemVirtualCpuIndex(Cpu, &vcpu_id);
+        status = SystemProcessorVcpuId(Cpu, &vcpu_id);
         ASSERT(NT_SUCCESS(status));
 
         Vector = FdoGetInterruptVector(Context->Fdo, Processor->Interrupt);
@@ -1349,7 +1349,7 @@ EvtchnInterruptDisable(
         if (!Processor->UpcallEnabled)
             continue;
 
-        status = SystemVirtualCpuIndex(Cpu, &vcpu_id);
+        status = SystemProcessorVcpuId(Cpu, &vcpu_id);
         ASSERT(NT_SUCCESS(status));
 
         (VOID) HvmSetEvtchnUpcallVector(vcpu_id, 0);
diff --git a/src/xenbus/evtchn_2l.c b/src/xenbus/evtchn_2l.c
index a869e150df29..99a37798932b 100644
--- a/src/xenbus/evtchn_2l.c
+++ b/src/xenbus/evtchn_2l.c
@@ -72,12 +72,9 @@ EvtchnTwoLevelIsProcessorEnabled(
     )
 {
     UNREFERENCED_PARAMETER(_Context);
+    UNREFERENCED_PARAMETER(Index);
 
-    //
-    // We currently rely on using the vcpu_info array that is embedded
-    // in the shared_info.
-    //
-    return (Index < XEN_LEGACY_MAX_VCPUS) ? TRUE : FALSE;
+    return TRUE;
 }
 
 static BOOLEAN
diff --git a/src/xenbus/evtchn_fifo.c b/src/xenbus/evtchn_fifo.c
index c08e664041c6..475f99de10d7 100644
--- a/src/xenbus/evtchn_fifo.c
+++ b/src/xenbus/evtchn_fifo.c
@@ -289,7 +289,7 @@ EvtchnFifoIsProcessorEnabled(
     unsigned int                    vcpu_id;
     NTSTATUS                        status;
     
-    status = SystemVirtualCpuIndex(Index, &vcpu_id);
+    status = SystemProcessorVcpuId(Index, &vcpu_id);
     if (!NT_SUCCESS(status))
         return FALSE;
 
@@ -364,7 +364,7 @@ EvtchnFifoPoll(
 
     DoneSomething = FALSE;
 
-    status = SystemVirtualCpuIndex(Index, &vcpu_id);
+    status = SystemProcessorVcpuId(Index, &vcpu_id);
     if (!NT_SUCCESS(status))
         goto done;
 
@@ -510,7 +510,7 @@ EvtchnFifoAcquire(
         if (Mdl == NULL)
             goto fail1;
 
-        status = SystemVirtualCpuIndex(Index, &vcpu_id);
+        status = SystemProcessorVcpuId(Index, &vcpu_id);
         ASSERT(NT_SUCCESS(status));
 
         Pfn = MmGetMdlPfnArray(Mdl)[0];
@@ -552,7 +552,7 @@ fail1:
     while (--Index >= 0) {
         unsigned int    vcpu_id;
 
-        (VOID) SystemVirtualCpuIndex(Index, &vcpu_id);
+        (VOID) SystemProcessorVcpuId(Index, &vcpu_id);
 
         Mdl = Context->ControlBlockMdl[vcpu_id];
         Context->ControlBlockMdl[vcpu_id] = NULL;
diff --git a/src/xenbus/fdo.c b/src/xenbus/fdo.c
index 9db968de0247..9944ef6d5c0e 100644
--- a/src/xenbus/fdo.c
+++ b/src/xenbus/fdo.c
@@ -2850,7 +2850,7 @@ __FdoVirqDestroy(
         unsigned int    vcpu_id;
         NTSTATUS        status;
 
-        status = SystemVirtualCpuIndex(Virq->Cpu, &vcpu_id);
+        status = SystemProcessorVcpuId(Virq->Cpu, &vcpu_id);
         ASSERT(NT_SUCCESS(status));
 
         (VOID) VcpuSetPeriodicTimer(vcpu_id, NULL);
@@ -2904,7 +2904,7 @@ __FdoVirqCreate(
     if (Type == VIRQ_TIMER) {
         LARGE_INTEGER   Period;
 
-        status = SystemVirtualCpuIndex(Cpu, &vcpu_id);
+        status = SystemProcessorVcpuId(Cpu, &vcpu_id);
         ASSERT(NT_SUCCESS(status));
 
         BUG_ON(Fdo->Watchdog == 0);
diff --git a/src/xenbus/shared_info.c b/src/xenbus/shared_info.c
index 473088c18c93..6aefb81cd284 100644
--- a/src/xenbus/shared_info.c
+++ b/src/xenbus/shared_info.c
@@ -155,23 +155,23 @@ SharedInfoEvtchnMaskAll(
 
 static BOOLEAN
 SharedInfoUpcallPending(
-    IN  PINTERFACE              Interface,
-    IN  ULONG                   Index
+    IN  PINTERFACE  Interface,
+    IN  ULONG       Index
     )
 {
-    PXENBUS_SHARED_INFO_CONTEXT Context = Interface->Context;
-    shared_info_t               *Shared = Context->Shared;
-    unsigned int                vcpu_id;
-    UCHAR                       Pending;
-    NTSTATUS                    status;
+    vcpu_info_t     *vcpu_info;
+    UCHAR           Pending;
+    NTSTATUS        status;
 
-    status = SystemVirtualCpuIndex(Index, &vcpu_id);
+    UNREFERENCED_PARAMETER(Interface);
+
+    status = SystemProcessorVcpuInfo(Index, &vcpu_info);
     if (!NT_SUCCESS(status))
         return FALSE;
 
     KeMemoryBarrier();
 
-    Pending = _InterlockedExchange8((CHAR 
*)&Shared->vcpu_info[vcpu_id].evtchn_upcall_pending, 0);
+    Pending = _InterlockedExchange8((CHAR *)&vcpu_info->evtchn_upcall_pending, 
0);
 
     return (Pending != 0) ? TRUE : FALSE;
 }
@@ -187,6 +187,7 @@ SharedInfoEvtchnPoll(
     PXENBUS_SHARED_INFO_CONTEXT     Context = Interface->Context;
     shared_info_t                   *Shared = Context->Shared;
     unsigned int                    vcpu_id;
+    vcpu_info_t                     *vcpu_info;
     ULONG                           Port;
     ULONG_PTR                       SelectorMask;
     BOOLEAN                         DoneSomething;
@@ -194,13 +195,17 @@ SharedInfoEvtchnPoll(
 
     DoneSomething = FALSE;
 
-    status = SystemVirtualCpuIndex(Index, &vcpu_id);
+    status = SystemProcessorVcpuId(Index, &vcpu_id);
+    if (!NT_SUCCESS(status))
+        goto done;
+
+    status = SystemProcessorVcpuInfo(Index, &vcpu_info);
     if (!NT_SUCCESS(status))
         goto done;
 
     KeMemoryBarrier();
 
-    SelectorMask = (ULONG_PTR)InterlockedExchangePointer((PVOID 
*)&Shared->vcpu_info[vcpu_id].evtchn_pending_sel, (PVOID)0);
+    SelectorMask = (ULONG_PTR)InterlockedExchangePointer((PVOID 
*)&vcpu_info->evtchn_pending_sel, (PVOID)0);
 
     KeMemoryBarrier();
 
@@ -320,6 +325,7 @@ SharedInfoGetTime(
 
     PXENBUS_SHARED_INFO_CONTEXT Context = Interface->Context;
     shared_info_t               *Shared;
+    vcpu_info_t                 *vcpu_info;
     ULONG                       WcVersion;
     ULONG                       TimeVersion;
     ULONGLONG                   Seconds;
@@ -331,16 +337,20 @@ SharedInfoGetTime(
     CHAR                        TscShift;
     TIME_FIELDS                 TimeFields;
     KIRQL                       Irql;
+    NTSTATUS                    status;
 
     // Make sure we don't suspend
     KeRaiseIrql(DISPATCH_LEVEL, &Irql);
 
     Shared = Context->Shared;
 
+    status = SystemProcessorVcpuInfo(0, &vcpu_info);
+    ASSERT(NT_SUCCESS(status));
+
     // Loop until we can read a consistent set of values from the same update
     do {
         WcVersion = Shared->wc_version;
-        TimeVersion = Shared->vcpu_info[0].time.version;
+        TimeVersion = vcpu_info->time.version;
         KeMemoryBarrier();
 
         // Wallclock time at system time zero (guest boot or resume)
@@ -348,21 +358,21 @@ SharedInfoGetTime(
         NanoSeconds = Shared->wc_nsec;
 
         // Cached time in nanoseconds since guest boot
-        SystemTime = Shared->vcpu_info[0].time.system_time;
+        SystemTime = vcpu_info->time.system_time;
 
         // Timestamp counter value when these time values were last updated
-        Timestamp = Shared->vcpu_info[0].time.tsc_timestamp;
+        Timestamp = vcpu_info->time.tsc_timestamp;
 
         // Timestamp modifiers
-        TscShift = Shared->vcpu_info[0].time.tsc_shift;
-        TscSystemMul = Shared->vcpu_info[0].time.tsc_to_system_mul;
+        TscShift = vcpu_info->time.tsc_shift;
+        TscSystemMul = vcpu_info->time.tsc_to_system_mul;
         KeMemoryBarrier();
 
     // Version is incremented to indicate update in progress.
     // LSB of version is set if update in progress.
     // Version is incremented again once update has completed.
     } while (Shared->wc_version != WcVersion ||
-             Shared->vcpu_info[0].time.version != TimeVersion ||
+             vcpu_info->time.version != TimeVersion ||
              (WcVersion & 1) ||
              (TimeVersion & 1));
 
@@ -491,10 +501,10 @@ SharedInfoDebugCallback(
              Index < KeQueryActiveProcessorCountEx(ALL_PROCESSOR_GROUPS);
              Index++) {
             PROCESSOR_NUMBER    ProcNumber;
-            unsigned int        vcpu_id;
+            vcpu_info_t         *vcpu_info;
             NTSTATUS            status;
 
-            status = SystemVirtualCpuIndex(Index, &vcpu_id);
+            status = SystemProcessorVcpuInfo(Index, &vcpu_info);
             if (!NT_SUCCESS(status))
                 continue;
 
@@ -506,7 +516,7 @@ SharedInfoDebugCallback(
                          "CPU %u:%u: PENDING: %s\n",
                          ProcNumber.Group,
                          ProcNumber.Number,
-                         Shared->vcpu_info[vcpu_id].evtchn_upcall_pending ?
+                         vcpu_info->evtchn_upcall_pending ?
                          "TRUE" :
                          "FALSE");
 
@@ -515,7 +525,7 @@ SharedInfoDebugCallback(
                          "CPU %u:%u: SELECTOR MASK: %p\n",
                          ProcNumber.Group,
                          ProcNumber.Number,
-                         (PVOID)Shared->vcpu_info[vcpu_id].evtchn_pending_sel);
+                         (PVOID)vcpu_info->evtchn_pending_sel);
         }
 
         for (Selector = 0; Selector < 
XENBUS_SHARED_INFO_EVTCHN_SELECTOR_COUNT; Selector += 4) {
diff --git a/src/xenbus/suspend.c b/src/xenbus/suspend.c
index 77752b00d490..f058a4f1edfc 100644
--- a/src/xenbus/suspend.c
+++ b/src/xenbus/suspend.c
@@ -193,7 +193,7 @@ SuspendEarly(
     LogPrintf(LOG_LEVEL_INFO,
               "SUSPEND: EARLY (%u)\n", Cpu);
 
-    if (!Context->Success || Cpu != 0)
+    if (!Context->Success)
         return;
 
     //
@@ -203,6 +203,11 @@ SuspendEarly(
 
     Context->Count++;
 
+    SystemProcessorRegisterVcpuInfo(Cpu, TRUE);
+
+    if (Cpu != 0)
+        return;
+
     HypercallPopulate();
 
     UnplugDevices();
diff --git a/vs2015/xen/xen.vcxproj b/vs2015/xen/xen.vcxproj
index 65be5010f451..3280f4b39e95 100644
--- a/vs2015/xen/xen.vcxproj
+++ b/vs2015/xen/xen.vcxproj
@@ -23,7 +23,7 @@
       
<AdditionalIncludeDirectories>$(WindowsSdkDir)\include\km;..\..\include;..\..\include\xen;..\..\src\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       
<PreprocessorDefinitions>PROJECT=$(ProjectName);POOL_NX_OPTIN=1;NT_PROCESSOR_GROUPS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <WarningLevel>EnableAllWarnings</WarningLevel>
-      
<DisableSpecificWarnings>4464;4711;4548;4820;4668;4255;6001;6054;28196;30030;30029;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+      
<DisableSpecificWarnings>4146;4464;4711;4548;4820;4668;4255;6001;6054;28196;30030;30029;%(DisableSpecificWarnings)</DisableSpecificWarnings>
       <MultiProcessorCompilation>true</MultiProcessorCompilation>
       <EnablePREfast>true</EnablePREfast>
     </ClCompile>
diff --git a/vs2017/xen/xen.vcxproj b/vs2017/xen/xen.vcxproj
index 9fec76255ca3..7f4dce944988 100644
--- a/vs2017/xen/xen.vcxproj
+++ b/vs2017/xen/xen.vcxproj
@@ -24,7 +24,7 @@
       
<PreprocessorDefinitions>PROJECT=$(ProjectName);POOL_NX_OPTIN=1;NT_PROCESSOR_GROUPS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <WarningLevel>EnableAllWarnings</WarningLevel>
-      
<DisableSpecificWarnings>4464;4711;4770;4548;4820;4668;4255;5045;6001;6054;28196;30030;30029;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+      
<DisableSpecificWarnings>4146;4464;4711;4770;4548;4820;4668;4255;5045;6001;6054;28196;30030;30029;%(DisableSpecificWarnings)</DisableSpecificWarnings>
       <MultiProcessorCompilation>true</MultiProcessorCompilation>
       <EnablePREfast>true</EnablePREfast>
     </ClCompile>
diff --git a/vs2019/xen/xen.vcxproj b/vs2019/xen/xen.vcxproj
index 56de3d25b6ea..39b5bda87eb6 100644
--- a/vs2019/xen/xen.vcxproj
+++ b/vs2019/xen/xen.vcxproj
@@ -24,7 +24,7 @@
       
<PreprocessorDefinitions>PROJECT=$(ProjectName);POOL_NX_OPTIN=1;NT_PROCESSOR_GROUPS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <WarningLevel>EnableAllWarnings</WarningLevel>
-      
<DisableSpecificWarnings>4464;4711;4770;4548;4820;4668;4255;5045;6001;6054;26451;28196;30030;30029;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+      
<DisableSpecificWarnings>4146;4464;4711;4770;4548;4820;4668;4255;5045;6001;6054;26451;28196;30030;30029;%(DisableSpecificWarnings)</DisableSpecificWarnings>
       <MultiProcessorCompilation>true</MultiProcessorCompilation>
       <EnablePREfast>true</EnablePREfast>
     </ClCompile>
-- 
2.17.1




 


Rackspace

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