public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Frederic Weisbecker <fweisbec@gmail.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Paul Mackerras <paulus@samba.org>,
	Prasad <prasad@linux.vnet.ibm.com>
Subject: [PATCH 2/4] hw-breakpoints: Check the breakpoint params from perf tools
Date: Mon, 23 Nov 2009 15:42:33 +0100	[thread overview]
Message-ID: <1258987355-8751-2-git-send-email-fweisbec@gmail.com> (raw)
In-Reply-To: <1258987355-8751-1-git-send-email-fweisbec@gmail.com>

Perf tools create perf events as disabled in the beginning. Breakpoints
are then considered like ptrace temporary breakpoints, only meant to
reserve a breakpoint slot until we get all the necessary informations
from the user.

In this case, we don't check the address that is breakpointed as it is
NULL in the ptrace case.

But perf tools don't have the same purpose, events are created disabled
to wait for all events to be created before enabling all of them.
We want to check the breakpoint parameters in this case.

Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Prasad <prasad@linux.vnet.ibm.com>
---
 kernel/hw_breakpoint.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/kernel/hw_breakpoint.c b/kernel/hw_breakpoint.c
index b6d6fa2..1d8911a 100644
--- a/kernel/hw_breakpoint.c
+++ b/kernel/hw_breakpoint.c
@@ -263,7 +263,16 @@ int __register_perf_hw_breakpoint(struct perf_event *bp)
 	if (ret)
 		return ret;
 
-	if (!bp->attr.disabled)
+	/*
+	 * Ptrace breakpoints can be temporary perf events only
+	 * meant to reserve a slot. In this case, it is created disabled and
+	 * we don't want to check the params right now (as we put a null addr)
+	 * But perf tools create events as disabled and we want to check
+	 * the params for them.
+	 * This is a quick hack that will be removed soon, once we remove
+	 * the tmp breakpoints from ptrace
+	 */
+	if (!bp->attr.disabled || bp->callback == perf_bp_event)
 		ret = arch_validate_hwbkpt_settings(bp, bp->ctx->task);
 
 	return ret;
-- 
1.6.2.3


  reply	other threads:[~2009-11-23 14:42 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-23 14:42 [PATCH 1/4] hw-breakpoints: Include only linux/perf_event.h from kernel part of bp headers Frederic Weisbecker
2009-11-23 14:42 ` Frederic Weisbecker [this message]
2009-11-23 17:43   ` [tip:perf/core] hw-breakpoints: Check the breakpoint params from perf tools tip-bot for Frederic Weisbecker
2009-11-23 14:42 ` [PATCH 3/4] perf: Add kernel side syscall events support for breakpoints Frederic Weisbecker
2009-11-23 17:43   ` [tip:perf/core] " tip-bot for Frederic Weisbecker
2009-11-23 14:42 ` [PATCH 4/4] perf tools: Add support for breakpoint events in perf tools Frederic Weisbecker
2009-11-23 17:36   ` K.Prasad
2009-11-23 20:25     ` Frederic Weisbecker
2009-11-23 21:09       ` Arnaldo Carvalho de Melo
2009-11-23 21:19         ` Frederic Weisbecker
2009-11-23 21:25           ` Ingo Molnar
2009-11-23 21:25           ` Arnaldo Carvalho de Melo
2009-11-23 17:38   ` Ingo Molnar
2009-11-23 17:44   ` [tip:perf/core] " tip-bot for Frederic Weisbecker
2009-11-23 17:43 ` [tip:perf/core] hw-breakpoints: Include only linux/perf_event.h from kernel part of bp headers tip-bot for Frederic Weisbecker

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=1258987355-8751-2-git-send-email-fweisbec@gmail.com \
    --to=fweisbec@gmail.com \
    --cc=acme@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.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