From: Hendrik Brueckner <brueckner@linux.vnet.ibm.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Andy Lutomirski <luto@amacapital.net>,
Valdis Kletnieks <Valdis.Kletnieks@vt.edu>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Paul Mackerras <paulus@samba.org>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Ingo Molnar <mingo@redhat.com>, Kees Cook <keescook@chromium.org>,
Andrea Arcangeli <aarcange@redhat.com>,
Erik Bosman <ebn310@few.vu.nl>,
mpe@ellerman.id.au, anton@samba.org,
brueckner@linux.vnet.ibm.com, schwidefsky@de.ibm.com
Subject: Re: [RFC 5/5] x86,perf: Only allow rdpmc if a perf_event is mapped
Date: Mon, 20 Oct 2014 12:51:10 +0200 [thread overview]
Message-ID: <20141020105110.GA5002@linux.vnet.ibm.com> (raw)
In-Reply-To: <20141020084813.GB3219@twins.programming.kicks-ass.net>
On Mon, Oct 20, 2014 at 10:48:13AM +0200, Peter Zijlstra wrote:
> On Sun, Oct 19, 2014 at 05:08:08PM -0700, Andy Lutomirski wrote:
> > There are a whole bunch of implementations of that
> > callback:
> >
> > - perf_event_idx_default seems fishy
>
> I suppose I did that to encode the rule that 0 := disabled, figuring
> that if there is no actual instruction to access the data, all of this
> would be pointless anyhow.
See comment on "perf_swevent_event_idx returns 0".
>
> > - cpumsf_pmu_event_idx is the same as power_pmu_event_idx.
>
> Oh cute, lets ask the s390 people, do you guys have a userspace
> instruction to read the actual counter value?
For the hardware sampling pmu (cpumsf) there is no instruction to read
sampling data in user space. Also the event->hw.index is always set
to zero anyway. I am going to remove this function and let the core
event code handle the proper default.
As Martin Schwidefsky pointed out in his mail, there is an instruction
to read some hardware counter data (different to the sampling data).
User space is prohibited to use this instruction. Instead, user space
can use another approach which is called runtime instrumentation, for
self-monitoring.
>
> > - perf_swevent_event_idx returns 0.
>
> Right, guaranteed no way to access any of that, maybe we should make
> the default like that too.
I think it would makes sense to return 0 as default in the
perf_event_idx_default() and let each PMU/arch that actually supports
reading PMCs from user space return the proper index. And according
to tools/perf/design.txt, index must be non-zero to trigger a user space
read.
Thanks and kind regards,
Hendrik
next prev parent reply other threads:[~2014-10-20 10:51 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-14 22:57 [RFC 0/5] CR4 handling improvements Andy Lutomirski
2014-10-14 22:57 ` [RFC 1/5] x86: Clean up cr4 manipulation Andy Lutomirski
2014-10-16 8:16 ` Peter Zijlstra
2014-10-16 11:18 ` Borislav Petkov
2014-10-16 11:29 ` Borislav Petkov
2014-10-16 15:32 ` Andy Lutomirski
2014-10-16 15:47 ` Borislav Petkov
2014-10-14 22:57 ` [RFC 2/5] x86: Store a per-cpu shadow copy of CR4 Andy Lutomirski
2014-10-16 8:26 ` Peter Zijlstra
2014-10-16 11:49 ` Borislav Petkov
2014-10-16 15:30 ` Andy Lutomirski
2014-10-14 22:57 ` [RFC 3/5] x86: Add a comment clarifying LDT context switching Andy Lutomirski
2014-10-16 15:49 ` Borislav Petkov
2014-10-16 16:21 ` Andy Lutomirski
2014-10-21 5:41 ` Borislav Petkov
2014-10-21 5:44 ` Andy Lutomirski
2014-10-21 6:05 ` Borislav Petkov
2014-10-14 22:57 ` [RFC 4/5] perf: Add pmu callbacks to track event mapping and unmapping Andy Lutomirski
2014-10-14 22:57 ` [RFC 5/5] x86,perf: Only allow rdpmc if a perf_event is mapped Andy Lutomirski
2014-10-16 8:42 ` Peter Zijlstra
2014-10-16 15:37 ` Andy Lutomirski
2014-10-16 15:57 ` Borislav Petkov
2014-10-17 0:00 ` Andy Lutomirski
2014-10-19 20:23 ` Andy Lutomirski
2014-10-19 21:33 ` Peter Zijlstra
2014-10-19 22:05 ` Andy Lutomirski
2014-10-19 22:20 ` Peter Zijlstra
2014-10-19 22:57 ` Andy Lutomirski
2014-10-20 8:33 ` Peter Zijlstra
2014-10-20 16:49 ` Andy Lutomirski
2014-10-20 17:39 ` Andy Lutomirski
2014-10-21 8:59 ` Peter Zijlstra
2014-10-19 21:35 ` Peter Zijlstra
2014-10-20 0:08 ` Andy Lutomirski
2014-10-20 8:48 ` Peter Zijlstra
2014-10-20 9:24 ` Martin Schwidefsky
2014-10-20 10:51 ` Hendrik Brueckner [this message]
2014-10-21 9:14 ` Peter Zijlstra
2014-10-21 15:52 ` Andy Lutomirski
2014-10-21 4:06 ` [RFC 0/5] CR4 handling improvements Vince Weaver
2014-10-21 4:28 ` Andy Lutomirski
2014-10-21 15:00 ` Vince Weaver
2014-10-21 16:04 ` Peter Zijlstra
2014-10-21 17:05 ` Vince Weaver
2014-10-23 11:42 ` Peter Zijlstra
2014-10-24 12:41 ` Vince Weaver
2014-10-24 22:14 ` Andy Lutomirski
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=20141020105110.GA5002@linux.vnet.ibm.com \
--to=brueckner@linux.vnet.ibm.com \
--cc=Valdis.Kletnieks@vt.edu \
--cc=aarcange@redhat.com \
--cc=acme@kernel.org \
--cc=anton@samba.org \
--cc=ebn310@few.vu.nl \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=mingo@redhat.com \
--cc=mpe@ellerman.id.au \
--cc=paulus@samba.org \
--cc=peterz@infradead.org \
--cc=schwidefsky@de.ibm.com \
/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.