mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [for-next][PATCH 00/10] tracing: Updates for 6.15
@ 2025-03-23 12:29 Steven Rostedt
  2025-03-23 12:29 ` [for-next][PATCH 01/10] scripts/tracing: Remove scripts/tracing/draw_functrace.py Steven Rostedt
                   ` (9 more replies)
  0 siblings, 10 replies; 14+ messages in thread
From: Steven Rostedt @ 2025-03-23 12:29 UTC (permalink / raw)
  To: linux-kernel
  Cc: Masami Hiramatsu, Mark Rutland, Mathieu Desnoyers, Andrew Morton

  git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace.git
trace/for-next

Head SHA1: 25a5153c91ad23effc44dd349bea749f30208d45


Christophe JAILLET (1):
      tracing: Constify struct event_trigger_ops

Douglas Raillard (3):
      tracing: Align synth event print fmt
      tracing: Ensure module defining synth event cannot be unloaded while tracing
      tracing: Fix synth event printk format for str fields

Gabriele Paoloni (1):
      tracing: fix return value in __ftrace_event_enable_disable for TRACE_REG_UNREGISTER

Huang Shijie (1):
      tracepoint: Print the function symbol when tracepoint_debug is set

Petr Mladek (1):
      tracing: gfp: vsprintf: Do not print "none" when using %pGg printf format

Ran Xiaokai (1):
      tracing/osnoise: Fix possible recursive locking for cpus_read_lock()

Sasha Levin (1):
      tracing: Use hashtable.h for event_hash

Steven Rostedt (1):
      scripts/tracing: Remove scripts/tracing/draw_functrace.py

----
 include/trace/events/mmflags.h      |   2 +-
 kernel/trace/trace.h                |   4 +-
 kernel/trace/trace_eprobe.c         |   6 +-
 kernel/trace/trace_events.c         |   4 +-
 kernel/trace/trace_events_hist.c    |  20 +++---
 kernel/trace/trace_events_synth.c   |  35 +++++++++-
 kernel/trace/trace_events_trigger.c |  38 +++++------
 kernel/trace/trace_osnoise.c        |   1 -
 kernel/trace/trace_output.c         |  19 ++----
 kernel/tracepoint.c                 |   2 +-
 scripts/tracing/draw_functrace.py   | 129 ------------------------------------
 11 files changed, 78 insertions(+), 182 deletions(-)
 delete mode 100755 scripts/tracing/draw_functrace.py

^ permalink raw reply	[flat|nested] 14+ messages in thread
* [PATCH] tracing: Use hashtable.h for event_hash
@ 2025-03-19 19:05 Sasha Levin
  0 siblings, 0 replies; 14+ messages in thread
From: Sasha Levin @ 2025-03-19 19:05 UTC (permalink / raw)
  To: rostedt, mhiramat, mathieu.desnoyers
  Cc: linux-kernel, linux-trace-kernel, Sasha Levin

Convert the event_hash array in trace_output.c to use the generic
hashtable implementation from hashtable.h instead of the manually
implemented hash table.

This simplifies the code and makes it more maintainable by using the
standard hashtable API defined in hashtable.h.

Rename EVENT_HASHSIZE to EVENT_HASH_BITS to properly reflect its new
meaning as the number of bits for the hashtable size.

Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 kernel/trace/trace_output.c | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)

diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c
index 03d56f711ad14..3144d020e6c6f 100644
--- a/kernel/trace/trace_output.c
+++ b/kernel/trace/trace_output.c
@@ -12,15 +12,16 @@
 #include <linux/sched/clock.h>
 #include <linux/sched/mm.h>
 #include <linux/idr.h>
+#include <linux/hashtable.h>
 
 #include "trace_output.h"
 
-/* must be a power of 2 */
-#define EVENT_HASHSIZE	128
+/* 2^7 = 128 */
+#define EVENT_HASH_BITS 7
 
 DECLARE_RWSEM(trace_event_sem);
 
-static struct hlist_head event_hash[EVENT_HASHSIZE] __read_mostly;
+static DEFINE_HASHTABLE(event_hash, EVENT_HASH_BITS);
 
 enum print_line_t trace_print_bputs_msg_only(struct trace_iterator *iter)
 {
@@ -694,11 +695,8 @@ int trace_print_lat_context(struct trace_iterator *iter)
 struct trace_event *ftrace_find_event(int type)
 {
 	struct trace_event *event;
-	unsigned key;
 
-	key = type & (EVENT_HASHSIZE - 1);
-
-	hlist_for_each_entry(event, &event_hash[key], node) {
+	hash_for_each_possible(event_hash, event, node, type) {
 		if (event->type == type)
 			return event;
 	}
@@ -753,7 +751,6 @@ void trace_event_read_unlock(void)
  */
 int register_trace_event(struct trace_event *event)
 {
-	unsigned key;
 	int ret = 0;
 
 	down_write(&trace_event_sem);
@@ -786,9 +783,7 @@ int register_trace_event(struct trace_event *event)
 	if (event->funcs->binary == NULL)
 		event->funcs->binary = trace_nop_print;
 
-	key = event->type & (EVENT_HASHSIZE - 1);
-
-	hlist_add_head(&event->node, &event_hash[key]);
+	hash_add(event_hash, &event->node, event->type);
 
 	ret = event->type;
  out:
@@ -803,7 +798,7 @@ EXPORT_SYMBOL_GPL(register_trace_event);
  */
 int __unregister_trace_event(struct trace_event *event)
 {
-	hlist_del(&event->node);
+	hash_del(&event->node);
 	free_trace_event_type(event->type);
 	return 0;
 }
-- 
2.39.5


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2025-03-23 13:28 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-23 12:29 [for-next][PATCH 00/10] tracing: Updates for 6.15 Steven Rostedt
2025-03-23 12:29 ` [for-next][PATCH 01/10] scripts/tracing: Remove scripts/tracing/draw_functrace.py Steven Rostedt
2025-03-23 12:29 ` [for-next][PATCH 02/10] tracing: Constify struct event_trigger_ops Steven Rostedt
2025-03-23 12:29 ` [for-next][PATCH 03/10] tracepoint: Print the function symbol when tracepoint_debug is set Steven Rostedt
2025-03-23 12:29 ` [for-next][PATCH 04/10] tracing: gfp: vsprintf: Do not print "none" when using %pGg printf format Steven Rostedt
2025-03-23 12:29 ` [for-next][PATCH 05/10] tracing: Use hashtable.h for event_hash Steven Rostedt
2025-03-23 12:39   ` Steven Rostedt
2025-03-23 13:28     ` [PATCH] " Sasha Levin
2025-03-23 12:29 ` [for-next][PATCH 06/10] tracing: Align synth event print fmt Steven Rostedt
2025-03-23 12:29 ` [for-next][PATCH 07/10] tracing/osnoise: Fix possible recursive locking for cpus_read_lock() Steven Rostedt
2025-03-23 12:29 ` [for-next][PATCH 08/10] tracing: fix return value in __ftrace_event_enable_disable for TRACE_REG_UNREGISTER Steven Rostedt
2025-03-23 12:29 ` [for-next][PATCH 09/10] tracing: Ensure module defining synth event cannot be unloaded while tracing Steven Rostedt
2025-03-23 12:29 ` [for-next][PATCH 10/10] tracing: Fix synth event printk format for str fields Steven Rostedt
  -- strict thread matches above, loose matches on Subject: below --
2025-03-19 19:05 [PATCH] tracing: Use hashtable.h for event_hash Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®