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

[PATCH xenbus] Avoid ASSERTion failure on migrate/resume



From: Paul Durrant <pdurrant@xxxxxxxxxx>

After commit ed57f5f6367f ("Make vcpu_info registration conditional on number
of vCPUs") it is no longer certain that SystemProcessorRegisterVcpuInfo()
will be called during boot and indeed it was modified to ASSERT that the
'RegisterVcpuInfo' flag in SYSTEM_CONTEXT is TRUE. Unfortunately this means
that the (now erroneously) unconditional call to
SystemProcessorRegisterVcpuInfo() in SuspendEarly() may fail the ASSERTion.

This patch fixes the problem by allowing SystemProcessorRegisterVcpuInfo() to
be called unconditionally and simply having it exit early if the
'RegisterVcpuInfo' flag is not set. SystemProcessorDeregisterVcpuInfo() is
also similarly modified for consistency.

Signed-off-by: Paul Durrant <pdurrant@xxxxxxxxxx>
---
 src/xen/system.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/src/xen/system.c b/src/xen/system.c
index f664635119fe..ffa41a749282 100644
--- a/src/xen/system.c
+++ b/src/xen/system.c
@@ -695,7 +695,8 @@ SystemProcessorRegisterVcpuInfo(
     PUCHAR              MdlMappedSystemVa;
     NTSTATUS            status;
 
-    ASSERT(Context->RegisterVcpuInfo);
+    if (!Context->RegisterVcpuInfo)
+        goto done;
 
     status = STATUS_UNSUCCESSFUL;
     if (Cpu >= Context->ProcessorCount)
@@ -742,6 +743,7 @@ SystemProcessorRegisterVcpuInfo(
               Address.HighPart,
               Address.LowPart);
 
+done:
     return STATUS_SUCCESS;
 
 fail2:
@@ -764,7 +766,8 @@ SystemProcessorDeregisterVcpuInfo(
     PSYSTEM_CONTEXT     Context = &SystemContext;
     PSYSTEM_PROCESSOR   Processor = &Context->Processor[Cpu];
 
-    ASSERT(Context->RegisterVcpuInfo);
+    if (!Context->RegisterVcpuInfo)
+        return;
 
     Processor->Vcpu = NULL;
     Processor->Registered = NULL;
@@ -805,11 +808,9 @@ SystemProcessorDpc(
 
     SystemProcessorInitialize(Cpu);
 
-    if (Context->RegisterVcpuInfo) {
-        status = SystemProcessorRegisterVcpuInfo(Cpu, FALSE);
-        if (!NT_SUCCESS(status))
-            goto fail1;
-    }
+    status = SystemProcessorRegisterVcpuInfo(Cpu, FALSE);
+    if (!NT_SUCCESS(status))
+        goto fail1;
 
     Info("<==== (%u:%u)\n", ProcNumber.Group, ProcNumber.Number);
 
@@ -990,9 +991,7 @@ SystemDeregisterProcessorChangeCallback(
     for (Cpu = 0; Cpu < Context->ProcessorCount; Cpu++) {
         PSYSTEM_PROCESSOR   Processor = &Context->Processor[Cpu];
 
-        if (Context->RegisterVcpuInfo)
-            SystemProcessorDeregisterVcpuInfo(Cpu);
-
+        SystemProcessorDeregisterVcpuInfo(Cpu);
         SystemProcessorTeardown(Cpu);
 
         RtlZeroMemory(&Processor->Dpc, sizeof (KDPC));
-- 
2.17.1




 


Rackspace

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