]> xenbits.xensource.com Git - pvdrivers/win/xenbus.git/commitdiff
Tolerate any failure of __FdoVirqCreate() in the VIRQ_TIMER case
authorPaul Durrant <pdurrant@amazon.com>
Wed, 25 Nov 2020 18:58:58 +0000 (18:58 +0000)
committerPaul Durrant <pdurrant@amazon.com>
Fri, 27 Nov 2020 07:53:50 +0000 (07:53 +0000)
In pratice __FdoVirqCreate() won't return STATUS_NOT_SUPPORTED since the
XENBUS_EVTCHN(Open, ...) doesn't return a status code and ERRNO_TO_STATUS()
(inside VcpuSetPeriodicTimer()) doesn't translate any Xen errno to that
status code, therefore the check in FdoVirqInitialize() is actually bogus.

This patch simply tolerates any status code returned by __FdoVirqCreate()
when creating a VIRQ_TIMER and then gates enabling the watchdog on there
being at least one VIRQ_TIMER successfully created.

Signed-off-by: Paul Durrant <pdurrant@amazon.com>
src/xenbus/fdo.c

index 18f936baae382edec211ed7e05bf3e321a566461..9db968de02475c8efebec16885ed097e824584cc 100644 (file)
@@ -2978,6 +2978,7 @@ FdoVirqInitialize(
     PXENBUS_VIRQ    Virq;
     ULONG           Count;
     ULONG           Index;
+    ULONG           Timer;
     NTSTATUS        status;
 
     InitializeListHead(&Fdo->VirqList);
@@ -2994,28 +2995,25 @@ FdoVirqInitialize(
 
     Count = KeQueryActiveProcessorCountEx(ALL_PROCESSOR_GROUPS);
 
+    Timer = 0;
     for (Index = 0; Index < Count; Index++) {
         status = __FdoVirqCreate(Fdo, VIRQ_TIMER, Index, &Virq);
-        if (!NT_SUCCESS(status)) {
-            if (status != STATUS_NOT_SUPPORTED )
-                continue;
-
-            goto fail2;
-        }
+        if (!NT_SUCCESS(status))
+            continue;
 
         InsertTailList(&Fdo->VirqList, &Virq->ListEntry);
+        Timer++;
     }
 
-    status = SystemSetWatchdog(Fdo->Watchdog);
-    if (!NT_SUCCESS(status))
-        goto fail3;
+    if (Timer != 0) {
+        status = SystemSetWatchdog(Fdo->Watchdog);
+        if (!NT_SUCCESS(status))
+            goto fail2;
+    }
 
 done:
     return STATUS_SUCCESS;
 
-fail3:
-    Error("fail3\n");
-
 fail2:
     Error("fail2\n");