#include <linux/tracepoint.h>
#include <linux/nsproxy.h>
+#include <linux/pid_namespace.h>
TRACE_EVENT(lttng_statedump_start,
TP_PROTO(struct lttng_session *session),
TRACE_EVENT(lttng_statedump_process_state,
TP_PROTO(struct lttng_session *session,
struct task_struct *p,
- int type, int mode, int submode, int status),
- TP_ARGS(session, p, type, mode, submode, status),
+ int type, int mode, int submode, int status,
+ struct pid_namespace *pid_ns),
+ TP_ARGS(session, p, type, mode, submode, status, pid_ns),
TP_STRUCT__entry(
__field(pid_t, tid)
__field(pid_t, vtid)
__field(int, mode)
__field(int, submode)
__field(int, status)
+ __field(int, ns_level)
),
TP_fast_assign(
tp_assign(tid, p->pid)
- tp_assign(vtid,
- ({
- struct nsproxy *proxy;
- pid_t ret = 0;
-
- rcu_read_lock();
- proxy = task_nsproxy(p);
- if (proxy) {
- ret = task_pid_nr_ns(p,
- proxy->pid_ns);
- }
- rcu_read_unlock();
- ret;
- }))
+ tp_assign(vtid, pid_ns ? task_pid_nr_ns(p, pid_ns) : 0)
tp_assign(pid, p->tgid)
- tp_assign(vpid,
- ({
- struct nsproxy *proxy;
- pid_t ret = 0;
-
- rcu_read_lock();
- proxy = task_nsproxy(p);
- if (proxy) {
- ret = task_tgid_nr_ns(p,
- proxy->pid_ns);
- }
- rcu_read_unlock();
- ret;
- }))
+ tp_assign(vpid, pid_ns ? task_tgid_nr_ns(p, pid_ns) : 0)
tp_assign(ppid,
({
pid_t ret;
tp_assign(vppid,
({
struct task_struct *parent;
- struct nsproxy *proxy;
pid_t ret = 0;
rcu_read_lock();
parent = rcu_dereference(p->real_parent);
- proxy = task_nsproxy(parent);
- if (proxy) {
- ret = task_tgid_nr_ns(parent,
- proxy->pid_ns);
- }
+ ret = task_tgid_nr_ns(parent, pid_ns);
rcu_read_unlock();
ret;
}))
tp_assign(mode, mode)
tp_assign(submode, submode)
tp_assign(status, status)
+ tp_assign(ns_level, pid_ns ? pid_ns->level : 0)
),
TP_printk("")
)
}
#endif
+static
+void lttng_statedump_process_ns(struct lttng_session *session,
+ struct task_struct *p,
+ enum lttng_thread_type type,
+ enum lttng_execution_mode mode,
+ enum lttng_execution_submode submode,
+ enum lttng_process_status status)
+{
+ struct nsproxy *proxy;
+ struct pid_namespace *pid_ns;
+
+ rcu_read_lock();
+ proxy = task_nsproxy(p);
+ if (proxy) {
+ pid_ns = proxy->pid_ns;
+ do {
+ trace_lttng_statedump_process_state(session,
+ p, type, mode, submode, status, pid_ns);
+ } while (pid_ns);
+ } else {
+ trace_lttng_statedump_process_state(session,
+ p, type, mode, submode, status, NULL);
+ }
+ rcu_read_unlock();
+}
+
static
int lttng_enumerate_process_states(struct lttng_session *session)
{
type = LTTNG_USER_THREAD;
else
type = LTTNG_KERNEL_THREAD;
- trace_lttng_statedump_process_state(session,
+ lttng_statedump_process_ns(session,
p, type, mode, submode, status);
task_unlock(p);
} while_each_thread(g, p);