public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: eranian@gmail.com
Cc: linux-kernel@vger.kernel.org, mingo@elte.hu, paulus@samba.org,
	perfmon2-devel@lists.sf.net, eranian@google.com
Subject: Re: [PATCH] perf_events: fix validate_event bug
Date: Mon, 23 Nov 2009 14:45:53 +0100	[thread overview]
Message-ID: <1258983953.4531.456.camel@laptop> (raw)
In-Reply-To: <7c86c4470911230534i4119734k1478550567852220@mail.gmail.com>

On Mon, 2009-11-23 at 14:34 +0100, stephane eranian wrote:

> > Won't this give very funny results for mixed pmu groups?
> >
> 
> What do you mean by 'mixed pmu groups'?

We currently have a number of struct pmu objects:

 perf_ops_generic
 perf_ops_cpu_clock
 perf_ops_task_clock

which are all software based PMUs, and one of:

 pmu        (arch/x86/kernel/cpu/perf_event.c)
 power_pmu  (arch/powerpc/kernel/perf_event.c)

To represent the hardware PMU.

Now say you mix software events and hardware events into a single group,
the loop in validate_group:

  list_for_each_entry(sibling, &leader->sibling_list, group_entry) {
	if (!validate_event(&fake_pmu, sibling))
			return -ENOSPC;
  }

could pass a !hardware event into validate_event(), which currently
ignores it because event->pmu won't be &pmu, however if you remove that
check, it'll try and call x86 routines on a software event, which is
bound to go funny.

Now Frederic is going to make things more interesting by representing HW
breakpoints as another HW PMU (the distinction between hw/sw pmu is in
scheduling, you can always schedule a software event).

This weakens the !is_software_event(), in that !software doesn't tell
you which hardware event it is -- something which needs mending in your
more complex x86 constraints scheduling patch.


  reply	other threads:[~2009-11-23 13:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-22 14:51 [PATCH] perf_events: fix validate_event bug Stephane Eranian
2009-11-18 16:46 ` Peter Zijlstra
2009-11-23 13:34   ` stephane eranian
2009-11-23 13:45     ` Peter Zijlstra [this message]
2009-11-24 13:18       ` stephane eranian
2009-11-24 22:00         ` Paul Mackerras
2009-11-25  5:47           ` stephane eranian
2009-11-25  7:55             ` Peter Zijlstra
2009-11-24 13:27 ` Stephane Eranian
2009-11-24 19:03   ` [tip:perf/core] perf_events, x86: Fix " tip-bot for 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=1258983953.4531.456.camel@laptop \
    --to=peterz@infradead.org \
    --cc=eranian@gmail.com \
    --cc=eranian@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=perfmon2-devel@lists.sf.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