*/
static inline
-void callchain_store(struct perf_callchain_entry *entry, unsigned long ip)
+void callchain_store(struct perf_callchain_entry *entry, u64 ip)
{
- if (entry->nr < MAX_STACK_DEPTH)
+ if (entry->nr < PERF_MAX_STACK_DEPTH)
entry->ip[entry->nr++] = ip;
}
static void
perf_callchain_kernel(struct pt_regs *regs, struct perf_callchain_entry *entry)
{
- unsigned long bp;
- char *stack;
- int nr = entry->nr;
-
+ callchain_store(entry, PERF_CONTEXT_KERNEL);
callchain_store(entry, regs->ip);
- stack = ((char *)regs + sizeof(struct pt_regs));
-#ifdef CONFIG_FRAME_POINTER
- get_bp(bp);
-#else
- bp = 0;
-#endif
-
- dump_trace(NULL, regs, (void *)&stack, bp, &backtrace_ops, entry);
-
- entry->kernel = entry->nr - nr;
+ dump_trace(NULL, regs, NULL, 0, &backtrace_ops, entry);
}
/*
{
struct stack_frame frame;
const void __user *fp;
- int nr = entry->nr;
if (!user_mode(regs))
regs = task_pt_regs(current);
fp = (void __user *)regs->bp;
+ callchain_store(entry, PERF_CONTEXT_USER);
callchain_store(entry, regs->ip);
- while (entry->nr < MAX_STACK_DEPTH) {
+ while (entry->nr < PERF_MAX_STACK_DEPTH) {
frame.next_frame = NULL;
frame.return_address = 0;
callchain_store(entry, frame.return_address);
fp = frame.next_frame;
}
-
- entry->user = entry->nr - nr;
}
static void
entry = &__get_cpu_var(irq_entry);
entry->nr = 0;
- entry->hv = 0;
- entry->kernel = 0;
- entry->user = 0;
perf_do_callchain(regs, entry);
* { u64 nr;
* { u64 id, val; } cnt[nr]; } && PERF_SAMPLE_GROUP
*
- * { u16 nr,
- * hv,
- * kernel,
- * user;
+ * { u64 nr,
* u64 ips[nr]; } && PERF_SAMPLE_CALLCHAIN
* };
*/
};
-#define MAX_STACK_DEPTH 255
+enum perf_callchain_context {
+ PERF_CONTEXT_HV = (__u64)-32,
+ PERF_CONTEXT_KERNEL = (__u64)-128,
+ PERF_CONTEXT_USER = (__u64)-512,
-struct perf_callchain_entry {
- __u16 nr;
- __u16 hv;
- __u16 kernel;
- __u16 user;
- __u64 ip[MAX_STACK_DEPTH];
+ PERF_CONTEXT_GUEST = (__u64)-2048,
+ PERF_CONTEXT_GUEST_KERNEL = (__u64)-2176,
+ PERF_CONTEXT_GUEST_USER = (__u64)-2560,
+
+ PERF_CONTEXT_MAX = (__u64)-4095,
};
#ifdef __KERNEL__
#include <linux/pid_namespace.h>
#include <asm/atomic.h>
+#define PERF_MAX_STACK_DEPTH 255
+
+struct perf_callchain_entry {
+ __u64 nr;
+ __u64 ip[PERF_MAX_STACK_DEPTH];
+};
+
struct task_struct;
/**