From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755245AbbCFXGC (ORCPT ); Fri, 6 Mar 2015 18:06:02 -0500 Received: from one.firstfloor.org ([193.170.194.197]:56060 "EHLO one.firstfloor.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752333AbbCFXF7 (ORCPT ); Fri, 6 Mar 2015 18:05:59 -0500 Date: Sat, 7 Mar 2015 00:05:56 +0100 From: Andi Kleen To: Vince Weaver Cc: Andi Kleen , Stephane Eranian , Jiri Olsa , "Michael Kerrisk (man-pages)" , linux-man@vger.kernel.org, LKML , Peter Zijlstra , Paul Mackerras , Ingo Molnar , Arnaldo Carvalho de Melo , Chuck Ebbert , Linus Torvalds Subject: Re: [patch] perf_event_open.2: 3.19 PERF_SAMPLE_REGS_INTR support Message-ID: <20150306230556.GN823@two.firstfloor.org> References: <20150228222605.GA13177@krava.redhat.com> <20150302225807.GJ823@two.firstfloor.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > 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.