public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Frederic Weisbecker <fweisbec@gmail.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@elte.hu>, LKML <linux-kernel@vger.kernel.org>,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Paul Mackerras <paulus@samba.org>,
	Stephane Eranian <eranian@google.com>
Subject: Re: [GIT PULL] perf crash fix
Date: Thu, 3 Jun 2010 14:35:46 +0200	[thread overview]
Message-ID: <20100603123543.GA5234@nowhere> (raw)
In-Reply-To: <1275552159.27810.34944.camel@twins>

On Thu, Jun 03, 2010 at 10:02:39AM +0200, Peter Zijlstra wrote:
> On Thu, 2010-06-03 at 05:13 +0200, Frederic Weisbecker wrote:
> 
> > diff --git a/kernel/perf_event.c b/kernel/perf_event.c
> > index 858f56f..b666d7d 100644
> > --- a/kernel/perf_event.c
> > +++ b/kernel/perf_event.c
> > @@ -1510,20 +1510,16 @@ do {					\
> >  	return div64_u64(dividend, divisor);
> >  }
> >  
> > -static void perf_event_stop(struct perf_event *event)
> > +static void perf_event_stop_hwevent(struct perf_event *event)
> >  {
> > -	if (!event->pmu->stop)
> > -		return event->pmu->disable(event);
> > -
> > -	return event->pmu->stop(event);
> > +	if (event->pmu->stop && !is_software_event(event))
> > +		return event->pmu->stop(event);
> >  }
> >  
> > -static int perf_event_start(struct perf_event *event)
> > +static int perf_event_start_hwevent(struct perf_event *event)
> >  {
> > -	if (!event->pmu->start)
> > -		return event->pmu->enable(event);
> > -
> > -	return event->pmu->start(event);
> > +	if (event->pmu->start && !is_software_event(event))
> > +		return event->pmu->start(event);
> >  }
> >  
> >  static void perf_adjust_period(struct perf_event *event, u64 nsec, u64 count)
> > @@ -1546,9 +1542,9 @@ static void perf_adjust_period(struct perf_event *event, u64 nsec, u64 count)
> >  
> >  	if (atomic64_read(&hwc->period_left) > 8*sample_period) {
> >  		perf_disable();
> > -		perf_event_stop(event);
> > +		perf_event_stop_hwevent(event);
> >  		atomic64_set(&hwc->period_left, 0);
> > -		perf_event_start(event);
> > +		perf_event_start_hwevent(event);
> >  		perf_enable();
> >  	}
> >  }
> 
> Urhm,. isn't is much easier to simply give the software events a NOP
> stop/start callback?


I wanted to, but I thought we could avoid two indirect calls on each
ticks and I was also afraid of breaking start/stop original semantics,
more especially the role of perf_event_stop/start


But that's about quite small details. I'm ok with your patch (the version
that also handles trace events ;)

Thanks.


  parent reply	other threads:[~2010-06-03 12:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-03  3:13 [GIT PULL] perf crash fix Frederic Weisbecker
2010-06-03  8:02 ` Peter Zijlstra
2010-06-03  9:08   ` Peter Zijlstra
2010-06-03 12:35   ` Frederic Weisbecker [this message]
2010-06-03 12:40     ` Peter Zijlstra
2010-06-03 12:42       ` Frederic Weisbecker
2010-06-03  9:26 ` Peter Zijlstra
2010-06-03  9:33   ` Peter Zijlstra
2010-06-03 17:54     ` [tip:perf/urgent] perf: Fix crash in swevents tip-bot for Peter Zijlstra

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=20100603123543.GA5234@nowhere \
    --to=fweisbec@gmail.com \
    --cc=acme@redhat.com \
    --cc=eranian@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --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