Skip to content
Snippets Groups Projects
Commit 8985821c authored by Moe Jette's avatar Moe Jette
Browse files

Refine support for TotalView partial attach. More work is still needed.

parent d51af094
No related branches found
No related tags found
No related merge requests found
......@@ -3,6 +3,7 @@ documents those changes that are of interest to users and admins.
* Changes in SLURM 2.2.0.pre3
=============================
-- Refine support for TotalView partial attach. More work is still needed.
* Changes in SLURM 2.2.0.pre2
=============================
......
......@@ -63,8 +63,8 @@ CONFIGURATION FILE CHANGES (see "man slurm.conf" for details)
one ThreadsPerCore configured (i.e. no change in behavior without this
option).
* Added new configuration parameters SlurmSchedLogFile and SlurmSchedLogLevel
to support writing scheduling events to a separate log file.
* Added new configuration parameters SlurmSchedLogFile and SlurmSchedLogLevel
to support writing scheduling events to a separate log file.
COMMAND CHANGES (see man pages for details)
===========================================
......
......@@ -127,6 +127,9 @@
/* Define to 1 if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H
/* Define to 1 if you have the <linux/sched.h> header file. */
#undef HAVE_LINUX_SCHED_H
/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
to 0 otherwise. */
#undef HAVE_MALLOC
......
......@@ -16384,7 +16384,7 @@ for ac_header in mcheck.h values.h socket.h sys/socket.h \
sys/systemcfg.h ncurses.h curses.h sys/dr.h sys/vfs.h \
pam/pam_appl.h security/pam_appl.h sys/sysctl.h \
pty.h utmp.h \
sys/syslog.h \
sys/syslog.h linux/sched.h \
kstat.h paths.h limits.h sys/statfs.h sys/ptrace.h sys/termios.h \
 
do :
......
......@@ -81,7 +81,7 @@ AC_CHECK_HEADERS(mcheck.h values.h socket.h sys/socket.h \
sys/systemcfg.h ncurses.h curses.h sys/dr.h sys/vfs.h \
pam/pam_appl.h security/pam_appl.h sys/sysctl.h \
pty.h utmp.h \
sys/syslog.h \
sys/syslog.h linux/sched.h \
kstat.h paths.h limits.h sys/statfs.h sys/ptrace.h sys/termios.h \
)
AC_HEADER_SYS_WAIT
......
......@@ -38,6 +38,14 @@
\*****************************************************************************/
#include "pdebug.h"
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#ifdef HAVE_LINUX_SCHED_H
# include <linux/sched.h>
#endif
/*
* Prepare task for parallel debugger attach
* Returns SLURM_SUCCESS or SLURM_ERROR.
......@@ -124,16 +132,47 @@ pdebug_stop_current(slurmd_job_t *job)
error("ptrace: %m");
}
/* Check if this PID should be woken for TotalView partitial attach */
static bool _pid_to_wake(pid_t pid)
{
#ifdef CLONE_PTRACE
char proc_stat[1024], proc_name[22], state[1], *str_ptr;
int proc_fd, ppid, pgrp, session, tty, tpgid;
long unsigned flags;
sprintf (proc_name, "/proc/%d/stat", (int) pid);
if ((proc_fd = open(proc_name, O_RDONLY, 0)) == -1)
return false; /* process is now gone */
read(proc_fd, proc_stat, sizeof(proc_stat));
close(proc_fd);
/* skip over "PID (CMD) " */
if ((str_ptr = (char *)strrchr(proc_stat, ')')) == NULL)
return false;
if (sscanf(str_ptr + 2,
"%c %d %d %d %d %d %lu ",
state, &ppid, &pgrp, &session, &tty, &tpgid, &flags) != 7)
return false;
if ((flags & CLONE_PTRACE) == 0)
return true;
return false;
#else
int status;
waitpid(pid, &status, (WUNTRACED | WNOHANG));
if (WIFSTOPPED(status))
return true;
return false;
#endif
}
/*
* Wake tasks currently stopped for parallel debugger attach
*/
void pdebug_wake_process(slurmd_job_t *job, pid_t pid)
{
if (job->task_flags & TASK_PARALLEL_DEBUG) {
int status;
waitpid(pid, &status, (WUNTRACED | WNOHANG));
if (WIFSTOPPED(status)) {
if ((pid > (pid_t) 0) && (kill(pid, SIGCONT) < 0))
if ((job->task_flags & TASK_PARALLEL_DEBUG) && (pid > (pid_t) 0)) {
if (_pid_to_wake(pid)) {
if (kill(pid, SIGCONT) < 0)
error("kill(%lu): %m", (unsigned long) pid);
else
debug("woke pid %lu", (unsigned long) pid);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment