trace: osnoise tracer fixes
Subsystems (4)
cover trace: osnoise tracer fixes
Fixes problems reported by kernel test robot <[email protected]>, and a typo in the documentation.
No functional change.
Daniel Bristot de Oliveira (4):
trace/osnoise: Fix 'no previous prototype' warnings trace/osnoise: Make interval u64 on osnoise_main trace/osnoise: Fix return value on osnoise_init_hotplug_support
Documentation: Fix a typo on trace/osnoise-tracer
Documentation/trace/osnoise-tracer.rst | 2 +- arch/x86/kernel/trace.c | 3 --- include/linux/trace.h | 2 ++ kernel/trace/trace_osnoise.c | 24 +++++++++++++----------- 4 files changed, 16 insertions(+), 15 deletions(-)
Signature · 1 line
2.31.1
PATCH 1/4 trace/osnoise: Fix 'no previous prototype' warnings
kernel test robot reported some osnoise functions with "no previous prototype."
Fix these warnings by making local functions static, and by adding:
void osnoise_trace_irq_entry(int id);
void osnoise_trace_irq_exit(int id, const char *desc);
to include/linux/trace.h.
--- arch/x86/kernel/trace.c | 3 --- include/linux/trace.h | 2 ++ kernel/trace/trace_osnoise.c | 20 +++++++++++--------- 3 files changed, 13 insertions(+), 12 deletions(-)
arch/x86/kernel/trace.c +0 -3
@@ -2,9 +2,6 @@#include <linux/trace.h> #if defined(CONFIG_OSNOISE_TRACER ) && defined(CONFIG_X86_LOCAL_APIC ) -extern void osnoise_trace_irq_entry (int id); -extern void osnoise_trace_irq_exit (int id,const char *desc); -/* * trace_intel_irq_entry - record intel specific IRQ entry */
include/linux/trace.h +2 -0
@@ -45,6 +45,8 @@ int trace_array_destroy(struct trace_array *tr);/* For osnoise tracer */ int osnoise_arch_register (void );void osnoise_arch_unregister (void ); +void osnoise_trace_irq_entry (int id); +void osnoise_trace_irq_exit (int id,const char *desc);#endif /* CONFIG_TRACING */
kernel/trace/trace_osnoise.c +11 -9
@@ -736,7 +736,7 @@ void __weak osnoise_arch_unregister(void)* This function hooks the IRQ related callbacks to the respective trace * events. */ -int hook_irq_events (void ) +static int hook_irq_events (void ) {int ret;
@@ -768,7 +768,7 @@ int hook_irq_events(void)* This function unhooks the IRQ related callbacks to the respective trace * events. */ -void unhook_irq_events (void ) +static void unhook_irq_events (void ) {osnoise_arch_unregister ();unregister_trace_irq_handler_exit (trace_irqexit_callback,NULL );
@@ -785,7 +785,7 @@ void unhook_irq_events(void)* arrival time. The delta_start is used to compute the duration at the * softirq exit handler. See cond_move_softirq_delta_start(). */ -void trace_softirq_entry_callback (void *data,unsigned int vec_nr) +static void trace_softirq_entry_callback (void *data,unsigned int vec_nr) {struct osnoise_variables *osn_var =this_cpu_osn_var ();
@@ -808,7 +808,7 @@ void trace_softirq_entry_callback(void *data, unsigned int vec_nr)* Computes the duration of the softirq noise, and trace it. Also discounts the * interference from other sources of noise could be currently being accounted. */ -void trace_softirq_exit_callback (void *data,unsigned int vec_nr) +static void trace_softirq_exit_callback (void *data,unsigned int vec_nr) {struct osnoise_variables *osn_var =this_cpu_osn_var ();int duration;
@@ -949,7 +949,7 @@ thread_exit(struct osnoise_variables *osn_var, struct task_struct *t)* This function is hooked to the sched:sched_switch trace event, and it is * used to record the beginning and to report the end of a thread noise window. */ -void +static void trace_sched_switch_callback (void *data,bool preempt,struct task_struct *p,struct task_struct *n) {
@@ -968,7 +968,7 @@ trace_sched_switch_callback(void *data, bool preempt, struct task_struct *p,* Hook the osnoise tracer callbacks to handle the noise from other * threads on the necessary kernel events. */ -int hook_thread_events (void ) +static int hook_thread_events (void ) {int ret;
@@ -985,7 +985,7 @@ int hook_thread_events(void)* Unook the osnoise tracer callbacks to handle the noise from other * threads on the necessary kernel events. */ -void unhook_thread_events (void ) +static void unhook_thread_events (void ) {unregister_trace_sched_switch (trace_sched_switch_callback,NULL ); }
@@ -997,7 +997,8 @@ void unhook_thread_events(void)* values will be used later to compute the diff betwneen the statistics * before and after the osnoise sampling. */ -void save_osn_sample_stats (struct osnoise_variables *osn_var,struct osnoise_sample *s) +static void +save_osn_sample_stats (struct osnoise_variables *osn_var,struct osnoise_sample *s) { s->nmi_count = osn_var->nmi.count; s->irq_count = osn_var->irq.count;
@@ -1012,7 +1013,8 @@ void save_osn_sample_stats(struct osnoise_variables *osn_var, struct osnoise_sam* statistics. The struct osnoise_sample *s contains the statistics saved via * save_osn_sample_stats() before the osnoise sampling. */ -void diff_osn_sample_stats (struct osnoise_variables *osn_var,struct osnoise_sample *s) +static void +diff_osn_sample_stats (struct osnoise_variables *osn_var,struct osnoise_sample *s) { s->nmi_count = osn_var->nmi.count - s->nmi_count; s->irq_count = osn_var->irq.count - s->irq_count;
Signature · 1 line
2.31.1
PATCH 2/4 trace/osnoise: Make interval u64 on osnoise_main
In reply to Daniel Bristot de Oliveirakernel test robot reported:
Quoted 1 line
Quoted 1 line
kernel/trace/trace_osnoise.c:966:3: warning: comparison of distinct
pointer types ('typeof ((interval)) *' (aka 'long long *') and
'uint64_t *' (aka 'unsigned long long *'))
[-Wcompare-distinct-pointer-types]
do_div(interval, USEC_PER_MSEC);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
include/asm-generic/div64.h:228:28: note: expanded from macro 'do_div'
(void)(((typeof((n)) *)0) == ((uint64_t *)0)); \
~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~As interval cannot be negative because sample_period >= sample_runtime, making interval u64 on osnoise_main() is enough to fix this problem.
--- kernel/trace/trace_osnoise.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/trace_osnoise.c +1 -1
@@ -1202,7 +1202,7 @@ static struct cpumask save_cpumask;*/ static int osnoise_main (void *data) { -s64 interval; +u64 interval;while (!kthread_should_stop ()) {
Signature · 1 line
2.31.1
PATCH 3/4 trace/osnoise: Fix return value on osnoise_init_hotplug_support
In reply to Daniel Bristot de Oliveirakernel test robot reported:
Quoted 1 line
Quoted 1 line
kernel/trace/trace_osnoise.c:1584:2: error: void function
'osnoise_init_hotplug_support' should not return a value [-Wreturn-type]
return 0;
When !CONFIG_HOTPLUG_CPU.
Fix it problem by removing the return value.
--- kernel/trace/trace_osnoise.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/trace_osnoise.c +1 -1
@@ -1583,7 +1583,7 @@ static void osnoise_init_hotplug_support(void)#else /* CONFIG_HOTPLUG_CPU */ static void osnoise_init_hotplug_support (void ) { -return 0 ; +return ; }#endif /* CONFIG_HOTPLUG_CPU */
Signature · 1 line
2.31.1
PATCH 4/4 Documentation: Fix a typo on trace/osnoise-tracer
In reply to Daniel Bristot de Oliveiras/RUNTIME IN USE/RUNTIME IN US/
--- Documentation/trace/osnoise-tracer.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/trace/osnoise-tracer.rst +1 -1
@@ -77,7 +77,7 @@ In addition to the regular trace fields (from TASK-PID to TIMESTAMP), the tracer prints a message at the end of each period for each CPU that is running an osnoise/ thread. The osnoise specific fields report: - - The RUNTIME IN USE reports the amount of time in microseconds that + - The RUNTIME IN US reports the amount of time in microseconds that the osnoise thread kept looping reading the time. - The NOISE IN US reports the sum of noise in microseconds observed by the osnoise tracer during the associated runtime.
Signature · 1 line
2.31.1