[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [win-pv-devel] [PATCH 2/9] Query "multi-queue-max-queues"
> -----Original Message----- > From: win-pv-devel [mailto:win-pv-devel-bounces@xxxxxxxxxxxxxxxxxxxx] On > Behalf Of Owen Smith > Sent: 29 May 2018 11:07 > To: win-pv-devel@xxxxxxxxxxxxxxxxxxxx > Cc: Owen Smith <owen.smith@xxxxxxxxxx> > Subject: [win-pv-devel] [PATCH 2/9] Query "multi-queue-max-queues" > > Query "multi-queue-max-queues", and override if neccessary, and work > out a suitable value for the number of queues used. Also adds the > commented out writing code to set "multi-queue-num-queues" > > Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx> Acked-by: Paul Durrant <paul.durrant@xxxxxxxxxx> > --- > src/xenvbd/driver.c | 3 +- > src/xenvbd/driver.h | 1 + > src/xenvbd/frontend.c | 270 +++++++++++++++++++++++++++++++++----- > ------------ > src/xenvbd/frontend.h | 2 + > 4 files changed, 184 insertions(+), 92 deletions(-) > > diff --git a/src/xenvbd/driver.c b/src/xenvbd/driver.c > index 59b380c..2e9ba54 100644 > --- a/src/xenvbd/driver.c > +++ b/src/xenvbd/driver.c > @@ -267,7 +267,8 @@ __DriverInitializeOverrides( > { "discard-secure", FeatureDiscardSecure }, > { "discard-alignment", FeatureDiscardAlignment }, > { "discard-granularity", FeatureDiscardGranularity }, > - { "max-ring-page-order", FeatureMaxRingPageOrder } > + { "max-ring-page-order", FeatureMaxRingPageOrder }, > + { "multi-queue-max-queues", FeatureMultiQueueMaxQueues } > }; > > for (Index = 0; Index < ARRAYSIZE(Mapping); Index++) { > diff --git a/src/xenvbd/driver.h b/src/xenvbd/driver.h > index d99c09a..5a24c4a 100644 > --- a/src/xenvbd/driver.h > +++ b/src/xenvbd/driver.h > @@ -80,6 +80,7 @@ typedef enum _XENVBD_FEATURE { > FeatureDiscardAlignment, > FeatureDiscardGranularity, > FeatureMaxRingPageOrder, > + FeatureMultiQueueMaxQueues, > > // Add any new features before this enum > NumberOfFeatures > diff --git a/src/xenvbd/frontend.c b/src/xenvbd/frontend.c > index b7e61c2..db96a36 100644 > --- a/src/xenvbd/frontend.c > +++ b/src/xenvbd/frontend.c > @@ -74,6 +74,8 @@ struct _XENVBD_FRONTEND { > XENVBD_DISKINFO DiskInfo; > XENVBD_PAGE Page80; > XENVBD_PAGE Page83; > + ULONG MaxQueues; > + ULONG NumQueues; > > // Interfaces to XenBus > XENBUS_STORE_INTERFACE StoreInterface; > @@ -111,6 +113,101 @@ __XenvbdStateName( > default: return "UNKNOWN"; > } > } > + > + > +#define FRONTEND_GET_PROPERTY(_name, _type) \ > +static FORCEINLINE _type \ > +__FrontendGet ## _name ## ( \ > + IN PXENVBD_FRONTEND Frontend \ > + ) \ > +{ \ > + return Frontend-> ## _name ## ; \ > +} \ > +_type \ > +FrontendGet ## _name ## ( \ > + IN PXENVBD_FRONTEND Frontend \ > + ) \ > +{ \ > + return __FrontendGet ## _name ## (Frontend);\ > +} > + > +FRONTEND_GET_PROPERTY(Target, PXENVBD_TARGET) > +FRONTEND_GET_PROPERTY(Ring, PXENVBD_RING) > +FRONTEND_GET_PROPERTY(Granter, PXENVBD_GRANTER) > +FRONTEND_GET_PROPERTY(TargetId, ULONG) > +FRONTEND_GET_PROPERTY(DeviceId, ULONG) > +FRONTEND_GET_PROPERTY(BackendDomain, ULONG) > +FRONTEND_GET_PROPERTY(BackendPath, PCHAR) > +FRONTEND_GET_PROPERTY(FrontendPath, PCHAR) > +//FRONTEND_GET_PROPERTY(Caps, PXENVBD_CAPS) > +PXENVBD_CAPS > +FrontendGetCaps( > + IN PXENVBD_FRONTEND Frontend > + ) > +{ > + return &Frontend->Caps; > +} > +//FRONTEND_GET_PROPERTY(Features, PXENVBD_FEATURES) > +PXENVBD_FEATURES > +FrontendGetFeatures( > + IN PXENVBD_FRONTEND Frontend > + ) > +{ > + return &Frontend->Features; > +} > +//FRONTEND_GET_PROPERTY(DiskInfo, PXENVBD_DISKINFO) > +PXENVBD_DISKINFO > +FrontendGetDiskInfo( > + IN PXENVBD_FRONTEND Frontend > + ) > +{ > + return &Frontend->DiskInfo; > +} > +//FRONTEND_GET_PROPERTY(Connected, BOOLEAN) > +BOOLEAN > +FrontendGetConnected( > + IN PXENVBD_FRONTEND Frontend > + ) > +{ > + return Frontend->Caps.Connected; > +} > +//FRONTEND_GET_PROPERTY(ReadOnly, BOOLEAN) > +BOOLEAN > +FrontendGetReadOnly( > + IN PXENVBD_FRONTEND Frontend > + ) > +{ > + return !!(Frontend->DiskInfo.DiskInfo & VDISK_READONLY); > +} > +//FRONTEND_GET_PROPERTY(Discard, BOOLEAN) > +BOOLEAN > +FrontendGetDiscard( > + IN PXENVBD_FRONTEND Frontend > + ) > +{ > + return Frontend->DiskInfo.Discard; > +} > +//FRONTEND_GET_PROPERTY(FlushCache, BOOLEAN) > +BOOLEAN > +FrontendGetFlushCache( > + IN PXENVBD_FRONTEND Frontend > + ) > +{ > + return Frontend->DiskInfo.FlushCache; > +} > +//FRONTEND_GET_PROPERTY(Barrier, BOOLEAN) > +BOOLEAN > +FrontendGetBarrier( > + IN PXENVBD_FRONTEND Frontend > + ) > +{ > + return Frontend->DiskInfo.Barrier; > +} > +FRONTEND_GET_PROPERTY(MaxQueues, ULONG) > +FRONTEND_GET_PROPERTY(NumQueues, ULONG) > + > +#undef FRONTEND_GET_PROPERTY > + > > //========================================================= > ==================== > #define FRONTEND_POOL_TAG 'tnFX' > __checkReturn > @@ -1081,6 +1178,38 @@ fail1: > Error("Fail1 (%08x)\n", Status); > return Status; > } > +static VOID > +FrontendSetNumQueues( > + IN PXENVBD_FRONTEND Frontend > + ) > +{ > + PCHAR Buffer; > + ULONG BackendMaxQueues; > + NTSTATUS status; > + > + status = XENBUS_STORE(Read, > + &Frontend->StoreInterface, > + NULL, > + __FrontendGetBackendPath(Frontend), > + "multi-queue-max-queues", > + &Buffer); > + if (NT_SUCCESS(status)) { > + BackendMaxQueues = (ULONG)strtoul(Buffer, NULL, 10); > + > + XENBUS_STORE(Free, > + &Frontend->StoreInterface, > + Buffer); > + } else { > + BackendMaxQueues = 1; > + } > + > + Frontend->NumQueues = __min(__FrontendGetMaxQueues(Frontend), > + BackendMaxQueues); > + > + Verbose("Target[%u] NumQueues %u\n", > + __FrontendGetTargetId(Frontend), > + Frontend->NumQueues); > +} > __drv_requiresIRQL(DISPATCH_LEVEL) > static NTSTATUS > FrontendConnect( > @@ -1090,6 +1219,8 @@ FrontendConnect( > NTSTATUS Status; > XenbusState BackendState; > > + FrontendSetNumQueues(Frontend); > + > // Alloc Ring, Create Evtchn, Gnttab map > Status = GranterConnect(Frontend->Granter); > if (!NT_SUCCESS(Status)) > @@ -1147,6 +1278,16 @@ FrontendConnect( > if (!NT_SUCCESS(Status)) > goto abort; > > + //status = XENBUS_STORE(Printf, > + // &Frontend->StoreInterface, > + // Transaction, > + // Frontend->FrontendPath, > + // "multi-queue-num-queues", > + // "%u", > + // __FrontendGetNumQueues(Frontend)); > + //if (!NT_SUCCESS(status)) > + // goto abort; > + > Status = XENBUS_STORE(TransactionEnd, > &Frontend->StoreInterface, > Transaction, > @@ -1217,6 +1358,7 @@ fail2: > GranterDisconnect(Frontend->Granter); > fail1: > Error("Fail1 (%08x)\n", Status); > + Frontend->NumQueues = 0; > return Status; > } > __drv_requiresIRQL(DISPATCH_LEVEL) > @@ -1228,6 +1370,8 @@ FrontendDisconnect( > RingDisconnect(Frontend->Ring); > GranterDisconnect(Frontend->Granter); > > + Frontend->NumQueues = 0; > + > Base64Free(Frontend->Page80.Data); > Frontend->Page80.Data = NULL; > Frontend->Page80.Size = 0; > @@ -1726,6 +1870,29 @@ fail1: > return status; > } > > +static VOID > +FrontendSetMaxQueues( > + IN PXENVBD_FRONTEND Frontend > + ) > +{ > + ULONG FrontendMaxQueues; > + > + Frontend->MaxQueues = > KeQueryActiveProcessorCountEx(ALL_PROCESSOR_GROUPS); > + > + if (DriverGetFeatureOverride(FeatureMultiQueueMaxQueues, > + &FrontendMaxQueues)) { > + if (FrontendMaxQueues < Frontend->MaxQueues) > + Frontend->MaxQueues = FrontendMaxQueues; > + } > + > + if (Frontend->MaxQueues == 0) > + Frontend->MaxQueues = 1; > + > + Verbose("Target[%u] MaxQueues %u\n", > + __FrontendGetTargetId(Frontend), > + Frontend->MaxQueues); > +} > + > NTSTATUS > FrontendCreate( > IN PXENVBD_TARGET Target, > @@ -1752,6 +1919,8 @@ FrontendCreate( > Frontend->State = XENVBD_INITIALIZED; > Frontend->DiskInfo.SectorSize = 512; // default sector size > Frontend->BackendDomain = DOMID_INVALID; > + > + FrontendSetMaxQueues(Frontend); > > status = RtlStringCbPrintfA(Frontend->FrontendPath, > sizeof(Frontend->FrontendPath), > @@ -1800,6 +1969,14 @@ fail3: > Error("fail3\n"); > fail2: > Error("Fail2\n"); > + Frontend->Target = NULL; > + Frontend->TargetId = 0; > + Frontend->DeviceId = 0; > + Frontend->State = XENVBD_STATE_INVALID; // 0 > + Frontend->DiskInfo.SectorSize = 0; > + Frontend->BackendDomain = 0; > + Frontend->MaxQueues = 0; > + ASSERT(IsZeroMemory(Frontend, sizeof(XENVBD_FRONTEND))); > __FrontendFree(Frontend); > fail1: > Error("Fail1 (%08x)\n", status); > @@ -1824,6 +2001,8 @@ FrontendDestroy( > Frontend->Page83.Data = NULL; > Frontend->Page83.Size = 0; > > + Frontend->MaxQueues = 0; > + > ThreadAlert(Frontend->BackendThread); > ThreadJoin(Frontend->BackendThread); > Frontend->BackendThread = NULL; > @@ -1840,94 +2019,3 @@ FrontendDestroy( > __FrontendFree(Frontend); > Trace("Target[%d] @ (%d) <=====\n", TargetId, KeGetCurrentIrql()); > } > - > -#define FRONTEND_GET_PROPERTY(_name, _type) \ > -static FORCEINLINE _type \ > -__FrontendGet ## _name ## ( \ > - IN PXENVBD_FRONTEND Frontend \ > - ) \ > -{ \ > - return Frontend-> ## _name ## ; \ > -} \ > -_type \ > -FrontendGet ## _name ## ( \ > - IN PXENVBD_FRONTEND Frontend \ > - ) \ > -{ \ > - return __FrontendGet ## _name ## (Frontend);\ > -} > - > -FRONTEND_GET_PROPERTY(Target, PXENVBD_TARGET) > -FRONTEND_GET_PROPERTY(Ring, PXENVBD_RING) > -FRONTEND_GET_PROPERTY(Granter, PXENVBD_GRANTER) > -FRONTEND_GET_PROPERTY(TargetId, ULONG) > -FRONTEND_GET_PROPERTY(DeviceId, ULONG) > -FRONTEND_GET_PROPERTY(BackendDomain, ULONG) > -FRONTEND_GET_PROPERTY(BackendPath, PCHAR) > -FRONTEND_GET_PROPERTY(FrontendPath, PCHAR) > -//FRONTEND_GET_PROPERTY(Caps, PXENVBD_CAPS) > -PXENVBD_CAPS > -FrontendGetCaps( > - IN PXENVBD_FRONTEND Frontend > - ) > -{ > - return &Frontend->Caps; > -} > -//FRONTEND_GET_PROPERTY(Features, PXENVBD_FEATURES) > -PXENVBD_FEATURES > -FrontendGetFeatures( > - IN PXENVBD_FRONTEND Frontend > - ) > -{ > - return &Frontend->Features; > -} > -//FRONTEND_GET_PROPERTY(DiskInfo, PXENVBD_DISKINFO) > -PXENVBD_DISKINFO > -FrontendGetDiskInfo( > - IN PXENVBD_FRONTEND Frontend > - ) > -{ > - return &Frontend->DiskInfo; > -} > -//FRONTEND_GET_PROPERTY(Connected, BOOLEAN) > -BOOLEAN > -FrontendGetConnected( > - IN PXENVBD_FRONTEND Frontend > - ) > -{ > - return Frontend->Caps.Connected; > -} > -//FRONTEND_GET_PROPERTY(ReadOnly, BOOLEAN) > -BOOLEAN > -FrontendGetReadOnly( > - IN PXENVBD_FRONTEND Frontend > - ) > -{ > - return !!(Frontend->DiskInfo.DiskInfo & VDISK_READONLY); > -} > -//FRONTEND_GET_PROPERTY(Discard, BOOLEAN) > -BOOLEAN > -FrontendGetDiscard( > - IN PXENVBD_FRONTEND Frontend > - ) > -{ > - return Frontend->DiskInfo.Discard; > -} > -//FRONTEND_GET_PROPERTY(FlushCache, BOOLEAN) > -BOOLEAN > -FrontendGetFlushCache( > - IN PXENVBD_FRONTEND Frontend > - ) > -{ > - return Frontend->DiskInfo.FlushCache; > -} > -//FRONTEND_GET_PROPERTY(Barrier, BOOLEAN) > -BOOLEAN > -FrontendGetBarrier( > - IN PXENVBD_FRONTEND Frontend > - ) > -{ > - return Frontend->DiskInfo.Barrier; > -} > - > -#undef FRONTEND_GET_PROPERTY > diff --git a/src/xenvbd/frontend.h b/src/xenvbd/frontend.h > index 1488476..fcf5632 100644 > --- a/src/xenvbd/frontend.h > +++ b/src/xenvbd/frontend.h > @@ -167,6 +167,8 @@ FRONTEND_GET_PROPERTY(ReadOnly, BOOLEAN) > FRONTEND_GET_PROPERTY(Discard, BOOLEAN) > FRONTEND_GET_PROPERTY(FlushCache, BOOLEAN) > FRONTEND_GET_PROPERTY(Barrier, BOOLEAN) > +FRONTEND_GET_PROPERTY(MaxQueues, ULONG) > +FRONTEND_GET_PROPERTY(NumQueues, ULONG) > > #undef FRONTEND_GET_PROPERTY > > -- > 2.16.2.windows.1 > > > _______________________________________________ > win-pv-devel mailing list > win-pv-devel@xxxxxxxxxxxxxxxxxxxx > https://lists.xenproject.org/mailman/listinfo/win-pv-devel _______________________________________________ win-pv-devel mailing list win-pv-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/win-pv-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |