From: Andi Kleen <andi-Vw/NltI1exuRpAAqCnN02g@public.gmane.org>
To: Vince Weaver <vincent.weaver-e7X0jjDqjFGHXe+LvDLADg@public.gmane.org>
Cc: Andi Kleen <andi-Vw/NltI1exuRpAAqCnN02g@public.gmane.org>,
Stephane Eranian
<eranian-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
Jiri Olsa <jolsa-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
"Michael Kerrisk (man-pages)"
<mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
LKML <linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Peter Zijlstra
<a.p.zijlstra-/NLkJaSkS4VmR6Xm/wNWPw@public.gmane.org>,
Paul Mackerras <paulus-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org>,
Ingo Molnar <mingo-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
Arnaldo Carvalho de Melo
<acme-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
Chuck Ebbert
<cebbert.lkml-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Linus Torvalds
<torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
Subject: Re: [patch] perf_event_open.2: 3.19 PERF_SAMPLE_REGS_INTR support
Date: Sat, 7 Mar 2015 00:05:56 +0100 [thread overview]
Message-ID: <20150306230556.GN823@two.firstfloor.org> (raw)
In-Reply-To: <alpine.DEB.2.11.1503061332150.25334-6xBS8L8d439fDsnSvq7Uqyn2WXadKZNJe7X0jjDqjFGHXe+LvDLADg@public.gmane.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-VuQAYsv1563Yd54FQh9/CA@public.gmane.org -- Speaking for myself only.
--
To unsubscribe from this list: send the line "unsubscribe linux-man" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: Andi Kleen <andi@firstfloor.org>
To: Vince Weaver <vincent.weaver@maine.edu>
Cc: Andi Kleen <andi@firstfloor.org>,
Stephane Eranian <eranian@google.com>,
Jiri Olsa <jolsa@redhat.com>,
"Michael Kerrisk (man-pages)" <mtk.manpages@gmail.com>,
linux-man@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
Peter Zijlstra <a.p.zijlstra@chello.nl>,
Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Chuck Ebbert <cebbert.lkml@gmail.com>,
Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [patch] perf_event_open.2: 3.19 PERF_SAMPLE_REGS_INTR support
Date: Sat, 7 Mar 2015 00:05:56 +0100 [thread overview]
Message-ID: <20150306230556.GN823@two.firstfloor.org> (raw)
In-Reply-To: <alpine.DEB.2.11.1503061332150.25334@vincent-weaver-1.umelst.maine.edu>
> 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.
next prev parent reply other threads:[~2015-03-06 23:05 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-12 5:33 [patch] perf_event_open.2: 3.19 PERF_SAMPLE_REGS_INTR support Vince Weaver
2015-02-12 5:33 ` Vince Weaver
[not found] ` <alpine.DEB.2.11.1502120031150.17793-6xBS8L8d439fDsnSvq7Uqyn2WXadKZNJe7X0jjDqjFGHXe+LvDLADg@public.gmane.org>
2015-02-17 5:33 ` Michael Kerrisk (man-pages)
2015-02-17 5:33 ` Michael Kerrisk (man-pages)
2015-02-26 7:51 ` Michael Kerrisk (man-pages)
2015-02-28 22:26 ` Jiri Olsa
2015-02-28 22:26 ` Jiri Olsa
2015-03-01 14:14 ` Stephane Eranian
[not found] ` <CABPqkBQQ3JZp_BdwRJDEGpyqrchixfGG_1Lqh88HJtzXWOGE7Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-02 19:31 ` Vince Weaver
2015-03-02 19:31 ` Vince Weaver
2015-03-02 20:26 ` Stephane Eranian
2015-03-02 21:19 ` Vince Weaver
2015-03-02 21:22 ` Stephane Eranian
2015-03-02 22:23 ` Vince Weaver
[not found] ` <alpine.DEB.2.11.1503021721090.20187-6xBS8L8d439fDsnSvq7Uqyn2WXadKZNJe7X0jjDqjFGHXe+LvDLADg@public.gmane.org>
2015-03-02 22:30 ` Stephane Eranian
2015-03-02 22:30 ` Stephane Eranian
2015-03-02 22:58 ` Andi Kleen
2015-03-02 22:58 ` Andi Kleen
[not found] ` <20150302225807.GJ823-1g7Xle2YJi4/4alezvVtWx2eb7JE58TQ@public.gmane.org>
2015-03-06 18:37 ` Vince Weaver
2015-03-06 18:37 ` Vince Weaver
[not found] ` <alpine.DEB.2.11.1503061332150.25334-6xBS8L8d439fDsnSvq7Uqyn2WXadKZNJe7X0jjDqjFGHXe+LvDLADg@public.gmane.org>
2015-03-06 19:51 ` Stephane Eranian
2015-03-06 19:51 ` Stephane Eranian
2015-03-06 23:05 ` Andi Kleen [this message]
2015-03-06 23:05 ` Andi Kleen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150306230556.GN823@two.firstfloor.org \
--to=andi-vw/nlti1exurpaaqcnn02g@public.gmane.org \
--cc=a.p.zijlstra-/NLkJaSkS4VmR6Xm/wNWPw@public.gmane.org \
--cc=acme-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=cebbert.lkml-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=eranian-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
--cc=jolsa-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-man-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mingo-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=mtk.manpages-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=paulus-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org \
--cc=torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
--cc=vincent.weaver-e7X0jjDqjFGHXe+LvDLADg@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.