From: Owen Smith Date: Thu, 16 Feb 2023 11:55:45 +0000 (+0000) Subject: Skip uninitialized CPUs X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=b2473b5924773ce55624b2e0b8802d811ba77afb;p=pvdrivers%2Fwin%2Fxenbus.git Skip uninitialized CPUs EvtchnFifoAcquire() will loop through all CPUs to call EVTCHNOP_init_control. Skip any CPUs that are not initialized, which is indicated by SystemProcessorVcpuId() failing, instead of failing the Acquire operation. This is primarily an issue when KeQueryMaximumProcessorCountEx() returns a different value to KeQueryActiveProcessorCountEx(), or the system processor callback has not been called with KeProcessorAddCompleteNotify for that CPU. Signed-off-by: Owen Smith Fix up error path that also calls SystemProcessorVcpuId(). Signed-off-by: Paul Durrant --- diff --git a/src/xenbus/evtchn_fifo.c b/src/xenbus/evtchn_fifo.c index a8dab8c..88b810a 100644 --- a/src/xenbus/evtchn_fifo.c +++ b/src/xenbus/evtchn_fifo.c @@ -507,14 +507,20 @@ EvtchnFifoAcquire( PFN_NUMBER Pfn; PHYSICAL_ADDRESS Address; + status = SystemProcessorVcpuId(Index, &vcpu_id); + + Index++; + + if (status == STATUS_NOT_SUPPORTED) + continue; + + if (!NT_SUCCESS(status)) + goto fail1; + Mdl = __AllocatePage(); status = STATUS_NO_MEMORY; if (Mdl == NULL) - goto fail1; - - status = SystemProcessorVcpuId(Index, &vcpu_id); - if (!NT_SUCCESS(status)) goto fail2; Pfn = MmGetMdlPfnArray(Mdl)[0]; @@ -532,8 +538,6 @@ EvtchnFifoAcquire( Address.LowPart); Context->ControlBlockMdl[vcpu_id] = Mdl; - - Index++; } Trace("<====\n"); @@ -546,11 +550,11 @@ done: fail3: Error("fail3\n"); + __FreePage(Mdl); + fail2: Error("fail2\n"); - __FreePage(Mdl); - fail1: Error("fail1 (%08x)\n", status); @@ -559,7 +563,11 @@ fail1: while (--Index >= 0) { unsigned int vcpu_id; - (VOID) SystemProcessorVcpuId(Index, &vcpu_id); + status = SystemProcessorVcpuId(Index, &vcpu_id); + if (status == STATUS_NOT_SUPPORTED) + continue; + + BUG_ON(!NT_SUCCESS(status)); Mdl = Context->ControlBlockMdl[vcpu_id]; Context->ControlBlockMdl[vcpu_id] = NULL;