All of lore.kernel.org
 help / color / mirror / Atom feed
From: Will Deacon <will.deacon@arm.com>
To: Stephen Boyd <sboyd@codeaurora.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-arm-msm@vger.kernel.org" <linux-arm-msm@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	Neil Leeder <nleeder@codeaurora.org>,
	Ashwin Chaugule <ashwinc@codeaurora.org>
Subject: Re: [PATCH v2 5/7] ARM: perf_event: Fully support Krait CPU PMU events
Date: Wed, 22 Jan 2014 10:58:40 +0000	[thread overview]
Message-ID: <20140122105840.GD1621@mudshark.cambridge.arm.com> (raw)
In-Reply-To: <52DEEDDA.4060302@codeaurora.org>

On Tue, Jan 21, 2014 at 09:59:54PM +0000, Stephen Boyd wrote:
> On 01/21/14 10:37, Stephen Boyd wrote:
> > On 01/21/14 10:07, Will Deacon wrote:
> >> Finally, I'd really like to see this get some test coverage, but I don't
> >> want to try running mainline on my phone :) Could you give your patches a
> >> spin with Vince's perf fuzzer please?
> >>
> >>   https://github.com/deater/perf_event_tests.git
> >>
> >> (then build the contents of the fuzzer directory and run it for as long as
> >> you can).
> >>
> > Ok. I'll see what I can do.
> 
> Neat. This quickly discovered a problem.

Yeah, the fuzzer is good at that!

> BUG: using smp_processor_id() in preemptible [00000000] code: perf_fuzzer/70
> caller is krait_pmu_get_event_idx+0x58/0xd8
> CPU: 2 PID: 70 Comm: perf_fuzzer Not tainted 3.13.0-rc7-next-20140108-00041-gb038353c8516-dirty #58
> [<c02165dc>] (unwind_backtrace) from [<c0212ffc>] (show_stack+0x10/0x14)
> [<c0212ffc>] (show_stack) from [<c06ad5fc>] (dump_stack+0x6c/0xb8)
> [<c06ad5fc>] (dump_stack) from [<c04b0928>] (debug_smp_processor_id+0xc4/0xe8)
> [<c04b0928>] (debug_smp_processor_id) from [<c021a19c>] (krait_pmu_get_event_idx+0x58/0xd8)
> [<c021a19c>] (krait_pmu_get_event_idx) from [<c021833c>] (validate_event+0x2c/0x54)
> [<c021833c>] (validate_event) from [<c02186b4>] (armpmu_event_init+0x264/0x2dc)
> [<c02186b4>] (armpmu_event_init) from [<c02b28e4>] (perf_init_event+0x138/0x194)
> [<c02b28e4>] (perf_init_event) from [<c02b2c04>] (perf_event_alloc+0x2c4/0x348)
> [<c02b2c04>] (perf_event_alloc) from [<c02b37e4>] (SyS_perf_event_open+0x7b8/0x9cc)
> [<c02b37e4>] (SyS_perf_event_open) from [<c020ef80>] (ret_fast_syscall+0x0/0x48)
> 
> This is happening because the pmresrn_used mask is per-cpu but
> validate_group() is called in preemptible context. It looks like we'll
> need to add another unsigned long * field to struct pmu_hw_events just
> for Krait purposes? Or we could use the upper 16 bits of the used_mask
> bitmap to hold the pmresr_used values? Sounds sort of hacky but it
> avoids adding another bitmap for every PMU user and there aren't any
> Krait CPUs with more than 5 counters anyway.

I'm fine with that approach, but a comment saying what we're doing with
those upper bits wouldn't go amiss.

> This is the diff for the latter version. I'll let the fuzzer run overnight.

Cheers,

Will

WARNING: multiple messages have this Message-ID (diff)
From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 5/7] ARM: perf_event: Fully support Krait CPU PMU events
Date: Wed, 22 Jan 2014 10:58:40 +0000	[thread overview]
Message-ID: <20140122105840.GD1621@mudshark.cambridge.arm.com> (raw)
In-Reply-To: <52DEEDDA.4060302@codeaurora.org>

On Tue, Jan 21, 2014 at 09:59:54PM +0000, Stephen Boyd wrote:
> On 01/21/14 10:37, Stephen Boyd wrote:
> > On 01/21/14 10:07, Will Deacon wrote:
> >> Finally, I'd really like to see this get some test coverage, but I don't
> >> want to try running mainline on my phone :) Could you give your patches a
> >> spin with Vince's perf fuzzer please?
> >>
> >>   https://github.com/deater/perf_event_tests.git
> >>
> >> (then build the contents of the fuzzer directory and run it for as long as
> >> you can).
> >>
> > Ok. I'll see what I can do.
> 
> Neat. This quickly discovered a problem.

Yeah, the fuzzer is good at that!

> BUG: using smp_processor_id() in preemptible [00000000] code: perf_fuzzer/70
> caller is krait_pmu_get_event_idx+0x58/0xd8
> CPU: 2 PID: 70 Comm: perf_fuzzer Not tainted 3.13.0-rc7-next-20140108-00041-gb038353c8516-dirty #58
> [<c02165dc>] (unwind_backtrace) from [<c0212ffc>] (show_stack+0x10/0x14)
> [<c0212ffc>] (show_stack) from [<c06ad5fc>] (dump_stack+0x6c/0xb8)
> [<c06ad5fc>] (dump_stack) from [<c04b0928>] (debug_smp_processor_id+0xc4/0xe8)
> [<c04b0928>] (debug_smp_processor_id) from [<c021a19c>] (krait_pmu_get_event_idx+0x58/0xd8)
> [<c021a19c>] (krait_pmu_get_event_idx) from [<c021833c>] (validate_event+0x2c/0x54)
> [<c021833c>] (validate_event) from [<c02186b4>] (armpmu_event_init+0x264/0x2dc)
> [<c02186b4>] (armpmu_event_init) from [<c02b28e4>] (perf_init_event+0x138/0x194)
> [<c02b28e4>] (perf_init_event) from [<c02b2c04>] (perf_event_alloc+0x2c4/0x348)
> [<c02b2c04>] (perf_event_alloc) from [<c02b37e4>] (SyS_perf_event_open+0x7b8/0x9cc)
> [<c02b37e4>] (SyS_perf_event_open) from [<c020ef80>] (ret_fast_syscall+0x0/0x48)
> 
> This is happening because the pmresrn_used mask is per-cpu but
> validate_group() is called in preemptible context. It looks like we'll
> need to add another unsigned long * field to struct pmu_hw_events just
> for Krait purposes? Or we could use the upper 16 bits of the used_mask
> bitmap to hold the pmresr_used values? Sounds sort of hacky but it
> avoids adding another bitmap for every PMU user and there aren't any
> Krait CPUs with more than 5 counters anyway.

I'm fine with that approach, but a comment saying what we're doing with
those upper bits wouldn't go amiss.

> This is the diff for the latter version. I'll let the fuzzer run overnight.

Cheers,

Will

  reply	other threads:[~2014-01-22 10:59 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-15 17:55 [PATCH v2 0/7] Support Krait CPU PMUs Stephen Boyd
2014-01-15 17:55 ` Stephen Boyd
2014-01-15 17:55 ` [PATCH v2 1/7] ARM: perf_event: Support percpu irqs for the CPU PMU Stephen Boyd
2014-01-15 17:55   ` Stephen Boyd
2014-01-15 20:54   ` Stephen Boyd
2014-01-15 20:54     ` Stephen Boyd
2014-01-17 15:04     ` Will Deacon
2014-01-17 15:04       ` Will Deacon
2014-01-17 17:54       ` Stephen Boyd
2014-01-17 17:54         ` Stephen Boyd
2014-01-17 18:08         ` Will Deacon
2014-01-17 18:08           ` Will Deacon
2014-02-07 11:30         ` Will Deacon
2014-02-07 11:30           ` Will Deacon
2014-02-07 11:30           ` Will Deacon
2014-02-03 20:31   ` Christopher Covington
2014-02-03 20:31     ` Christopher Covington
2014-01-15 17:55 ` [PATCH v2 2/7] ARM: perf_event: Assign pdev pointer earlier for CPU PMUs Stephen Boyd
2014-01-15 17:55   ` Stephen Boyd
2014-01-15 17:55 ` [PATCH v2 3/7] ARM: perf_event: Add basic support for Krait " Stephen Boyd
2014-01-15 17:55   ` Stephen Boyd
2014-01-15 17:55 ` [PATCH v2 4/7] ARM: perf_event: Add hook for event index clearing Stephen Boyd
2014-01-15 17:55   ` Stephen Boyd
2014-01-15 17:55 ` [PATCH v2 5/7] ARM: perf_event: Fully support Krait CPU PMU events Stephen Boyd
2014-01-15 17:55   ` Stephen Boyd
2014-01-21 18:07   ` Will Deacon
2014-01-21 18:07     ` Will Deacon
2014-01-21 18:37     ` Stephen Boyd
2014-01-21 18:37       ` Stephen Boyd
2014-01-21 21:59       ` Stephen Boyd
2014-01-21 21:59         ` Stephen Boyd
2014-01-22 10:58         ` Will Deacon [this message]
2014-01-22 10:58           ` Will Deacon
2014-01-22 20:47       ` Stephen Boyd
2014-01-22 20:47         ` Stephen Boyd
2014-01-23 10:32         ` Will Deacon
2014-01-23 10:32           ` Will Deacon
     [not found] ` <1389808535-23852-1-git-send-email-sboyd-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2014-01-15 17:55   ` [PATCH v2 6/7] devicetree: bindings: Document Krait performance monitor units (PMU) Stephen Boyd
2014-01-15 17:55     ` Stephen Boyd
2014-01-15 17:55     ` Stephen Boyd
2014-01-15 17:55 ` [PATCH v2 7/7] ARM: dts: msm: Add krait-pmu to platforms with Krait CPUs Stephen Boyd
2014-01-15 17:55   ` Stephen Boyd

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=20140122105840.GD1621@mudshark.cambridge.arm.com \
    --to=will.deacon@arm.com \
    --cc=ashwinc@codeaurora.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nleeder@codeaurora.org \
    --cc=sboyd@codeaurora.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.