Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build Processor Info for Max Processors #3641

Merged
merged 3 commits into from
May 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/generated/linux/platform_winuser.c.clog.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ tracepoint(CLOG_PLATFORM_WINUSER_C, WindowsUserUnloaded );\
// QuicTraceLogInfo(
WindowsUserProcessorStateV2,
"[ dll] Processors:%u, Groups:%u",
ActiveProcessorCount, (uint32_t)Info->Group.ActiveGroupCount);
// arg2 = arg2 = ActiveProcessorCount = arg2
MaxProcessorCount, (uint32_t)Info->Group.ActiveGroupCount);
// arg2 = arg2 = MaxProcessorCount = arg2
// arg3 = arg3 = (uint32_t)Info->Group.ActiveGroupCount = arg3
----------------------------------------------------------*/
#ifndef _clog_4_ARGS_TRACE_WindowsUserProcessorStateV2
Expand Down Expand Up @@ -161,9 +161,9 @@ tracepoint(CLOG_PLATFORM_WINUSER_C, WindowsUserUninitialized );\
AllocFailure,
"Allocation of '%s' failed. (%llu bytes)",
"CxPlatProcessorInfo",
ActiveProcessorCount * sizeof(CXPLAT_PROCESSOR_INFO));
MaxProcessorCount * sizeof(CXPLAT_PROCESSOR_INFO));
// arg2 = arg2 = "CxPlatProcessorInfo" = arg2
// arg3 = arg3 = ActiveProcessorCount * sizeof(CXPLAT_PROCESSOR_INFO) = arg3
// arg3 = arg3 = MaxProcessorCount * sizeof(CXPLAT_PROCESSOR_INFO) = arg3
----------------------------------------------------------*/
#ifndef _clog_4_ARGS_TRACE_AllocFailure
#define _clog_4_ARGS_TRACE_AllocFailure(uniqueId, encoded_arg_string, arg2, arg3)\
Expand Down
8 changes: 4 additions & 4 deletions src/generated/linux/platform_winuser.c.clog.h.lttng.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ TRACEPOINT_EVENT(CLOG_PLATFORM_WINUSER_C, WindowsUserUnloaded,
// QuicTraceLogInfo(
WindowsUserProcessorStateV2,
"[ dll] Processors:%u, Groups:%u",
ActiveProcessorCount, (uint32_t)Info->Group.ActiveGroupCount);
// arg2 = arg2 = ActiveProcessorCount = arg2
MaxProcessorCount, (uint32_t)Info->Group.ActiveGroupCount);
// arg2 = arg2 = MaxProcessorCount = arg2
// arg3 = arg3 = (uint32_t)Info->Group.ActiveGroupCount = arg3
----------------------------------------------------------*/
TRACEPOINT_EVENT(CLOG_PLATFORM_WINUSER_C, WindowsUserProcessorStateV2,
Expand Down Expand Up @@ -151,9 +151,9 @@ TRACEPOINT_EVENT(CLOG_PLATFORM_WINUSER_C, WindowsUserUninitialized,
AllocFailure,
"Allocation of '%s' failed. (%llu bytes)",
"CxPlatProcessorInfo",
ActiveProcessorCount * sizeof(CXPLAT_PROCESSOR_INFO));
MaxProcessorCount * sizeof(CXPLAT_PROCESSOR_INFO));
// arg2 = arg2 = "CxPlatProcessorInfo" = arg2
// arg3 = arg3 = ActiveProcessorCount * sizeof(CXPLAT_PROCESSOR_INFO) = arg3
// arg3 = arg3 = MaxProcessorCount * sizeof(CXPLAT_PROCESSOR_INFO) = arg3
----------------------------------------------------------*/
TRACEPOINT_EVENT(CLOG_PLATFORM_WINUSER_C, AllocFailure,
TP_ARGS(
Expand Down
18 changes: 9 additions & 9 deletions src/platform/platform_winuser.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,21 +86,21 @@ CxPlatProcessorInfoInit(
SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX* Info = NULL;
uint32_t CurrentProcessorCount;

const uint32_t ActiveProcessorCount = CxPlatProcActiveCount();
const uint32_t MaxProcessorCount = CxPlatProcMaxCount();

CXPLAT_DBG_ASSERT(ActiveProcessorCount > 0);
CXPLAT_DBG_ASSERT(ActiveProcessorCount <= UINT16_MAX);
CXPLAT_DBG_ASSERT(MaxProcessorCount > 0);
CXPLAT_DBG_ASSERT(MaxProcessorCount <= UINT16_MAX);
CXPLAT_DBG_ASSERT(CxPlatProcessorInfo == NULL);
CxPlatProcessorInfo =
CXPLAT_ALLOC_NONPAGED(
ActiveProcessorCount * sizeof(CXPLAT_PROCESSOR_INFO),
MaxProcessorCount * sizeof(CXPLAT_PROCESSOR_INFO),
QUIC_POOL_PLATFORM_PROC);
if (CxPlatProcessorInfo == NULL) {
QuicTraceEvent(
AllocFailure,
"Allocation of '%s' failed. (%llu bytes)",
"CxPlatProcessorInfo",
ActiveProcessorCount * sizeof(CXPLAT_PROCESSOR_INFO));
MaxProcessorCount * sizeof(CXPLAT_PROCESSOR_INFO));
Status = QUIC_STATUS_OUT_OF_MEMORY;
goto Error;
}
Expand Down Expand Up @@ -129,7 +129,7 @@ CxPlatProcessorInfoInit(
QuicTraceLogInfo(
WindowsUserProcessorStateV2,
"[ dll] Processors:%u, Groups:%u",
ActiveProcessorCount, (uint32_t)Info->Group.ActiveGroupCount);
MaxProcessorCount, (uint32_t)Info->Group.ActiveGroupCount);

CXPLAT_DBG_ASSERT(CxPlatProcessorGroupInfo == NULL);
CxPlatProcessorGroupInfo =
Expand All @@ -150,13 +150,13 @@ CxPlatProcessorInfoInit(
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;
CurrentProcessorCount += Info->Group.GroupInfo[i].MaximumProcessorCount;
}

for (uint32_t Proc = 0; Proc < ActiveProcessorCount; ++Proc) {
for (uint32_t Proc = 0; Proc < MaxProcessorCount; ++Proc) {
for (WORD Group = 0; Group < Info->Group.ActiveGroupCount; ++Group) {
if (Proc >= CxPlatProcessorGroupInfo[Group].Offset &&
Proc < CxPlatProcessorGroupInfo[Group].Offset + Info->Group.GroupInfo[Group].ActiveProcessorCount) {
Proc < CxPlatProcessorGroupInfo[Group].Offset + Info->Group.GroupInfo[Group].MaximumProcessorCount) {
CxPlatProcessorInfo[Proc].Group = Group;
CxPlatProcessorInfo[Proc].Index = (Proc - CxPlatProcessorGroupInfo[Group].Offset);
QuicTraceLogInfo(
Expand Down