Messages in this thread | | | Date | Sat, 7 Mar 2015 00:05:56 +0100 | From | Andi Kleen <> | Subject | Re: [patch] perf_event_open.2: 3.19 PERF_SAMPLE_REGS_INTR support |
| |
> so if the sample_type has *both* PERF_SAMPLE_REGS_INTR and > PERF_SAMPLE_REGS_USER set, then the PERF_SAMPLE_REGS_USER values > will have the same register values as the PERF_SAMPLE_REGS_INTR values. >
It ultimatively calls this code:
static void perf_sample_regs_user(struct perf_regs *regs_user, struct pt_regs *regs, struct pt_regs *regs_user_copy) { if (user_mode(regs)) { regs_user->abi = perf_reg_abi(current); regs_user->regs = regs; } else if (current->mm) { perf_get_regs_user(regs_user, regs, regs_user_copy); } else { regs_user->abi = PERF_SAMPLE_REGS_ABI_NONE; regs_user->regs = NULL; } }
And perf_get_regs_user gets the task pt_regs at the top of the stack. So if we interrupted in the kernel it will use that.
I think the first check handling the user case is bogus however (although it will be very rarely wrong). The stack pointer could actually have changed since PEBS was logging the register and the PMI was finally triggered.
It should probably be dropped.
-Andi
-- ak@linux.intel.com -- Speaking for myself only.
| |