summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRenato Golin <renato.golin@linaro.org>2017-02-20 15:03:12 +0000
committerRenato Golin <renato.golin@linaro.org>2017-02-20 15:03:12 +0000
commit18342e39e6d8f3e226bad79b86c807682ddbe3e9 (patch)
tree7f59d5815e20ff433261591d6066e1389c925e14
parent98e0b12d13946257c321c90d92c995cb47faffd5 (diff)
downloadbcm5719-llvm-18342e39e6d8f3e226bad79b86c807682ddbe3e9.tar.gz
bcm5719-llvm-18342e39e6d8f3e226bad79b86c807682ddbe3e9.zip
Revert "[PGO] Suspend SIGKILL for PR_SET_PDEATHSIG in profile-write"
Revert "[PGO] remove unintended debug trace. NFC" This reverts commit r295469, r295364, as they are unstable on ARM/AArch64. llvm-svn: 295664
-rw-r--r--compiler-rt/lib/profile/InstrProfilingFile.c9
-rw-r--r--compiler-rt/lib/profile/InstrProfilingUtil.c23
-rw-r--r--compiler-rt/lib/profile/InstrProfilingUtil.h8
-rw-r--r--compiler-rt/test/profile/Linux/prctl.c36
4 files changed, 0 insertions, 76 deletions
diff --git a/compiler-rt/lib/profile/InstrProfilingFile.c b/compiler-rt/lib/profile/InstrProfilingFile.c
index dfcbe52d7e4..cd3590e12f5 100644
--- a/compiler-rt/lib/profile/InstrProfilingFile.c
+++ b/compiler-rt/lib/profile/InstrProfilingFile.c
@@ -530,7 +530,6 @@ int __llvm_profile_write_file(void) {
int rc, Length;
const char *Filename;
char *FilenameBuf;
- int PDeathSig = 0;
if (lprofProfileDumped()) {
PROF_NOTE("Profile data not written to file: %s.\n",
@@ -557,18 +556,10 @@ int __llvm_profile_write_file(void) {
return -1;
}
- // Temporarily suspend getting SIGKILL when the parent exits.
- PDeathSig = lprofSuspendSigKill();
-
/* Write profile data to the file. */
rc = writeFile(Filename);
if (rc)
PROF_ERR("Failed to write file \"%s\": %s\n", Filename, strerror(errno));
-
- // Restore SIGKILL.
- if (PDeathSig == 1)
- lprofRestoreSigKill();
-
return rc;
}
diff --git a/compiler-rt/lib/profile/InstrProfilingUtil.c b/compiler-rt/lib/profile/InstrProfilingUtil.c
index fb68f30a5e1..321c7192cc6 100644
--- a/compiler-rt/lib/profile/InstrProfilingUtil.c
+++ b/compiler-rt/lib/profile/InstrProfilingUtil.c
@@ -29,11 +29,6 @@
#include <stdlib.h>
#include <string.h>
-#if defined(__linux__)
-#include <signal.h>
-#include <sys/prctl.h>
-#endif
-
COMPILER_RT_VISIBILITY
void __llvm_profile_recursive_mkdir(char *path) {
int i;
@@ -224,21 +219,3 @@ COMPILER_RT_VISIBILITY const char *lprofFindLastDirSeparator(const char *Path) {
#endif
return Sep;
}
-
-COMPILER_RT_VISIBILITY int lprofSuspendSigKill() {
-#if defined(__linux__)
- int PDeachSig = 0;
- /* Temporarily suspend getting SIGKILL upon exit of the parent process. */
- if (prctl(PR_GET_PDEATHSIG, &PDeachSig) == 0 && PDeachSig == SIGKILL)
- prctl(PR_SET_PDEATHSIG, 0);
- return (PDeachSig == SIGKILL);
-#else
- return 0;
-#endif
-}
-
-COMPILER_RT_VISIBILITY void lprofRestoreSigKill() {
-#if defined(__linux__)
- prctl(PR_SET_PDEATHSIG, SIGKILL);
-#endif
-}
diff --git a/compiler-rt/lib/profile/InstrProfilingUtil.h b/compiler-rt/lib/profile/InstrProfilingUtil.h
index 9698599606e..a80fde77e16 100644
--- a/compiler-rt/lib/profile/InstrProfilingUtil.h
+++ b/compiler-rt/lib/profile/InstrProfilingUtil.h
@@ -51,12 +51,4 @@ int lprofGetHostName(char *Name, int Len);
unsigned lprofBoolCmpXchg(void **Ptr, void *OldV, void *NewV);
void *lprofPtrFetchAdd(void **Mem, long ByteIncr);
-/* Temporarily suspend SIGKILL. Return value of 1 means a restore is needed.
- * Other return values mean no restore is needed.
- */
-int lprofSuspendSigKill();
-
-/* Restore previously suspended SIGKILL. */
-void lprofRestoreSigKill();
-
#endif /* PROFILE_INSTRPROFILINGUTIL_H */
diff --git a/compiler-rt/test/profile/Linux/prctl.c b/compiler-rt/test/profile/Linux/prctl.c
deleted file mode 100644
index 43baf65439e..00000000000
--- a/compiler-rt/test/profile/Linux/prctl.c
+++ /dev/null
@@ -1,36 +0,0 @@
-// RUN: %clang_pgogen -O2 -o %t %s
-// RUN: rm -rf default_*.profraw
-// RUN: %run %t && sleep 1
-// RUN: llvm-profdata show default_*.profraw 2>&1 | FileCheck %s
-
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/prctl.h>
-#include <unistd.h>
-
-#define FAKE_COUNT_SZ 2000000
-/* fake counts to increse the profile size. */
-unsigned long long __attribute__((section("__llvm_prf_cnts")))
-counts[FAKE_COUNT_SZ];
-
-int main(int argc, char **argv) {
- pid_t pid = fork();
- if (pid == 0) {
- int i;
- int sum = 0;
- /* child process: sleep 500us and get to runtime before the
- * main process exits. */
- prctl(PR_SET_PDEATHSIG, SIGKILL);
- usleep(500);
- for (i = 0; i < 5000; ++i)
- sum += i * i * i;
- printf("child process (%d): sum=%d\n", getpid(), sum);
- } else if (pid > 0) {
- /* parent process: sleep 100us to get into profile runtime first. */
- usleep(100);
- }
- return 0;
-}
-
-// CHECK-NOT: Empty raw profile file
OpenPOWER on IntegriCloud