]> xenbits.xensource.com Git - pvdrivers/win/xenbus.git/commitdiff
Register memory for struct vcpu_info
authorPaul Durrant <pdurrant@amazon.com>
Fri, 27 Nov 2020 09:47:53 +0000 (09:47 +0000)
committerPaul Durrant <pdurrant@amazon.com>
Thu, 3 Dec 2020 08:14:22 +0000 (08:14 +0000)
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.

A new VM is created to resume a suspended image loaded from storage or
migrated in, so a call to the new SystemProcessorRegisterVcpuInfo() is also
added into the 'sync' early callback for each vCPU. This invocation specifies
a 'force' flag, since the state of the VM's memory will show that the
vcpu_info has already been registered.

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@amazon.com>
include/xen.h
src/xen/system.c
src/xenbus/evtchn.c
src/xenbus/evtchn_2l.c
src/xenbus/evtchn_fifo.c
src/xenbus/fdo.c
src/xenbus/shared_info.c
src/xenbus/suspend.c
vs2015/xen/xen.vcxproj
vs2017/xen/xen.vcxproj
vs2019/xen/xen.vcxproj

index 8fb55c753c5565eb733824a9ae9c310e825086df..fd3bb3ebb4b871b52be3459d96fe093569b4cf9a 100644 (file)
@@ -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
+    );
+
+XEN_API
+NTSTATUS
+SystemProcessorRegisterVcpuInfo(
+    IN  ULONG   Cpu,
+    IN  BOOLEAN Force
+    );
+
 XEN_API
 PHYSICAL_ADDRESS
 SystemMaximumPhysicalAddress(
index 7bd7cb381f38baf0248f25f97098289dbcd9326b..14de3a2de015b1ae9f1d8ed0e514774b8b77090f 100644 (file)
@@ -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(
index 662ca038fc3184c1d4225da37d47d0b7ee4a9b68..55c16b73212a837f267de4c2d103373ccd3e8543 100644 (file)
@@ -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);
index a869e150df290da9d9376b7c7ca30aab34dbd81d..99a37798932b918a25dea5227184e1d6f50c3fc3 100644 (file)
@@ -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
index c08e664041c6258eb7b55a28fc643087e7b6e615..475f99de10d715509e85bd0d3f8ffaf63719ac94 100644 (file)
@@ -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;
index 9db968de02475c8efebec16885ed097e824584cc..9944ef6d5c0e72c60c7be030d128959eda7c51a3 100644 (file)
@@ -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);
index 473088c18c932b7cbe15cccc9ff769e87116c7d6..9c9f0b4cf3e378d44f306b82fb5eeaa5366bb268 100644 (file)
@@ -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;
+    UCHAR           Pending;
+    NTSTATUS        status;
 
-    status = SystemVirtualCpuIndex(Index, &vcpu_id);
+    UNREFERENCED_PARAMETER(Interface);
+
+    status = SystemProcessorVcpuInfo(Index, &Vcpu);
     if (!NT_SUCCESS(status))
         return FALSE;
 
     KeMemoryBarrier();
 
-    Pending = _InterlockedExchange8((CHAR *)&Shared->vcpu_info[vcpu_id].evtchn_upcall_pending, 0);
+    Pending = _InterlockedExchange8((CHAR *)&Vcpu->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;
     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);
     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->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;
     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);
+    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->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->time.system_time;
 
         // Timestamp counter value when these time values were last updated
-        Timestamp = Shared->vcpu_info[0].time.tsc_timestamp;
+        Timestamp = Vcpu->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->time.tsc_shift;
+        TscSystemMul = Vcpu->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->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;
             NTSTATUS            status;
 
-            status = SystemVirtualCpuIndex(Index, &vcpu_id);
+            status = SystemProcessorVcpuInfo(Index, &Vcpu);
             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->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->evtchn_pending_sel);
         }
 
         for (Selector = 0; Selector < XENBUS_SHARED_INFO_EVTCHN_SELECTOR_COUNT; Selector += 4) {
index 77752b00d4904a10180fccae1150722364d8a427..f058a4f1edfcc1c5e69545b1b615ea243f8b21f6 100644 (file)
@@ -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();
index 65be5010f45115a633f20e407ece0cd61d7a9829..3280f4b39e95e888efe449969937d17c5775810f 100644 (file)
@@ -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>
index 9fec76255ca32c3681ebf383151fa3b42d0d26e8..7f4dce94498822d3a2909a0ed399225a67d9503a 100644 (file)
@@ -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>
index 56de3d25b6ea89fdd56a90c29b41dcab23060fe8..39b5bda87eb6c4c7588f275f252b46e06fb24e59 100644 (file)
@@ -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>