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

[PATCH xenbus 08/12] Add XENBUS_DEBUG callback into fdo.c to dump VIRQ information



From: Paul Durrant <pdurrant@xxxxxxxxxx>

The callback iterates the list of open VIRQ channels and dumps information
about each. This is currently limited to its vCPU binding, and to enable
this information to be dumped it is necessary to save that information in the
XENBUS_VIRQ structure.

Signed-off-by: Paul Durrant <pdurrant@xxxxxxxxxx>
---
 src/xenbus/fdo.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 64 insertions(+)

diff --git a/src/xenbus/fdo.c b/src/xenbus/fdo.c
index 852f2b85c7ee..831ff463d6ce 100644
--- a/src/xenbus/fdo.c
+++ b/src/xenbus/fdo.c
@@ -85,6 +85,7 @@ typedef struct _XENBUS_VIRQ {
     LIST_ENTRY              ListEntry;
     ULONG                   Type;
     PXENBUS_EVTCHN_CHANNEL  Channel;
+    ULONG                   Cpu;
 } XENBUS_VIRQ, *PXENBUS_VIRQ;
 
 struct _XENBUS_FDO {
@@ -151,6 +152,7 @@ struct _XENBUS_FDO {
     LIST_ENTRY                      InterruptList;
 
     LIST_ENTRY                      VirqList;
+    PXENBUS_DEBUG_CALLBACK          DebugCallback;
     PXENBUS_SUSPEND_CALLBACK        SuspendCallbackLate;
     PLOG_DISPOSITION                LogDisposition;
 };
@@ -2812,6 +2814,7 @@ __FdoVirqCreate(
 
     (*Virq)->Fdo = Fdo;
     (*Virq)->Type = Type;
+    (*Virq)->Cpu = Cpu;
 
     status = KeGetProcessorNumberFromIndex(Cpu, &ProcNumber);
     ASSERT(NT_SUCCESS(status));
@@ -3244,6 +3247,45 @@ done:
     Fdo->RangeSet = NULL;
 }
 
+static VOID
+FdoDebugCallback(
+    IN  PVOID   Argument,
+    IN  BOOLEAN Crashing
+    )
+{
+    PXENBUS_FDO Fdo = Argument;
+
+    UNREFERENCED_PARAMETER(Crashing);
+
+    if (!IsListEmpty(&Fdo->VirqList)) {
+        PLIST_ENTRY ListEntry;
+
+        XENBUS_DEBUG(Printf,
+                     &Fdo->DebugInterface,
+                     "VIRQS:\n");
+
+        for (ListEntry = Fdo->VirqList.Flink;
+             ListEntry != &Fdo->VirqList;
+             ListEntry = ListEntry->Flink) {
+            PXENBUS_VIRQ        Virq;
+            PROCESSOR_NUMBER    ProcNumber;
+            NTSTATUS            status;
+
+            Virq = CONTAINING_RECORD(ListEntry, XENBUS_VIRQ, ListEntry);
+
+            status = KeGetProcessorNumberFromIndex(Virq->Cpu, &ProcNumber);
+            ASSERT(NT_SUCCESS(status));
+
+            XENBUS_DEBUG(Printf,
+                         &Fdo->DebugInterface,
+                         "- %s: (%u:%u)\n",
+                         VirqName(Virq->Type),
+                         ProcNumber.Group,
+                         ProcNumber.Number);
+        }
+    }
+}
+
 // This function must not touch pageable code or data
 static NTSTATUS
 FdoD3ToD0(
@@ -3313,6 +3355,15 @@ FdoD3ToD0(
     if (!NT_SUCCESS(status))
         goto fail10;
 
+    status = XENBUS_DEBUG(Register,
+                          &Fdo->DebugInterface,
+                          __MODULE__ "|FDO",
+                          FdoDebugCallback,
+                          Fdo,
+                          &Fdo->DebugCallback);
+    if (!NT_SUCCESS(status))
+        goto fail11;
+
     KeLowerIrql(Irql);
 
 not_active:
@@ -3342,6 +3393,14 @@ not_active:
 
     return STATUS_SUCCESS;
 
+fail11:
+    Error("fail11\n");
+
+    XENBUS_SUSPEND(Deregister,
+                   &Fdo->SuspendInterface,
+                   Fdo->SuspendCallbackLate);
+    Fdo->SuspendCallbackLate = NULL;
+
 fail10:
     Error("fail10\n");
 
@@ -3470,6 +3529,11 @@ FdoD0ToD3(
 
     KeRaiseIrql(DISPATCH_LEVEL, &Irql);
 
+    XENBUS_DEBUG(Deregister,
+                 &Fdo->DebugInterface,
+                 Fdo->DebugCallback);
+    Fdo->DebugCallback = NULL;
+
     XENBUS_SUSPEND(Deregister,
                    &Fdo->SuspendInterface,
                    Fdo->SuspendCallbackLate);
-- 
2.17.1




 


Rackspace

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