Skip to content

Commit

Permalink
[llvm-exegesis] Fix warning and hoist statement of arch-specific section
Browse files Browse the repository at this point in the history
My last patch broke most of the builders that aren't currently running
at least Kernel 5.6 as there was a variable used later on inside a
region that required that kernel version. Also fixes a minor warning
left over from a bad merge.
  • Loading branch information
boomanaiden154 committed Jun 27, 2023
1 parent 9f80831 commit 9b684ec
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ class SubProcessFunctionExecutorImpl
"the child process failed. This might be due running an older "
"Linux kernel that doesn't support the pidfd_getfd system call "
"(anything before Linux 5.6).";
"the child process failed";
case ChildProcessExitCodeE::RSeqDisableFailed:
return "Disabling restartable sequences failed";
case ChildProcessExitCodeE::FunctionDataMappingFailed:
Expand Down Expand Up @@ -302,12 +301,12 @@ class SubProcessFunctionExecutorImpl
exit(ChildProcessExitCodeE::CounterFDReadFailed);
}

pid_t ParentPID = getppid();

// Make sure the following two syscalls are defined on the platform that
// we're building on as they were introduced to the kernel fairly recently
// (v5.6 for the second one).
#if defined SYS_pidfd_open && defined SYS_pidfd_getfd
pid_t ParentPID = getppid();

#if defined(SYS_pidfd_open) && defined(SYS_pidfd_getfd)
int ParentPIDFD = syscall(SYS_pidfd_open, ParentPID, 0);
int CounterFileDescriptor =
syscall(SYS_pidfd_getfd, ParentPIDFD, ParentCounterFileDescriptor, 0);
Expand Down

0 comments on commit 9b684ec

Please sign in to comment.