From f4708a82dc45fbf08bd3c68fc3eb32397e9121a1 Mon Sep 17 00:00:00 2001 From: "Guilherme G. Piccoli" Date: Tue, 14 Mar 2023 17:00:58 -0300 Subject: notifiers: add tracepoints to the notifiers infrastructure Currently there is no way to show the callback names for registered, unregistered or executed notifiers. This is very useful for debug purposes, hence add this functionality here in the form of notifiers' tracepoints, one per operation. [akpm@linux-foundation.org: coding-style cleanups] Link: https://lkml.kernel.org/r/20230314200058.1326909-1-gpiccoli@igalia.com Signed-off-by: Guilherme G. Piccoli Cc: Arjan van de Ven Cc: Michael Kelley Cc: Steven Rostedt Cc: Xiaoming Ni Cc: Baoquan He Cc: Cong Wang Cc: Dmitry Osipenko Cc: Guilherme G. Piccoli Cc: Guilherme G. Piccoli Cc: Petr Mladek Cc: Rafael J. Wysocki Cc: Sebastian Andrzej Siewior Cc: Valentin Schneider Signed-off-by: Andrew Morton --- kernel/notifier.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'kernel/notifier.c') diff --git a/kernel/notifier.c b/kernel/notifier.c index d353e4b5402d..b3ce28f39eb6 100644 --- a/kernel/notifier.c +++ b/kernel/notifier.c @@ -7,6 +7,9 @@ #include #include +#define CREATE_TRACE_POINTS +#include + /* * Notifier list for kernel code which wants to be called * at shutdown. This is used to stop any idling DMA operations @@ -37,6 +40,7 @@ static int notifier_chain_register(struct notifier_block **nl, } n->next = *nl; rcu_assign_pointer(*nl, n); + trace_notifier_register((void *)n->notifier_call); return 0; } @@ -46,6 +50,7 @@ static int notifier_chain_unregister(struct notifier_block **nl, while ((*nl) != NULL) { if ((*nl) == n) { rcu_assign_pointer(*nl, n->next); + trace_notifier_unregister((void *)n->notifier_call); return 0; } nl = &((*nl)->next); @@ -84,6 +89,7 @@ static int notifier_call_chain(struct notifier_block **nl, continue; } #endif + trace_notifier_run((void *)nb->notifier_call); ret = nb->notifier_call(nb, val, v); if (nr_calls) -- cgit v1.2.3