mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stephane Eranian <eranian@google.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Paul Mackerras <paulus@samba.org>,
	eranian@gmail.com, linux-kernel@vger.kernel.org, mingo@elte.hu,
	perfmon2-devel@lists.sf.net,
	"David S. Miller" <davem@davemloft.net>
Subject: Re: [PATCH] perf_events: improve Intel event scheduling
Date: Thu, 7 Jan 2010 10:54:30 +0100	[thread overview]
Message-ID: <bd4cb8901001070154x84a569t71ac317c95eb4683@mail.gmail.com> (raw)
In-Reply-To: <1262854826.4049.91.camel@laptop>

Hi,

Ok, so I made some progress yesterday on all of this.

The key elements are:
  -  pmu->enable() is always called from generic with PMU disabled
  -  pmu->disable() is called with PMU possibly enabled
  - hw_perf_group_sched_in() is always called with PMU disabled

I got the n_added logic working now on X86.

I noticed the difference in pmu->enabled() between Power and X86.
On PPC, you disable the whole PMU. On X86, that's not the case.

Now, I do the scheduling in hw_perf_enable(). Just like on PPC, I also
move events around if their register assignment has changed. It is not
quite working yet. I must have something wrong with the read and rewrite
code.

I will experiment with pmu->enable(). Given the key elements above, I think
Paul is right, all scheduling can be deferred until hw_perf_enable().

But there is a catch. I noticed that hw_perf_enable() is void. In
other words, it
means that if scheduling fails, you won't notice. This is not a problem on PPC
but will be on AMD64. That's because the scheduling depends on what goes on
on the other cores on the socket. In other words, things can change between
pmu->enable()/hw_perf_group_sched_in() and hw_perf_enable(). Unless we lock
something down in between.


On Thu, Jan 7, 2010 at 10:00 AM, Peter Zijlstra <peterz@infradead.org> wrote:
> On Thu, 2010-01-07 at 15:13 +1100, Paul Mackerras wrote:
>>
>> > All the enable and disable calls can be called from NMI interrupt context
>> > and thus must be very careful with locks.
>>
>> I didn't think the pmu->enable() and pmu->disable() functions could be
>> called from NMI context.
>
> I don't think they're called from NMI context either, most certainly not
> from the generic code.
>
> The x86 calls the raw disable from nmi to throttle the counter, but all
> that (should) do is disable that counter, which is limited to a single
> msr write. After that it schedules a full disable by sending a self-ipi.
>
>
>
>



-- 
Stephane Eranian  | EMEA Software Engineering
Google France | 38 avenue de l'Opéra | 75002 Paris
Tel : +33 (0) 1 42 68 53 00
This email may be confidential or privileged. If you received this
communication by mistake, please
don't forward it to anyone else, please erase all copies and
attachments, and please let me know that
it went to the wrong person. Thanks

  reply	other threads:[~2010-01-07  9:54 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-19 15:03 Stephane Eranian
2009-11-18 16:32 ` Peter Zijlstra
2009-12-11 11:00   ` stephane eranian
2009-12-11 11:59     ` stephane eranian
2009-12-21 15:40       ` Peter Zijlstra
2009-12-21 19:00         ` Stephane Eranian
2009-12-21 19:31           ` Peter Zijlstra
2009-12-21 20:59             ` Stephane Eranian
2009-12-21 21:18               ` Peter Zijlstra
2009-12-22  1:09               ` Paul Mackerras
2009-12-22  1:02         ` Paul Mackerras
2009-12-29 14:47           ` Stephane Eranian
2010-01-07  4:13             ` Paul Mackerras
2010-01-07  8:54               ` Peter Zijlstra
2010-01-07  9:00               ` Peter Zijlstra
2010-01-07  9:54                 ` Stephane Eranian [this message]
2010-01-07 10:01                   ` Peter Zijlstra
2009-12-22  0:57       ` Paul Mackerras
2009-12-11 14:38     ` Stephane Eranian

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=bd4cb8901001070154x84a569t71ac317c95eb4683@mail.gmail.com \
    --to=eranian@google.com \
    --cc=davem@davemloft.net \
    --cc=eranian@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=perfmon2-devel@lists.sf.net \
    --cc=peterz@infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®