linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jovi Zhang <bookjovi@gmail.com>
To: Michael Neuling <mikey@neuling.org>
Cc: K Prasad <prasad@linux.vnet.ibm.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	linux-kernel@vger.kernel.org, linuxppc-dev@ozlabs.org,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Ingo Molnar <mingo@kernel.org>,
	Namhyung Kim <namhyung@kernel.org>
Subject: Re: powerpc/perf: hw breakpoints return ENOSPC
Date: Thu, 27 Sep 2012 09:02:43 +0800	[thread overview]
Message-ID: <CACV3sbKZ1B2qOFPC7WJ7k28FbcSV-cWk=OA4f7Fy5mdLRfZEhA@mail.gmail.com> (raw)
In-Reply-To: <28857.1345091034@neuling.org>

On Thu, Aug 16, 2012 at 12:23 PM, Michael Neuling <mikey@neuling.org> wrote:
> Hi,
>
> I've been trying to get hardware breakpoints with perf to work on POWER7
> but I'm getting the following:
>
>   % perf record -e mem:0x10000000 true
>
>     Error: sys_perf_event_open() syscall returned with 28 (No space left on device).  /bin/dmesg may provide additional information.
>
>     Fatal: No CONFIG_PERF_EVENTS=y kernel support configured?
>
>   true: Terminated
>
> (FWIW adding -a and it works fine)
>
> Debugging it seems that __reserve_bp_slot() is returning ENOSPC because
> it thinks there are no free breakpoint slots on this CPU.
>
> I have a 2 CPUs, so perf userspace is doing two perf_event_open syscalls
> to add a counter to each CPU [1].  The first syscall succeeds but the
> second is failing.
>
> On this second syscall, fetch_bp_busy_slots() sets slots.pinned to be 1,
> despite there being no breakpoint on this CPU.  This is because the call
> the task_bp_pinned, checks all CPUs, rather than just the current CPU.
> POWER7 only has one hardware breakpoint per CPU (ie. HBP_NUM=1), so we
> return ENOSPC.
>
> The following patch fixes this by checking the associated CPU for each
> breakpoint in task_bp_pinned.  I'm not familiar with this code, so it's
> provided as a reference to the above issue.
>
> Mikey
>
> 1. not sure why it doesn't just do one syscall and specify all CPUs, but
> that's another issue.  Using two syscalls should work.
>
This problem let me recall what I reported several months ago.

https://lkml.org/lkml/2012/6/27/631

At that time, I thought it is caused by uses_mmap field in record sub
command which
added by commit d1cb9f(perf target: Add uses_mmap field).

In that testcase, it's fine to use stat sub command, but failed with
record sub command.

As Namhyung metioned in that thread, [perf record xxx] use
per-task-per-cpu for fix
scalability issues.

      parent reply	other threads:[~2012-09-27  1:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-16  4:23 powerpc/perf: hw breakpoints return ENOSPC Michael Neuling
2012-08-16  7:40 ` Peter Zijlstra
2012-08-16 11:17   ` Michael Neuling
2012-08-16 11:44     ` Peter Zijlstra
2012-08-16 14:02       ` Michael Ellerman
2012-08-16 14:15         ` Peter Zijlstra
2012-08-17  1:20           ` Michael Ellerman
2012-08-16 23:34       ` Michael Neuling
2012-08-17 16:15 ` Frederic Weisbecker
2012-08-17 21:58   ` Michael Neuling
2012-09-25  7:10     ` Michael Neuling
2012-09-27 15:23       ` Frederic Weisbecker
2012-09-27  1:02 ` Jovi Zhang [this message]

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='CACV3sbKZ1B2qOFPC7WJ7k28FbcSV-cWk=OA4f7Fy5mdLRfZEhA@mail.gmail.com' \
    --to=bookjovi@gmail.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=mikey@neuling.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.org \
    --cc=prasad@linux.vnet.ibm.com \
    /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;
as well as URLs for NNTP newsgroup(s).