зеркало из https://github.com/microsoft/msquic.git
Work Around Missing NUMA Node Info (#3380)
This commit is contained in:
Родитель
470829aaf8
Коммит
5c8bd8e655
|
@ -58,19 +58,18 @@ tracepoint(CLOG_PLATFORM_WINUSER_C, WindowsUserUnloaded );\
|
|||
|
||||
|
||||
/*----------------------------------------------------------
|
||||
// Decoder Ring for WindowsUserProcessorState
|
||||
// [ dll] Processors:%u, Groups:%u, NUMA Nodes:%u
|
||||
// Decoder Ring for WindowsUserProcessorStateV2
|
||||
// [ dll] Processors:%u, Groups:%u
|
||||
// QuicTraceLogInfo(
|
||||
WindowsUserProcessorState,
|
||||
"[ dll] Processors:%u, Groups:%u, NUMA Nodes:%u",
|
||||
ActiveProcessorCount, ProcessorGroupCount, NumaNodeCount);
|
||||
WindowsUserProcessorStateV2,
|
||||
"[ dll] Processors:%u, Groups:%u",
|
||||
ActiveProcessorCount, (uint32_t)Info->Group.ActiveGroupCount);
|
||||
// arg2 = arg2 = ActiveProcessorCount = arg2
|
||||
// arg3 = arg3 = ProcessorGroupCount = arg3
|
||||
// arg4 = arg4 = NumaNodeCount = arg4
|
||||
// arg3 = arg3 = (uint32_t)Info->Group.ActiveGroupCount = arg3
|
||||
----------------------------------------------------------*/
|
||||
#ifndef _clog_5_ARGS_TRACE_WindowsUserProcessorState
|
||||
#define _clog_5_ARGS_TRACE_WindowsUserProcessorState(uniqueId, encoded_arg_string, arg2, arg3, arg4)\
|
||||
tracepoint(CLOG_PLATFORM_WINUSER_C, WindowsUserProcessorState , arg2, arg3, arg4);\
|
||||
#ifndef _clog_4_ARGS_TRACE_WindowsUserProcessorStateV2
|
||||
#define _clog_4_ARGS_TRACE_WindowsUserProcessorStateV2(uniqueId, encoded_arg_string, arg2, arg3)\
|
||||
tracepoint(CLOG_PLATFORM_WINUSER_C, WindowsUserProcessorStateV2 , arg2, arg3);\
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -79,22 +78,20 @@ tracepoint(CLOG_PLATFORM_WINUSER_C, WindowsUserProcessorState , arg2, arg3, arg4
|
|||
|
||||
/*----------------------------------------------------------
|
||||
// Decoder Ring for ProcessorInfo
|
||||
// [ dll] Proc[%u] Group[%hu] Index[%u] NUMA[%u]
|
||||
// [ dll] Proc[%u] Group[%hu] Index[%u]
|
||||
// QuicTraceLogInfo(
|
||||
ProcessorInfo,
|
||||
"[ dll] Proc[%u] Group[%hu] Index[%u] NUMA[%u]",
|
||||
Index,
|
||||
CxPlatProcessorInfo[Index].Group,
|
||||
CxPlatProcessorInfo[Index].Index,
|
||||
CxPlatProcessorInfo[Index].NumaNode);
|
||||
// arg2 = arg2 = Index = arg2
|
||||
// arg3 = arg3 = CxPlatProcessorInfo[Index].Group = arg3
|
||||
// arg4 = arg4 = CxPlatProcessorInfo[Index].Index = arg4
|
||||
// arg5 = arg5 = CxPlatProcessorInfo[Index].NumaNode = arg5
|
||||
ProcessorInfo,
|
||||
"[ dll] Proc[%u] Group[%hu] Index[%u]",
|
||||
Proc,
|
||||
Group,
|
||||
CxPlatProcessorInfo[Proc].Index);
|
||||
// arg2 = arg2 = Proc = arg2
|
||||
// arg3 = arg3 = Group = arg3
|
||||
// arg4 = arg4 = CxPlatProcessorInfo[Proc].Index = arg4
|
||||
----------------------------------------------------------*/
|
||||
#ifndef _clog_6_ARGS_TRACE_ProcessorInfo
|
||||
#define _clog_6_ARGS_TRACE_ProcessorInfo(uniqueId, encoded_arg_string, arg2, arg3, arg4, arg5)\
|
||||
tracepoint(CLOG_PLATFORM_WINUSER_C, ProcessorInfo , arg2, arg3, arg4, arg5);\
|
||||
#ifndef _clog_5_ARGS_TRACE_ProcessorInfo
|
||||
#define _clog_5_ARGS_TRACE_ProcessorInfo(uniqueId, encoded_arg_string, arg2, arg3, arg4)\
|
||||
tracepoint(CLOG_PLATFORM_WINUSER_C, ProcessorInfo , arg2, arg3, arg4);\
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -34,25 +34,22 @@ TRACEPOINT_EVENT(CLOG_PLATFORM_WINUSER_C, WindowsUserUnloaded,
|
|||
|
||||
|
||||
/*----------------------------------------------------------
|
||||
// Decoder Ring for WindowsUserProcessorState
|
||||
// [ dll] Processors:%u, Groups:%u, NUMA Nodes:%u
|
||||
// Decoder Ring for WindowsUserProcessorStateV2
|
||||
// [ dll] Processors:%u, Groups:%u
|
||||
// QuicTraceLogInfo(
|
||||
WindowsUserProcessorState,
|
||||
"[ dll] Processors:%u, Groups:%u, NUMA Nodes:%u",
|
||||
ActiveProcessorCount, ProcessorGroupCount, NumaNodeCount);
|
||||
WindowsUserProcessorStateV2,
|
||||
"[ dll] Processors:%u, Groups:%u",
|
||||
ActiveProcessorCount, (uint32_t)Info->Group.ActiveGroupCount);
|
||||
// arg2 = arg2 = ActiveProcessorCount = arg2
|
||||
// arg3 = arg3 = ProcessorGroupCount = arg3
|
||||
// arg4 = arg4 = NumaNodeCount = arg4
|
||||
// arg3 = arg3 = (uint32_t)Info->Group.ActiveGroupCount = arg3
|
||||
----------------------------------------------------------*/
|
||||
TRACEPOINT_EVENT(CLOG_PLATFORM_WINUSER_C, WindowsUserProcessorState,
|
||||
TRACEPOINT_EVENT(CLOG_PLATFORM_WINUSER_C, WindowsUserProcessorStateV2,
|
||||
TP_ARGS(
|
||||
unsigned int, arg2,
|
||||
unsigned int, arg3,
|
||||
unsigned int, arg4),
|
||||
unsigned int, arg3),
|
||||
TP_FIELDS(
|
||||
ctf_integer(unsigned int, arg2, arg2)
|
||||
ctf_integer(unsigned int, arg3, arg3)
|
||||
ctf_integer(unsigned int, arg4, arg4)
|
||||
)
|
||||
)
|
||||
|
||||
|
@ -60,30 +57,26 @@ TRACEPOINT_EVENT(CLOG_PLATFORM_WINUSER_C, WindowsUserProcessorState,
|
|||
|
||||
/*----------------------------------------------------------
|
||||
// Decoder Ring for ProcessorInfo
|
||||
// [ dll] Proc[%u] Group[%hu] Index[%u] NUMA[%u]
|
||||
// [ dll] Proc[%u] Group[%hu] Index[%u]
|
||||
// QuicTraceLogInfo(
|
||||
ProcessorInfo,
|
||||
"[ dll] Proc[%u] Group[%hu] Index[%u] NUMA[%u]",
|
||||
Index,
|
||||
CxPlatProcessorInfo[Index].Group,
|
||||
CxPlatProcessorInfo[Index].Index,
|
||||
CxPlatProcessorInfo[Index].NumaNode);
|
||||
// arg2 = arg2 = Index = arg2
|
||||
// arg3 = arg3 = CxPlatProcessorInfo[Index].Group = arg3
|
||||
// arg4 = arg4 = CxPlatProcessorInfo[Index].Index = arg4
|
||||
// arg5 = arg5 = CxPlatProcessorInfo[Index].NumaNode = arg5
|
||||
ProcessorInfo,
|
||||
"[ dll] Proc[%u] Group[%hu] Index[%u]",
|
||||
Proc,
|
||||
Group,
|
||||
CxPlatProcessorInfo[Proc].Index);
|
||||
// arg2 = arg2 = Proc = arg2
|
||||
// arg3 = arg3 = Group = arg3
|
||||
// arg4 = arg4 = CxPlatProcessorInfo[Proc].Index = arg4
|
||||
----------------------------------------------------------*/
|
||||
TRACEPOINT_EVENT(CLOG_PLATFORM_WINUSER_C, ProcessorInfo,
|
||||
TP_ARGS(
|
||||
unsigned int, arg2,
|
||||
unsigned short, arg3,
|
||||
unsigned int, arg4,
|
||||
unsigned int, arg5),
|
||||
unsigned int, arg4),
|
||||
TP_FIELDS(
|
||||
ctf_integer(unsigned int, arg2, arg2)
|
||||
ctf_integer(unsigned short, arg3, arg3)
|
||||
ctf_integer(unsigned int, arg4, arg4)
|
||||
ctf_integer(unsigned int, arg5, arg5)
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
@ -958,18 +958,18 @@ CxPlatTimeAtOrBefore32(
|
|||
// Processor Count and Index
|
||||
//
|
||||
|
||||
typedef struct {
|
||||
|
||||
uint16_t Group;
|
||||
uint32_t Index; // In Group;
|
||||
uint32_t NumaNode;
|
||||
uint64_t MaskInGroup;
|
||||
|
||||
typedef struct CXPLAT_PROCESSOR_INFO {
|
||||
uint32_t Index; // Index in the current group
|
||||
uint16_t Group; // The group number this processor is a part of
|
||||
} CXPLAT_PROCESSOR_INFO;
|
||||
|
||||
typedef struct CXPLAT_PROCESSOR_GROUP_INFO {
|
||||
KAFFINITY Mask; // Bit mask of active processors in the group
|
||||
uint32_t Offset; // Base process index offset this group starts at
|
||||
} CXPLAT_PROCESSOR_GROUP_INFO;
|
||||
|
||||
extern CXPLAT_PROCESSOR_INFO* CxPlatProcessorInfo;
|
||||
extern uint64_t* CxPlatNumaMasks;
|
||||
extern uint32_t* CxPlatProcessorGroupOffsets;
|
||||
extern CXPLAT_PROCESSOR_GROUP_INFO* CxPlatProcessorGroupInfo;
|
||||
|
||||
#if defined(QUIC_RESTRICTED_BUILD)
|
||||
DWORD CxPlatProcMaxCount();
|
||||
|
@ -987,7 +987,7 @@ CxPlatProcCurrentNumber(
|
|||
) {
|
||||
PROCESSOR_NUMBER ProcNumber;
|
||||
GetCurrentProcessorNumberEx(&ProcNumber);
|
||||
return CxPlatProcessorGroupOffsets[ProcNumber.Group] + ProcNumber.Number;
|
||||
return CxPlatProcessorGroupInfo[ProcNumber.Group].Offset + ProcNumber.Number;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1119,7 +1119,7 @@ CxPlatThreadCreate(
|
|||
if (Config->Flags & CXPLAT_THREAD_FLAG_SET_AFFINITIZE) {
|
||||
Group.Mask = (KAFFINITY)(1ull << ProcInfo->Index); // Fixed processor
|
||||
} else {
|
||||
Group.Mask = (KAFFINITY)CxPlatNumaMasks[ProcInfo->NumaNode]; // Fixed NUMA node
|
||||
Group.Mask = CxPlatProcessorGroupInfo[ProcInfo->Group].Mask;
|
||||
}
|
||||
Group.Group = ProcInfo->Group;
|
||||
SetThreadGroupAffinity(*Thread, &Group, NULL);
|
||||
|
|
|
@ -8544,7 +8544,7 @@
|
|||
},
|
||||
"ProcessorInfo": {
|
||||
"ModuleProperites": {},
|
||||
"TraceString": "[ dll] Proc[%u] Group[%hu] Index[%u] NUMA[%u]",
|
||||
"TraceString": "[ dll] Proc[%u] Group[%hu] Index[%u]",
|
||||
"UniqueId": "ProcessorInfo",
|
||||
"splitArgs": [
|
||||
{
|
||||
|
@ -8558,10 +8558,6 @@
|
|||
{
|
||||
"DefinationEncoding": "u",
|
||||
"MacroVariableName": "arg4"
|
||||
},
|
||||
{
|
||||
"DefinationEncoding": "u",
|
||||
"MacroVariableName": "arg5"
|
||||
}
|
||||
],
|
||||
"macroName": "QuicTraceLogInfo"
|
||||
|
@ -11453,6 +11449,22 @@
|
|||
],
|
||||
"macroName": "QuicTraceLogInfo"
|
||||
},
|
||||
"WindowsUserProcessorStateV2": {
|
||||
"ModuleProperites": {},
|
||||
"TraceString": "[ dll] Processors:%u, Groups:%u",
|
||||
"UniqueId": "WindowsUserProcessorStateV2",
|
||||
"splitArgs": [
|
||||
{
|
||||
"DefinationEncoding": "u",
|
||||
"MacroVariableName": "arg2"
|
||||
},
|
||||
{
|
||||
"DefinationEncoding": "u",
|
||||
"MacroVariableName": "arg3"
|
||||
}
|
||||
],
|
||||
"macroName": "QuicTraceLogInfo"
|
||||
},
|
||||
"WindowsUserUninitialized": {
|
||||
"ModuleProperites": {},
|
||||
"TraceString": "[ dll] Uninitialized",
|
||||
|
@ -14911,9 +14923,9 @@
|
|||
"EncodingString": "[perf] Print Buffer %d %s\\n"
|
||||
},
|
||||
{
|
||||
"UniquenessHash": "fe92afed-9594-4ca6-5fca-ea13e79da91c",
|
||||
"UniquenessHash": "001f1bee-3642-fdf5-1025-b39da67792a6",
|
||||
"TraceID": "ProcessorInfo",
|
||||
"EncodingString": "[ dll] Proc[%u] Group[%hu] Index[%u] NUMA[%u]"
|
||||
"EncodingString": "[ dll] Proc[%u] Group[%hu] Index[%u]"
|
||||
},
|
||||
{
|
||||
"UniquenessHash": "18ef147d-5376-d7f2-f624-3b27af96dd05",
|
||||
|
@ -15895,6 +15907,11 @@
|
|||
"TraceID": "WindowsUserProcessorState",
|
||||
"EncodingString": "[ dll] Processors:%u, Groups:%u, NUMA Nodes:%u"
|
||||
},
|
||||
{
|
||||
"UniquenessHash": "75d23316-ce7e-8980-f3f4-677d2622ee5f",
|
||||
"TraceID": "WindowsUserProcessorStateV2",
|
||||
"EncodingString": "[ dll] Processors:%u, Groups:%u"
|
||||
},
|
||||
{
|
||||
"UniquenessHash": "19b21f4a-a6e8-3b9b-c4da-e303c8f108b1",
|
||||
"TraceID": "WindowsUserUninitialized",
|
||||
|
|
|
@ -3383,7 +3383,7 @@ CxPlatDataPathSocketProcessAcceptCompletion(
|
|||
NULL);
|
||||
if (Result == NO_ERROR) {
|
||||
AffinitizedProcessor =
|
||||
(uint16_t)CxPlatProcessorGroupOffsets[RssAffinity.Processor.Group] +
|
||||
(uint16_t)CxPlatProcessorGroupInfo[RssAffinity.Processor.Group].Offset +
|
||||
(uint16_t)RssAffinity.Processor.Number;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,8 +23,7 @@ uint64_t CxPlatPerfFreq;
|
|||
uint64_t CxPlatTotalMemory;
|
||||
CX_PLATFORM CxPlatform = { NULL };
|
||||
CXPLAT_PROCESSOR_INFO* CxPlatProcessorInfo;
|
||||
uint64_t* CxPlatNumaMasks;
|
||||
uint32_t* CxPlatProcessorGroupOffsets;
|
||||
CXPLAT_PROCESSOR_GROUP_INFO* CxPlatProcessorGroupInfo;
|
||||
#ifdef TIMERR_NOERROR
|
||||
TIMECAPS CxPlatTimerCapabilities;
|
||||
#endif // TIMERR_NOERROR
|
||||
|
@ -69,30 +68,28 @@ CxPlatSystemUnload(
|
|||
|
||||
_IRQL_requires_max_(PASSIVE_LEVEL)
|
||||
_Must_inspect_result_
|
||||
_Success_(return != FALSE)
|
||||
BOOLEAN
|
||||
CxPlatProcessorGroupInfo(
|
||||
QUIC_STATUS
|
||||
CxPlatGetProcessorGroupInfo(
|
||||
_In_ LOGICAL_PROCESSOR_RELATIONSHIP Relationship,
|
||||
_Outptr_ _At_(*Buffer, __drv_allocatesMem(Mem)) _Pre_defensive_
|
||||
PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX* Buffer,
|
||||
_Out_ PDWORD BufferLength
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
QUIC_STATUS
|
||||
CxPlatProcessorInfoInit(
|
||||
void
|
||||
)
|
||||
{
|
||||
BOOLEAN Result = FALSE;
|
||||
DWORD BufferLength = 0;
|
||||
uint8_t* Buffer = NULL;
|
||||
uint32_t Offset;
|
||||
QUIC_STATUS Status = QUIC_STATUS_SUCCESS;
|
||||
DWORD InfoLength = 0;
|
||||
SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX* Info = NULL;
|
||||
uint32_t CurrentProcessorCount;
|
||||
|
||||
uint32_t ActiveProcessorCount = CxPlatProcActiveCount();
|
||||
uint32_t ProcessorGroupCount = 0;
|
||||
uint32_t ProcessorsPerGroup = 0;
|
||||
uint32_t NumaNodeCount = 0;
|
||||
const uint32_t ActiveProcessorCount = CxPlatProcActiveCount();
|
||||
|
||||
CXPLAT_DBG_ASSERT(ActiveProcessorCount > 0);
|
||||
CXPLAT_DBG_ASSERT(ActiveProcessorCount <= UINT16_MAX);
|
||||
CXPLAT_DBG_ASSERT(CxPlatProcessorInfo == NULL);
|
||||
CxPlatProcessorInfo =
|
||||
CXPLAT_ALLOC_NONPAGED(
|
||||
|
@ -104,180 +101,87 @@ CxPlatProcessorInfoInit(
|
|||
"Allocation of '%s' failed. (%llu bytes)",
|
||||
"CxPlatProcessorInfo",
|
||||
ActiveProcessorCount * sizeof(CXPLAT_PROCESSOR_INFO));
|
||||
Status = QUIC_STATUS_OUT_OF_MEMORY;
|
||||
goto Error;
|
||||
}
|
||||
|
||||
if (!CxPlatProcessorGroupInfo(
|
||||
RelationAll,
|
||||
(PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX*)&Buffer,
|
||||
&BufferLength)) {
|
||||
Status =
|
||||
CxPlatGetProcessorGroupInfo(
|
||||
RelationGroup,
|
||||
&Info,
|
||||
&InfoLength);
|
||||
if (QUIC_FAILED(Status)) {
|
||||
goto Error;
|
||||
}
|
||||
|
||||
Offset = 0;
|
||||
while (Offset < BufferLength) {
|
||||
PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX Info =
|
||||
(PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX)(Buffer + Offset);
|
||||
if (Info->Relationship == RelationNumaNode) {
|
||||
if (Info->NumaNode.NodeNumber + 1 > NumaNodeCount) {
|
||||
NumaNodeCount = Info->NumaNode.NodeNumber + 1;
|
||||
}
|
||||
} else if (Info->Relationship == RelationGroup) {
|
||||
if (ProcessorGroupCount == 0) {
|
||||
CXPLAT_DBG_ASSERT(Info->Group.ActiveGroupCount != 0);
|
||||
ProcessorGroupCount = Info->Group.ActiveGroupCount;
|
||||
ProcessorsPerGroup = Info->Group.GroupInfo[0].ActiveProcessorCount;
|
||||
}
|
||||
}
|
||||
Offset += Info->Size;
|
||||
}
|
||||
|
||||
CXPLAT_DBG_ASSERT(ProcessorGroupCount != 0);
|
||||
if (ProcessorGroupCount == 0) {
|
||||
CXPLAT_DBG_ASSERT(InfoLength != 0);
|
||||
CXPLAT_DBG_ASSERT(Info->Relationship == RelationGroup);
|
||||
CXPLAT_DBG_ASSERT(Info->Group.ActiveGroupCount != 0);
|
||||
if (Info->Group.ActiveGroupCount == 0) {
|
||||
QuicTraceEvent(
|
||||
LibraryError,
|
||||
"[ lib] ERROR, %s.",
|
||||
"Failed to determine processor group count");
|
||||
goto Error;
|
||||
}
|
||||
|
||||
CXPLAT_DBG_ASSERT(ProcessorsPerGroup != 0);
|
||||
if (ProcessorsPerGroup == 0) {
|
||||
QuicTraceEvent(
|
||||
LibraryError,
|
||||
"[ lib] ERROR, %s.",
|
||||
"Failed to determine processors per group count");
|
||||
goto Error;
|
||||
}
|
||||
|
||||
CXPLAT_DBG_ASSERT(NumaNodeCount != 0);
|
||||
if (NumaNodeCount == 0) {
|
||||
QuicTraceEvent(
|
||||
LibraryError,
|
||||
"[ lib] ERROR, %s.",
|
||||
"Failed to determine NUMA node count");
|
||||
goto Error;
|
||||
}
|
||||
|
||||
CXPLAT_DBG_ASSERT(CxPlatProcessorGroupOffsets == NULL);
|
||||
CxPlatProcessorGroupOffsets = CXPLAT_ALLOC_NONPAGED(ProcessorGroupCount * sizeof(uint32_t), QUIC_POOL_PLATFORM_PROC);
|
||||
if (CxPlatProcessorGroupOffsets == NULL) {
|
||||
QuicTraceEvent(
|
||||
AllocFailure,
|
||||
"Allocation of '%s' failed. (%llu bytes)",
|
||||
"CxPlatProcessorGroupOffsets",
|
||||
ProcessorGroupCount * sizeof(uint32_t));
|
||||
goto Error;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < ProcessorGroupCount; ++i) {
|
||||
CxPlatProcessorGroupOffsets[i] = i * ProcessorsPerGroup;
|
||||
}
|
||||
|
||||
CXPLAT_DBG_ASSERT(CxPlatNumaMasks == NULL);
|
||||
CxPlatNumaMasks = CXPLAT_ALLOC_NONPAGED(NumaNodeCount * sizeof(uint64_t), QUIC_POOL_PLATFORM_PROC);
|
||||
if (CxPlatNumaMasks == NULL) {
|
||||
QuicTraceEvent(
|
||||
AllocFailure,
|
||||
"Allocation of '%s' failed. (%llu bytes)",
|
||||
"CxPlatNumaMasks",
|
||||
NumaNodeCount * sizeof(uint64_t));
|
||||
Status = QUIC_STATUS_INTERNAL_ERROR;
|
||||
goto Error;
|
||||
}
|
||||
|
||||
QuicTraceLogInfo(
|
||||
WindowsUserProcessorState,
|
||||
"[ dll] Processors:%u, Groups:%u, NUMA Nodes:%u",
|
||||
ActiveProcessorCount, ProcessorGroupCount, NumaNodeCount);
|
||||
WindowsUserProcessorStateV2,
|
||||
"[ dll] Processors:%u, Groups:%u",
|
||||
ActiveProcessorCount, (uint32_t)Info->Group.ActiveGroupCount);
|
||||
|
||||
Offset = 0;
|
||||
while (Offset < BufferLength) {
|
||||
PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX Info =
|
||||
(PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX)(Buffer + Offset);
|
||||
if (Info->Relationship == RelationNumaNode) {
|
||||
CxPlatNumaMasks[Info->NumaNode.NodeNumber] = (uint64_t)Info->NumaNode.GroupMask.Mask;
|
||||
}
|
||||
Offset += Info->Size;
|
||||
CXPLAT_DBG_ASSERT(CxPlatProcessorGroupInfo == NULL);
|
||||
CxPlatProcessorGroupInfo =
|
||||
CXPLAT_ALLOC_NONPAGED(
|
||||
Info->Group.ActiveGroupCount * sizeof(CXPLAT_PROCESSOR_GROUP_INFO),
|
||||
QUIC_POOL_PLATFORM_PROC);
|
||||
if (CxPlatProcessorGroupInfo == NULL) {
|
||||
QuicTraceEvent(
|
||||
AllocFailure,
|
||||
"Allocation of '%s' failed. (%llu bytes)",
|
||||
"CxPlatProcessorGroupInfo",
|
||||
Info->Group.ActiveGroupCount * sizeof(CXPLAT_PROCESSOR_GROUP_INFO));
|
||||
Status = QUIC_STATUS_OUT_OF_MEMORY;
|
||||
goto Error;
|
||||
}
|
||||
|
||||
for (uint32_t Index = 0; Index < ActiveProcessorCount; ++Index) {
|
||||
|
||||
Offset = 0;
|
||||
while (Offset < BufferLength) {
|
||||
PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX Info =
|
||||
(PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX)(Buffer + Offset);
|
||||
if (Info->Relationship == RelationGroup) {
|
||||
uint32_t ProcessorOffset = 0;
|
||||
for (WORD i = 0; i < Info->Group.ActiveGroupCount; ++i) {
|
||||
uint32_t IndexToSet = Index - ProcessorOffset;
|
||||
if (IndexToSet < Info->Group.GroupInfo[i].ActiveProcessorCount) {
|
||||
CXPLAT_DBG_ASSERT(IndexToSet < 64);
|
||||
CxPlatProcessorInfo[Index].Group = i;
|
||||
CxPlatProcessorInfo[Index].Index = IndexToSet;
|
||||
CxPlatProcessorInfo[Index].MaskInGroup = 1ull << IndexToSet;
|
||||
goto FindNumaNode;
|
||||
}
|
||||
ProcessorOffset += Info->Group.GroupInfo[i].ActiveProcessorCount;
|
||||
}
|
||||
}
|
||||
Offset += Info->Size;
|
||||
}
|
||||
|
||||
QuicTraceEvent(
|
||||
LibraryError,
|
||||
"[ lib] ERROR, %s.",
|
||||
"Failed to determine processor group");
|
||||
goto Error;
|
||||
|
||||
FindNumaNode:
|
||||
|
||||
Offset = 0;
|
||||
while (Offset < BufferLength) {
|
||||
PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX Info =
|
||||
(PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX)(Buffer + Offset);
|
||||
if (Info->Relationship == RelationNumaNode) {
|
||||
if (Info->NumaNode.GroupMask.Group == CxPlatProcessorInfo[Index].Group &&
|
||||
(Info->NumaNode.GroupMask.Mask & CxPlatProcessorInfo[Index].MaskInGroup) != 0) {
|
||||
CxPlatProcessorInfo[Index].NumaNode = Info->NumaNode.NodeNumber;
|
||||
QuicTraceLogInfo(
|
||||
ProcessorInfo,
|
||||
"[ dll] Proc[%u] Group[%hu] Index[%u] NUMA[%u]",
|
||||
Index,
|
||||
CxPlatProcessorInfo[Index].Group,
|
||||
CxPlatProcessorInfo[Index].Index,
|
||||
CxPlatProcessorInfo[Index].NumaNode);
|
||||
goto Next;
|
||||
}
|
||||
}
|
||||
Offset += Info->Size;
|
||||
}
|
||||
|
||||
QuicTraceEvent(
|
||||
LibraryError,
|
||||
"[ lib] ERROR, %s.",
|
||||
"Failed to determine NUMA node");
|
||||
goto Error;
|
||||
|
||||
Next:
|
||||
;
|
||||
CurrentProcessorCount = 0;
|
||||
for (WORD i = 0; i < Info->Group.ActiveGroupCount; ++i) {
|
||||
CxPlatProcessorGroupInfo[i].Mask = Info->Group.GroupInfo[i].ActiveProcessorMask;
|
||||
CxPlatProcessorGroupInfo[i].Offset = CurrentProcessorCount;
|
||||
CurrentProcessorCount += Info->Group.GroupInfo[i].ActiveProcessorCount;
|
||||
}
|
||||
|
||||
Result = TRUE;
|
||||
for (uint32_t Proc = 0; Proc < ActiveProcessorCount; ++Proc) {
|
||||
for (WORD Group = 0; Group < Info->Group.ActiveGroupCount; ++Group) {
|
||||
if (Proc >= CxPlatProcessorGroupInfo[Group].Offset &&
|
||||
Proc < CxPlatProcessorGroupInfo[Group].Offset + Info->Group.GroupInfo[Group].ActiveProcessorCount) {
|
||||
CxPlatProcessorInfo[Proc].Group = Group;
|
||||
CxPlatProcessorInfo[Proc].Index = (Proc - CxPlatProcessorGroupInfo[Group].Offset);
|
||||
QuicTraceLogInfo(
|
||||
ProcessorInfo,
|
||||
"[ dll] Proc[%u] Group[%hu] Index[%u]",
|
||||
Proc,
|
||||
Group,
|
||||
CxPlatProcessorInfo[Proc].Index);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Status = QUIC_STATUS_SUCCESS;
|
||||
|
||||
Error:
|
||||
|
||||
if (Buffer) {
|
||||
CXPLAT_FREE(Buffer, QUIC_POOL_PLATFORM_TMP_ALLOC);
|
||||
if (Info) {
|
||||
CXPLAT_FREE(Info, QUIC_POOL_PLATFORM_TMP_ALLOC);
|
||||
}
|
||||
|
||||
if (!Result) {
|
||||
if (CxPlatNumaMasks) {
|
||||
CXPLAT_FREE(CxPlatNumaMasks, QUIC_POOL_PLATFORM_PROC);
|
||||
CxPlatNumaMasks = NULL;
|
||||
}
|
||||
if (CxPlatProcessorGroupOffsets) {
|
||||
CXPLAT_FREE(CxPlatProcessorGroupOffsets, QUIC_POOL_PLATFORM_PROC);
|
||||
CxPlatProcessorGroupOffsets = NULL;
|
||||
if (QUIC_FAILED(Status)) {
|
||||
if (CxPlatProcessorGroupInfo) {
|
||||
CXPLAT_FREE(CxPlatProcessorGroupInfo, QUIC_POOL_PLATFORM_PROC);
|
||||
CxPlatProcessorGroupInfo = NULL;
|
||||
}
|
||||
if (CxPlatProcessorInfo) {
|
||||
CXPLAT_FREE(CxPlatProcessorInfo, QUIC_POOL_PLATFORM_PROC);
|
||||
|
@ -285,7 +189,7 @@ Error:
|
|||
}
|
||||
}
|
||||
|
||||
return Result;
|
||||
return Status;
|
||||
}
|
||||
|
||||
_IRQL_requires_max_(PASSIVE_LEVEL)
|
||||
|
@ -294,10 +198,8 @@ CxPlatProcessorInfoUnInit(
|
|||
void
|
||||
)
|
||||
{
|
||||
CXPLAT_FREE(CxPlatNumaMasks, QUIC_POOL_PLATFORM_PROC);
|
||||
CxPlatNumaMasks = NULL;
|
||||
CXPLAT_FREE(CxPlatProcessorGroupOffsets, QUIC_POOL_PLATFORM_PROC);
|
||||
CxPlatProcessorGroupOffsets = NULL;
|
||||
CXPLAT_FREE(CxPlatProcessorGroupInfo, QUIC_POOL_PLATFORM_PROC);
|
||||
CxPlatProcessorGroupInfo = NULL;
|
||||
CXPLAT_FREE(CxPlatProcessorInfo, QUIC_POOL_PLATFORM_PROC);
|
||||
CxPlatProcessorInfo = NULL;
|
||||
}
|
||||
|
@ -320,12 +222,11 @@ CxPlatInitialize(
|
|||
goto Error;
|
||||
}
|
||||
|
||||
if (!CxPlatProcessorInfoInit()) {
|
||||
if (QUIC_FAILED(Status = CxPlatProcessorInfoInit())) {
|
||||
QuicTraceEvent(
|
||||
LibraryError,
|
||||
"[ lib] ERROR, %s.",
|
||||
"CxPlatProcessorInfoInit failed");
|
||||
Status = QUIC_STATUS_OUT_OF_MEMORY;
|
||||
goto Error;
|
||||
}
|
||||
ProcInfoInitialized = TRUE;
|
||||
|
@ -619,9 +520,8 @@ Error:
|
|||
|
||||
_IRQL_requires_max_(PASSIVE_LEVEL)
|
||||
_Must_inspect_result_
|
||||
_Success_(return != FALSE)
|
||||
BOOLEAN
|
||||
CxPlatProcessorGroupInfo(
|
||||
QUIC_STATUS
|
||||
CxPlatGetProcessorGroupInfo(
|
||||
_In_ LOGICAL_PROCESSOR_RELATIONSHIP Relationship,
|
||||
_Outptr_ _At_(*Buffer, __drv_allocatesMem(Mem)) _Pre_defensive_
|
||||
PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX* Buffer,
|
||||
|
@ -635,7 +535,7 @@ CxPlatProcessorGroupInfo(
|
|||
LibraryError,
|
||||
"[ lib] ERROR, %s.",
|
||||
"Failed to determine PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX size");
|
||||
goto Error;
|
||||
return HRESULT_FROM_WIN32(GetLastError());
|
||||
}
|
||||
|
||||
*Buffer = CXPLAT_ALLOC_NONPAGED(*BufferLength, QUIC_POOL_PLATFORM_TMP_ALLOC);
|
||||
|
@ -645,7 +545,7 @@ CxPlatProcessorGroupInfo(
|
|||
"Allocation of '%s' failed. (%llu bytes)",
|
||||
"PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX",
|
||||
*BufferLength);
|
||||
goto Error;
|
||||
return QUIC_STATUS_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
if (!GetLogicalProcessorInformationEx(
|
||||
|
@ -658,16 +558,10 @@ CxPlatProcessorGroupInfo(
|
|||
GetLastError(),
|
||||
"GetLogicalProcessorInformationEx failed");
|
||||
CXPLAT_FREE(*Buffer, QUIC_POOL_PLATFORM_TMP_ALLOC);
|
||||
goto Error;
|
||||
return HRESULT_FROM_WIN32(GetLastError());
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
||||
Error:
|
||||
|
||||
*Buffer = NULL;
|
||||
*BufferLength = 0;
|
||||
return FALSE;
|
||||
return QUIC_STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -707,7 +601,7 @@ CxPlatProcActiveCount(
|
|||
DWORD ProcLength;
|
||||
DWORD Count;
|
||||
|
||||
if (!CxPlatProcessorGroupInfo(RelationGroup, &ProcInfo, &ProcLength)) {
|
||||
if (QUIC_FAILED(CxPlatGetProcessorGroupInfo(RelationGroup, &ProcInfo, &ProcLength))) {
|
||||
CXPLAT_DBG_ASSERT(FALSE);
|
||||
return 0;
|
||||
}
|
||||
|
@ -729,7 +623,7 @@ CxPlatProcMaxCount(
|
|||
DWORD ProcLength;
|
||||
DWORD Count;
|
||||
|
||||
if (!CxPlatProcessorGroupInfo(RelationGroup, &ProcInfo, &ProcLength)) {
|
||||
if (QUIC_FAILED(CxPlatGetProcessorGroupInfo(RelationGroup, &ProcInfo, &ProcLength))) {
|
||||
CXPLAT_DBG_ASSERT(FALSE);
|
||||
return 0;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче