Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754959Ab0ARMxp (ORCPT ); Mon, 18 Jan 2010 07:53:45 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753172Ab0ARMxp (ORCPT ); Mon, 18 Jan 2010 07:53:45 -0500 Received: from mail-fx0-f225.google.com ([209.85.220.225]:47185 "EHLO mail-fx0-f225.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750751Ab0ARMxo convert rfc822-to-8bit (ORCPT ); Mon, 18 Jan 2010 07:53:44 -0500 DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=mime-version:reply-to:in-reply-to:references:date:message-id :subject:from:to:cc:content-type:content-transfer-encoding; b=CC2jOj7UMNF0IZZXl8nRB+3ZnsatqBo/Y54M7Yxnp/taUBpuqslCUjRhC1h6S3uEDs bGZh829f2Pfobatfhy12cB0jJU+4qkPWjs8wc9JkhrqLjQFqlOFWcmRGV+VIBZn/m5N5 anA5ES3+FtLAeU+Kl1hw7RJFVNLbL0xGfT54k= MIME-Version: 1.0 Reply-To: eranian@gmail.com In-Reply-To: <1263815616.4283.332.camel@laptop> References: <4b4c761b.0338560a.1eaa.ffff824d@mx.google.com> <1263312616.4244.153.camel@laptop> <1263400193.4244.238.camel@laptop> <20100117141233.GF5035@nowhere> <1263813189.4283.245.camel@laptop> <1263815616.4283.332.camel@laptop> Date: Mon, 18 Jan 2010 13:53:41 +0100 Message-ID: <7c86c4471001180453ueed2839n27f9e44d86ee003d@mail.gmail.com> Subject: Re: [perfmon2] [PATCH] perf: fix the is_software_event() definition From: stephane eranian To: Peter Zijlstra Cc: Frederic Weisbecker , perfmon2-devel@lists.sf.net, linux-kernel@vger.kernel.org, Stephane Eranian , paulus@samba.org, mingo@elte.hu, davem@davemloft.net Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2776 Lines: 71 On Mon, Jan 18, 2010 at 12:53 PM, Peter Zijlstra wrote: > On Mon, 2010-01-18 at 12:13 +0100, Peter Zijlstra wrote: >> On Sun, 2010-01-17 at 15:12 +0100, Frederic Weisbecker wrote: >> >> > You need to also call pmu->disable() if it is a software event, >> > because a breakpoint needs to be unregistered in hardware level >> > too. >> >> breakpoint isn't a software pmu. But yeah, enable and disable need to >> match. > > That is, it shouldn't be a software pmu, because we assume software > events can always be scheduled, whereas that's definitely not so for the > breakpoint one. > > Which seems to suggest the following > > --- > Subject: perf: fix the is_software_event() definition > > When adding the breakpoint pmu Frederic forgot to exclude it from being > a software event. While we're at it, make it an inclusive expression. > > Signed-off-by: Peter Zijlstra > --- >  include/linux/perf_event.h |   10 +++++++--- >  1 files changed, 7 insertions(+), 3 deletions(-) > > diff --git a/include/linux/perf_event.h b/include/linux/perf_event.h > index c66b34f..835ba26 100644 > --- a/include/linux/perf_event.h > +++ b/include/linux/perf_event.h > @@ -814,9 +814,13 @@ extern int perf_event_overflow(struct perf_event *event, int nmi, >  */ >  static inline int is_software_event(struct perf_event *event) >  { > -       return (event->attr.type != PERF_TYPE_RAW) && > -               (event->attr.type != PERF_TYPE_HARDWARE) && > -               (event->attr.type != PERF_TYPE_HW_CACHE); > +       switch (event->attr.type) { > +       case PERF_TYPE_SOFTWARE: > +       case PERF_TYPE_TRACEPOINT: > +       case PERF_TYPE_HW_CACHE: > +               return 1; > +       } > +       return 0; >  } > >  extern atomic_t perf_swevent_enabled[PERF_COUNT_SW_MAX]; > PERF_TYPE_HW_CACHE is a hardware PMU event. > > > ------------------------------------------------------------------------------ > Throughout its 18-year history, RSA Conference consistently attracts the > world's best and brightest in the field, creating opportunities for Conference > attendees to learn about information security's most important issues through > interactions with peers, luminaries and emerging and established companies. > http://p.sf.net/sfu/rsaconf-dev2dev > _______________________________________________ > perfmon2-devel mailing list > perfmon2-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/perfmon2-devel > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/