mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Vince Weaver <vince@deater.net>
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>
Subject: Re: [RFC 0/5] CR4 handling improvements
Date: Thu, 23 Oct 2014 13:42:28 +0200	[thread overview]
Message-ID: <20141023114228.GB12706@worktop.programming.kicks-ass.net> (raw)
In-Reply-To: <alpine.DEB.2.10.1410211255580.4491@pianoman.cluster.toy>

On Tue, Oct 21, 2014 at 01:05:49PM -0400, Vince Weaver wrote:
> On Tue, 21 Oct 2014, Peter Zijlstra wrote:
> 
> > > perf_event is also fairly high overhead for setting up and starting 
> > > events,
> > 
> > Which you only do once at the start, so is that really a problem?
> 
> There are various reasons why you might want to start events at times
> other than the beginning of the program.  Some people don't like kernel 
> multiplexing so they start/stop manually if they want to switch eventsets.

I suppose you could pre-create all events and use ioctl()s to start/stop
them where/when desired, this should be faster I think. But yes, this is
not a use-case I've though much about.

> But no, I suppose you could ask anyone wanting to use rdpmc to open some 
> sort of dummy event at startup just to get cr4 enabled.

That's one work-around :-)

> > I still don't get that argument, 2 rdpmc's is cheaper than doing wrmsr,
> > not to mention doing wrmsr through a syscall. And looking at that mmap
> > page is 1 cacheline. Is that cacheline read (assuming you miss) the real
> > problem?
> 
> Well at least by default the first read of the mmap page causes a 
> pagefault which adds a few thousand cycles of latency.  Though you can
> somewhat get around this by prefaulting it in at some point.

MAP_POPULATE is your friend there, but yes manually prefaulting is
perfectly fine too, and the HPC people are quite familiar with the
concept, they do it for a lot of things.

> Anyway I'm just reporting numbers I get when measuring the overhead of 
> the old perfctr interface vs perf_event on typical PAPI workloads.  It's 
> true you can re-arrange calls and such so that perf_event behaves better 
> but that involves redoing a lot of existing code.

OK agreed, having to change existing code is often subject to various
forms of inertia/resistance. And yes I cannot deny that some of the
features perf has come at the expense of various overheads, however hard
we're trying to keep costs down.

> I do appreciate the trouble you've gone through keeping self-monitoring 
> working considering the fact that I'm the only user admitting to using it.

I have some code somewhere that uses it too, I've tried pushing it off
to other people but so far there are no takers :-)

  reply	other threads:[~2014-10-23 11:42 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-14 22:57 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
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 [this message]
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=20141023114228.GB12706@worktop.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=Valdis.Kletnieks@vt.edu \
    --cc=aarcange@redhat.com \
    --cc=acme@kernel.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=paulus@samba.org \
    --cc=vince@deater.net \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome