lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1265188475-23509-2-git-send-regression-fweisbec@gmail.com>
Date:	Wed,  3 Feb 2010 10:14:25 +0100
From:	Frederic Weisbecker <fweisbec@...il.com>
To:	Ingo Molnar <mingo@...e.hu>
Cc:	LKML <linux-kernel@...r.kernel.org>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Peter Zijlstra <peterz@...radead.org>,
	Arnaldo Carvalho de Melo <acme@...hat.com>,
	Steven Rostedt <rostedt@...dmis.org>,
	Paul Mackerras <paulus@...ba.org>,
	Hitoshi Mitake <mitake@....info.waseda.ac.jp>,
	Li Zefan <lizf@...fujitsu.com>,
	Lai Jiangshan <laijs@...fujitsu.com>,
	Masami Hiramatsu <mhiramat@...hat.com>,
	Jens Axboe <jens.axboe@...cle.com>
Subject: [PATCH 01/11] tracing: Add lock_class_init event

Add a lock_class_init event that brings informations about a
new lock class that gets created.

This event is required for the following plans:

- We want to get rid of the lock name copy from each high freq
  lock events.
- But we want to be able to retrieve it from post-processing
- We also want to be able to map the lock instances to their
  corresponding lock classes. Instrumenting the locks can
  make sense in both class and instance level, depending on
  the desired level of details.

This new event will make us able to map a lock class to its name.
It is also planned to drop the name from the other lock events
but to keep the lock instance id and to add the lock class id
to the lock_acquire event (which marks the beginning of a lock
scenario).

With such layout, we can basically retrieve the lock instance,
class and name from every locking sequence.

Signed-off-by: Frederic Weisbecker <fweisbec@...il.com>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Arnaldo Carvalho de Melo <acme@...hat.com>
Cc: Steven Rostedt <rostedt@...dmis.org>
Cc: Paul Mackerras <paulus@...ba.org>
Cc: Hitoshi Mitake <mitake@....info.waseda.ac.jp>
Cc: Li Zefan <lizf@...fujitsu.com>
Cc: Lai Jiangshan <laijs@...fujitsu.com>
Cc: Masami Hiramatsu <mhiramat@...hat.com>
Cc: Jens Axboe <jens.axboe@...cle.com>
---
 include/trace/events/lock.h |   24 ++++++++++++++++++++++++
 kernel/lockdep.c            |    4 ++++
 2 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/include/trace/events/lock.h b/include/trace/events/lock.h
index 5c1dcfc..90af03c 100644
--- a/include/trace/events/lock.h
+++ b/include/trace/events/lock.h
@@ -9,6 +9,30 @@
 
 #ifdef CONFIG_LOCKDEP
 
+TRACE_EVENT(lock_class_init,
+
+	TP_PROTO(struct lock_class *class),
+
+	TP_ARGS(class),
+
+	TP_STRUCT__entry(
+		__string(class_name, class->name)
+		__field(void *, class_id)
+	),
+
+	/*
+	 * The pointer to the class name is shared between a lock instance
+	 * (lockdep_map) and its lock class. So we can use the name pointer
+	 * as a class id and as a link between an instance and its class.
+	 */
+	TP_fast_assign(
+		__assign_str(class_name, class->name);
+		__entry->class_id = (void *)class->name;
+	),
+
+	TP_printk("%p %s", __entry->class_id, __get_str(class_name))
+);
+
 TRACE_EVENT(lock_acquire,
 
 	TP_PROTO(struct lockdep_map *lock, unsigned int subclass,
diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index 5feaddc..43758dd 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -757,6 +757,7 @@ register_lock_class(struct lockdep_map *lock, unsigned int subclass, int force)
 		dump_stack();
 		return NULL;
 	}
+
 	class = lock_classes + nr_lock_classes++;
 	debug_atomic_inc(&nr_unused_locks);
 	class->key = key;
@@ -766,6 +767,9 @@ register_lock_class(struct lockdep_map *lock, unsigned int subclass, int force)
 	INIT_LIST_HEAD(&class->locks_before);
 	INIT_LIST_HEAD(&class->locks_after);
 	class->name_version = count_matching_names(class);
+
+	trace_lock_class_init(class);
+
 	/*
 	 * We use RCU's safe list-add method to make
 	 * parallel walking of the hash-list safe:
-- 
1.6.2.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ