Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756755Ab0BCJOu (ORCPT ); Wed, 3 Feb 2010 04:14:50 -0500 Received: from mail-bw0-f219.google.com ([209.85.218.219]:38151 "EHLO mail-bw0-f219.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753102Ab0BCJOm (ORCPT ); Wed, 3 Feb 2010 04:14:42 -0500 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=RDyNCTL2EmvSI48JZwpH9kChJz7xs9YefkdM6GyrBdyEN9A5WpXfjAOft2xQRLNgTY a7ZeB+q4EIETx81NXvK71vse0PRYUv3TjKi2Dmv0lrZVLtbuCDyb3v2PNqzcFuRDjdDF IA62BTwzMSjEd+L7O3Ix7M+rCtD5y9gcms4po= From: Frederic Weisbecker To: Ingo Molnar Cc: LKML , Frederic Weisbecker , Peter Zijlstra , Arnaldo Carvalho de Melo , Steven Rostedt , Paul Mackerras , Hitoshi Mitake , Li Zefan , Lai Jiangshan , Masami Hiramatsu , Jens Axboe Subject: [PATCH 03/11] tracing: Inject lock_class_init events on registration Date: Wed, 3 Feb 2010 10:14:27 +0100 Message-Id: <1265188475-23509-4-git-send-regression-fweisbec@gmail.com> X-Mailer: git-send-email 1.6.2.3 In-Reply-To: <1265188475-23509-1-git-send-regression-fweisbec@gmail.com> References: <1265188475-23509-1-git-send-regression-fweisbec@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2889 Lines: 96 When a user enables the lock_class_init event, automatically inject the existing mapping of lock_class_id:name that lockdep have stored. This will help the user to retrieve the name of the lock classes from the other lock events, once we'll remove the name inside. Signed-off-by: Frederic Weisbecker Cc: Peter Zijlstra Cc: Arnaldo Carvalho de Melo Cc: Steven Rostedt Cc: Paul Mackerras Cc: Hitoshi Mitake Cc: Li Zefan Cc: Lai Jiangshan Cc: Masami Hiramatsu Cc: Jens Axboe --- include/linux/lockdep.h | 4 ++++ include/trace/events/lock.h | 11 +++++++++-- kernel/lockdep.c | 12 ++++++++++++ 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/include/linux/lockdep.h b/include/linux/lockdep.h index 9ccf0e2..0b662fc 100644 --- a/include/linux/lockdep.h +++ b/include/linux/lockdep.h @@ -323,6 +323,10 @@ extern void lockdep_trace_alloc(gfp_t mask); #define lockdep_assert_held(l) WARN_ON(debug_locks && !lockdep_is_held(l)) +#ifdef CONFIG_EVENT_TRACING +extern void lock_class_init_inject_events(void); +#endif + #else /* !LOCKDEP */ static inline void lockdep_off(void) diff --git a/include/trace/events/lock.h b/include/trace/events/lock.h index 90af03c..6999f16 100644 --- a/include/trace/events/lock.h +++ b/include/trace/events/lock.h @@ -9,7 +9,7 @@ #ifdef CONFIG_LOCKDEP -TRACE_EVENT(lock_class_init, +TRACE_EVENT_INJECT(lock_class_init, TP_PROTO(struct lock_class *class), @@ -30,7 +30,14 @@ TRACE_EVENT(lock_class_init, __entry->class_id = (void *)class->name; ), - TP_printk("%p %s", __entry->class_id, __get_str(class_name)) + TP_printk("%p %s", __entry->class_id, __get_str(class_name)), + + /* + * On activation, we want to send an event for each lock + * classes that have been recorded by lockdep, so that we + * catch up with the existing class:name mappings. + */ + lock_class_init_inject_events ); TRACE_EVENT(lock_acquire, diff --git a/kernel/lockdep.c b/kernel/lockdep.c index 43758dd..4d9eef8 100644 --- a/kernel/lockdep.c +++ b/kernel/lockdep.c @@ -3813,3 +3813,15 @@ void lockdep_sys_exit(void) lockdep_print_held_locks(curr); } } + + +#ifdef CONFIG_EVENT_TRACING +void lock_class_init_inject_events(void) +{ + struct lock_class *class; + + /* Safe to be taken locklessly as it only moves forward */ + list_for_each_entry(class, &all_lock_classes, lock_entry) + trace_lock_class_init(class); +} +#endif -- 1.6.2.3 -- 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/