linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [for-next][PATCH 0/6] tracing: Minor fixes
@ 2021-06-29 11:48 Steven Rostedt
  2021-06-29 11:48 ` [for-next][PATCH 1/6] tracing: Have osnoise_main() add a quiescent state for task rcu Steven Rostedt
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Steven Rostedt @ 2021-06-29 11:48 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton

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

Head SHA1: b62613b431bdababc90bf1440b2c7427172d94f4


Colin Ian King (1):
      tracing: Fix spelling in osnoise tracer "interferences" -> "interference"

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

Steven Rostedt (VMware) (1):
      tracing: Have osnoise_main() add a quiescent state for task rcu

----
 Documentation/trace/osnoise-tracer.rst |  2 +-
 arch/x86/kernel/trace.c                |  3 ---
 include/linux/trace.h                  |  2 ++
 include/trace/events/osnoise.h         |  2 +-
 kernel/trace/trace_osnoise.c           | 29 +++++++++++++++++------------
 5 files changed, 21 insertions(+), 17 deletions(-)

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

* [for-next][PATCH 1/6] tracing: Have osnoise_main() add a quiescent state for task rcu
  2021-06-29 11:48 [for-next][PATCH 0/6] tracing: Minor fixes Steven Rostedt
@ 2021-06-29 11:48 ` Steven Rostedt
  2021-06-29 11:48 ` [for-next][PATCH 2/6] trace/osnoise: Fix no previous prototype warnings Steven Rostedt
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Steven Rostedt @ 2021-06-29 11:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ingo Molnar, Andrew Morton, Paul E. McKenney, Daniel Bristot de Oliveira

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

ftracetest triggered:

 INFO: rcu_tasks detected stalls on tasks:
 00000000b92b832d: .. nvcsw: 1/1 holdout: 1 idle_cpu: -1/7
 task:osnoise/7       state:R  running task     stack:    0 pid: 2133 ppid:     2 flags:0x00004000
 Call Trace:
  ? asm_sysvec_apic_timer_interrupt+0x12/0x20
  ? asm_sysvec_apic_timer_interrupt+0x12/0x20
  ? trace_hardirqs_on+0x2b/0xe0
  ? asm_sysvec_apic_timer_interrupt+0x12/0x20
  ? trace_clock_local+0xc/0x20
  ? osnoise_main+0x10e/0x450
  ? trace_softirq_entry_callback+0x50/0x50
  ? kthread+0x153/0x170
  ? __kthread_bind_mask+0x60/0x60
  ? ret_from_fork+0x22/0x30

While running osnoise tracer with other tracers that rely on
synchronize_rcu_tasks(), where that just hung.

The reason is that osnoise_main() never schedules out if the interval
is less than 1, and this will cause synchronize_rcu_tasks() to never
return.

Link: https://lkml.kernel.org/r/20210628114953.6dc06a91@oasis.local.home

Fixes: bce29ac9ce0bb ("trace: Add osnoise tracer")
Acked-by: Paul E. McKenney <paulmck@kernel.org>
Reviewed-by: Daniel Bristot de Oliveira <bristot@redhat.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 kernel/trace/trace_osnoise.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/kernel/trace/trace_osnoise.c b/kernel/trace/trace_osnoise.c
index 38aa5e208ffd..556d530af805 100644
--- a/kernel/trace/trace_osnoise.c
+++ b/kernel/trace/trace_osnoise.c
@@ -1216,8 +1216,11 @@ static int osnoise_main(void *data)
 		 * differently from hwlat_detector, the osnoise tracer can run
 		 * without a pause because preemption is on.
 		 */
-		if (interval < 1)
+		if (interval < 1) {
+			/* Let synchronize_rcu_tasks() make progress */
+			cond_resched_tasks_rcu_qs();
 			continue;
+		}
 
 		if (msleep_interruptible(interval))
 			break;
-- 
2.30.2

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

* [for-next][PATCH 2/6] trace/osnoise: Fix no previous prototype warnings
  2021-06-29 11:48 [for-next][PATCH 0/6] tracing: Minor fixes Steven Rostedt
  2021-06-29 11:48 ` [for-next][PATCH 1/6] tracing: Have osnoise_main() add a quiescent state for task rcu Steven Rostedt
@ 2021-06-29 11:48 ` Steven Rostedt
  2021-06-29 11:48 ` [for-next][PATCH 3/6] trace/osnoise: Make interval u64 on osnoise_main Steven Rostedt
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Steven Rostedt @ 2021-06-29 11:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ingo Molnar, Andrew Morton, kernel test robot,
	Daniel Bristot de Oliveira

From: Daniel Bristot de Oliveira <bristot@redhat.com>

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.

Link: https://lkml.kernel.org/r/e40d3cb4be8bde921f4b40fa6a095cf85ab807bd.1624872608.git.bristot@redhat.com

Fixes: bce29ac9ce0b ("trace: Add osnoise tracer")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Daniel Bristot de Oliveira <bristot@redhat.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 arch/x86/kernel/trace.c      |  3 ---
 include/linux/trace.h        |  2 ++
 kernel/trace/trace_osnoise.c | 20 +++++++++++---------
 3 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/arch/x86/kernel/trace.c b/arch/x86/kernel/trace.c
index 6912672c33a7..6b73b6f92ad3 100644
--- a/arch/x86/kernel/trace.c
+++ b/arch/x86/kernel/trace.c
@@ -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
  */
diff --git a/include/linux/trace.h b/include/linux/trace.h
index 4e3858640c47..bf169612ffe1 100644
--- a/include/linux/trace.h
+++ b/include/linux/trace.h
@@ -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 */
 
diff --git a/kernel/trace/trace_osnoise.c b/kernel/trace/trace_osnoise.c
index 556d530af805..9c3109e3ffeb 100644
--- a/kernel/trace/trace_osnoise.c
+++ b/kernel/trace/trace_osnoise.c
@@ -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;
-- 
2.30.2

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

* [for-next][PATCH 3/6] trace/osnoise: Make interval u64 on osnoise_main
  2021-06-29 11:48 [for-next][PATCH 0/6] tracing: Minor fixes Steven Rostedt
  2021-06-29 11:48 ` [for-next][PATCH 1/6] tracing: Have osnoise_main() add a quiescent state for task rcu Steven Rostedt
  2021-06-29 11:48 ` [for-next][PATCH 2/6] trace/osnoise: Fix no previous prototype warnings Steven Rostedt
@ 2021-06-29 11:48 ` Steven Rostedt
  2021-06-29 11:48 ` [for-next][PATCH 4/6] trace/osnoise: Fix return value on osnoise_init_hotplug_support Steven Rostedt
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Steven Rostedt @ 2021-06-29 11:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ingo Molnar, Andrew Morton, kernel test robot,
	Daniel Bristot de Oliveira

From: Daniel Bristot de Oliveira <bristot@redhat.com>

kernel test robot reported:

  >> 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.

Link: https://lkml.kernel.org/r/4ae1e7780563598563de079a3ef6d4d10b5f5546.1624872608.git.bristot@redhat.com

Fixes: bce29ac9ce0b ("trace: Add osnoise tracer")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Daniel Bristot de Oliveira <bristot@redhat.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 kernel/trace/trace_osnoise.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/trace_osnoise.c b/kernel/trace/trace_osnoise.c
index 9c3109e3ffeb..79be14380581 100644
--- a/kernel/trace/trace_osnoise.c
+++ b/kernel/trace/trace_osnoise.c
@@ -1202,7 +1202,7 @@ static struct cpumask save_cpumask;
  */
 static int osnoise_main(void *data)
 {
-	s64 interval;
+	u64 interval;
 
 	while (!kthread_should_stop()) {
 
-- 
2.30.2

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

* [for-next][PATCH 4/6] trace/osnoise: Fix return value on osnoise_init_hotplug_support
  2021-06-29 11:48 [for-next][PATCH 0/6] tracing: Minor fixes Steven Rostedt
                   ` (2 preceding siblings ...)
  2021-06-29 11:48 ` [for-next][PATCH 3/6] trace/osnoise: Make interval u64 on osnoise_main Steven Rostedt
@ 2021-06-29 11:48 ` Steven Rostedt
  2021-06-29 11:48 ` [for-next][PATCH 5/6] Documentation: Fix a typo on trace/osnoise-tracer Steven Rostedt
  2021-06-29 11:48 ` [for-next][PATCH 6/6] tracing: Fix spelling in osnoise tracer "interferences" -> "interference" Steven Rostedt
  5 siblings, 0 replies; 7+ messages in thread
From: Steven Rostedt @ 2021-06-29 11:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ingo Molnar, Andrew Morton, kernel test robot,
	Daniel Bristot de Oliveira

From: Daniel Bristot de Oliveira <bristot@redhat.com>

kernel test robot reported:

  >> 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.

Link: https://lkml.kernel.org/r/c7fc67f1a117cc88bab2e508c898634872795341.1624872608.git.bristot@redhat.com

Fixes: c8895e271f79 ("trace/osnoise: Support hotplug operations")
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Daniel Bristot de Oliveira <bristot@redhat.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 kernel/trace/trace_osnoise.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/trace_osnoise.c b/kernel/trace/trace_osnoise.c
index 79be14380581..085a83de98ad 100644
--- a/kernel/trace/trace_osnoise.c
+++ b/kernel/trace/trace_osnoise.c
@@ -1586,7 +1586,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 */
 
-- 
2.30.2

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

* [for-next][PATCH 5/6] Documentation: Fix a typo on trace/osnoise-tracer
  2021-06-29 11:48 [for-next][PATCH 0/6] tracing: Minor fixes Steven Rostedt
                   ` (3 preceding siblings ...)
  2021-06-29 11:48 ` [for-next][PATCH 4/6] trace/osnoise: Fix return value on osnoise_init_hotplug_support Steven Rostedt
@ 2021-06-29 11:48 ` Steven Rostedt
  2021-06-29 11:48 ` [for-next][PATCH 6/6] tracing: Fix spelling in osnoise tracer "interferences" -> "interference" Steven Rostedt
  5 siblings, 0 replies; 7+ messages in thread
From: Steven Rostedt @ 2021-06-29 11:48 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Daniel Bristot de Oliveira

From: Daniel Bristot de Oliveira <bristot@redhat.com>

s/RUNTIME IN USE/RUNTIME IN US/

Link: https://lkml.kernel.org/r/43e5160422a967218aa651c47f523e8d32d6a59e.1624872608.git.bristot@redhat.com

Fixes: bce29ac9ce0b ("trace: Add osnoise tracer")
Signed-off-by: Daniel Bristot de Oliveira <bristot@redhat.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 Documentation/trace/osnoise-tracer.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/trace/osnoise-tracer.rst b/Documentation/trace/osnoise-tracer.rst
index 37a3c10fb216..b648cb9bf1f0 100644
--- a/Documentation/trace/osnoise-tracer.rst
+++ b/Documentation/trace/osnoise-tracer.rst
@@ -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.
-- 
2.30.2

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

* [for-next][PATCH 6/6] tracing: Fix spelling in osnoise tracer "interferences" -> "interference"
  2021-06-29 11:48 [for-next][PATCH 0/6] tracing: Minor fixes Steven Rostedt
                   ` (4 preceding siblings ...)
  2021-06-29 11:48 ` [for-next][PATCH 5/6] Documentation: Fix a typo on trace/osnoise-tracer Steven Rostedt
@ 2021-06-29 11:48 ` Steven Rostedt
  5 siblings, 0 replies; 7+ messages in thread
From: Steven Rostedt @ 2021-06-29 11:48 UTC (permalink / raw)
  To: linux-kernel
  Cc: Ingo Molnar, Andrew Morton, Daniel Bristot de Oliveira, Colin Ian King

From: Colin Ian King <colin.king@canonical.com>

There is a spelling mistake in a TP_printk message, the word interferences
is not the plural of interference. Fix this.

Link: https://lkml.kernel.org/r/20210628125522.56361-1-colin.king@canonical.com

Reviewed-by: Daniel Bristot de Oliveira <bristot@redhat.com>
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 include/trace/events/osnoise.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/trace/events/osnoise.h b/include/trace/events/osnoise.h
index 28762c69f6c9..82f741ec0f57 100644
--- a/include/trace/events/osnoise.h
+++ b/include/trace/events/osnoise.h
@@ -129,7 +129,7 @@ TRACE_EVENT(sample_threshold,
 		__entry->interference = interference;
 	),
 
-	TP_printk("start %llu.%09u duration %llu ns interferences %llu",
+	TP_printk("start %llu.%09u duration %llu ns interference %llu",
 		__print_ns_to_secs(__entry->start),
 		__print_ns_without_secs(__entry->start),
 		__entry->duration,
-- 
2.30.2

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

end of thread, other threads:[~2021-06-29 11:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-29 11:48 [for-next][PATCH 0/6] tracing: Minor fixes Steven Rostedt
2021-06-29 11:48 ` [for-next][PATCH 1/6] tracing: Have osnoise_main() add a quiescent state for task rcu Steven Rostedt
2021-06-29 11:48 ` [for-next][PATCH 2/6] trace/osnoise: Fix no previous prototype warnings Steven Rostedt
2021-06-29 11:48 ` [for-next][PATCH 3/6] trace/osnoise: Make interval u64 on osnoise_main Steven Rostedt
2021-06-29 11:48 ` [for-next][PATCH 4/6] trace/osnoise: Fix return value on osnoise_init_hotplug_support Steven Rostedt
2021-06-29 11:48 ` [for-next][PATCH 5/6] Documentation: Fix a typo on trace/osnoise-tracer Steven Rostedt
2021-06-29 11:48 ` [for-next][PATCH 6/6] tracing: Fix spelling in osnoise tracer "interferences" -> "interference" Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).