[llvm] 9b684ec - [llvm-exegesis] Fix warning and hoist statement of arch-specific section
Aiden Grossman via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 27 00:02:54 PDT 2023
Author: Aiden Grossman
Date: 2023-06-27T07:01:20Z
New Revision: 9b684ecde68c6ba479b02b93b0944f4bc79094d5
URL: https://github.com/llvm/llvm-project/commit/9b684ecde68c6ba479b02b93b0944f4bc79094d5
DIFF: https://github.com/llvm/llvm-project/commit/9b684ecde68c6ba479b02b93b0944f4bc79094d5.diff
LOG: [llvm-exegesis] Fix warning and hoist statement of arch-specific section
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.
Added:
Modified:
llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
Removed:
################################################################################
diff --git a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
index 26494981dc8ae..a5ea0fa1b20ff 100644
--- a/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
+++ b/llvm/tools/llvm-exegesis/lib/BenchmarkRunner.cpp
@@ -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:
@@ -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);
More information about the llvm-commits
mailing list