Skip to content

Commit

Permalink
Fix linux perf shutdown not correctly working (microsoft#2178)
Browse files Browse the repository at this point in the history
Padding made the struct different. So avoid padding, and just use raw arrays
  • Loading branch information
thhous-msft authored Nov 23, 2021
1 parent ee150a6 commit 3e3baba
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
8 changes: 5 additions & 3 deletions scripts/performance-helper.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,12 @@ function Wait-ForRemote {
param ($Job)
# Ping sidechannel socket on 9999 to tell the app to die
$Socket = New-Object System.Net.Sockets.UDPClient
$GuidToSend = [GUID]"{ff15e657-4f26-570e-88ab-0796b258d11c}"
$GuidBytes = $GuidToSend.ToByteArray();
$BytesToSend = @(
0x57, 0xe6, 0x15, 0xff, 0x26, 0x4f, 0x0e, 0x57,
0x88, 0xab, 0x07, 0x96, 0xb2, 0x58, 0xd1, 0x1c
)
for ($i = 0; $i -lt 120; $i++) {
$Socket.Send($GuidBytes, $GuidBytes.Length, $RemoteAddress, 9999) | Out-Null
$Socket.Send($BytesToSend, $BytesToSend.Length, $RemoteAddress, 9999) | Out-Null
$Completed = Wait-Job -Job $Job -Timeout 1
if ($null -ne $Completed) {
break;
Expand Down
15 changes: 4 additions & 11 deletions src/perf/lib/SecNetPerfMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,15 +272,9 @@ QuicMainGetExtraData(
return TestToRun->GetExtraData(Data, Length);
}

typedef struct ShutdownData {
unsigned long Data1;
unsigned short Data2;
unsigned short Data3;
unsigned char Data4[ 8 ];
} ShutdownData;

const ShutdownData SecNetPerfShutdownGuid = { // {ff15e657-4f26-570e-88ab-0796b258d11c}
0xff15e657,0x4f26,0x570e,0x88,0xab,0x07,0x96,0xb2,0x58,0xd1,0x1c};
const uint8_t SecNetPerfShutdownGuid[16] = { // {ff15e657-4f26-570e-88ab-0796b258d11c}
0x57, 0xe6, 0x15, 0xff, 0x26, 0x4f, 0x0e, 0x57,
0x88, 0xab, 0x07, 0x96, 0xb2, 0x58, 0xd1, 0x1c};

void
DatapathReceive(
Expand All @@ -292,8 +286,7 @@ DatapathReceive(
if (Data->BufferLength != sizeof(SecNetPerfShutdownGuid)) {
return;
}
ShutdownData* ReceivedData = reinterpret_cast<ShutdownData*>(Data->Buffer);
if (memcmp(ReceivedData, &SecNetPerfShutdownGuid, sizeof(ShutdownData))) {
if (memcmp(Data->Buffer, SecNetPerfShutdownGuid, sizeof(SecNetPerfShutdownGuid))) {
return;
}
CXPLAT_EVENT* Event = static_cast<CXPLAT_EVENT*>(Context);
Expand Down

0 comments on commit 3e3baba

Please sign in to comment.