From 4920b2fbf2d8bc0b1a42c5af42c96e49c263f9db Mon Sep 17 00:00:00 2001 From: Thad House Date: Tue, 3 Sep 2024 09:04:31 -0700 Subject: [PATCH 1/2] Fix kqueue CSPLAT_SQE Type --- src/inc/quic_platform_posix.h | 6 +++--- src/platform/platform_posix.c | 5 +---- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/inc/quic_platform_posix.h b/src/inc/quic_platform_posix.h index 7d0eaf125c..c27f8db7ec 100644 --- a/src/inc/quic_platform_posix.h +++ b/src/inc/quic_platform_posix.h @@ -1125,7 +1125,7 @@ CxPlatCqeUserData( #include typedef int CXPLAT_EVENTQ; -#define CXPLAT_SQE int +#define CXPLAT_SQE uintptr_t #define CXPLAT_SQE_DEFAULT 0 typedef struct kevent CXPLAT_CQE; @@ -1193,7 +1193,7 @@ CxPlatEventQReturn( #define CXPLAT_SQE_INIT 1 -extern long CxPlatCurrentSqe; +extern uintptr_t CxPlatCurrentSqe; inline BOOLEAN @@ -1205,7 +1205,7 @@ CxPlatSqeInitialize( { UNREFERENCED_PARAMETER(queue); UNREFERENCED_PARAMETER(user_data); - *sqe = (CXPLAT_SQE)InterlockedIncrement(&CxPlatCurrentSqe); + *sqe = __sync_add_and_fetch(&CxPlatCurrentSqe, 1); return TRUE; } diff --git a/src/platform/platform_posix.c b/src/platform/platform_posix.c index 0e3c7c5eb1..f395ea0f21 100644 --- a/src/platform/platform_posix.c +++ b/src/platform/platform_posix.c @@ -56,7 +56,7 @@ uint32_t CxPlatProcessorCount; uint64_t CxPlatTotalMemory; #if __APPLE__ || __FreeBSD__ -long CxPlatCurrentSqe = 0x80000000; +uintptr_t CxPlatCurrentSqe = 0x80000000; #endif #ifdef __clang__ @@ -245,8 +245,6 @@ CxPlatInitialize( return Status; } - CxPlatWorkersInit(); - CxPlatTotalMemory = CGroupGetMemoryLimit(); QuicTraceLogInfo( @@ -262,7 +260,6 @@ CxPlatUninitialize( void ) { - CxPlatWorkersUninit(); CxPlatCryptUninitialize(); close(RandomFd); QuicTraceLogInfo( From 4a342e10edf3aed3f81c8174e57784e1281ee5ef Mon Sep 17 00:00:00 2001 From: Thad House Date: Tue, 3 Sep 2024 09:53:36 -0700 Subject: [PATCH 2/2] Fix breaks --- src/platform/platform_posix.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/platform/platform_posix.c b/src/platform/platform_posix.c index f395ea0f21..9f46652958 100644 --- a/src/platform/platform_posix.c +++ b/src/platform/platform_posix.c @@ -245,6 +245,8 @@ CxPlatInitialize( return Status; } + CxPlatWorkersInit(); + CxPlatTotalMemory = CGroupGetMemoryLimit(); QuicTraceLogInfo( @@ -260,6 +262,7 @@ CxPlatUninitialize( void ) { + CxPlatWorkersUninit(); CxPlatCryptUninitialize(); close(RandomFd); QuicTraceLogInfo(