All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heiko Carstens <heiko.carstens@de.ibm.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
	Martin Schwidefsky <schwidefsky@de.ibm.com>
Subject: ftrace: preemptoff selftest not working
Date: Tue, 18 Nov 2008 13:54:00 +0100	[thread overview]
Message-ID: <20081118125359.GA4417@osiris.boeblingen.de.ibm.com> (raw)

Hi Steven,

I was wondering why the preemptoff and preemptirqsoff tracer selftests
don't work on s390. After all its just that they get called from
non-preemptible context:

kernel_init() will execute all initcalls, however the first line in
kernel_init() is lock_kernel(), which causes the preempt_count to be
increased. Any later calls to add_preempt_count() (especially those
from the selftests) will therefore not result in a call to
trace_preempt_off() since the check below in add_preempt_count()
will be false:

	if (preempt_count() == val)
		trace_preempt_off(CALLER_ADDR0, get_parent_ip(CALLER_ADDR1));

Hence the trace buffer will be empty.
The patch below makes the selftests working for me, since then they run
in preemptible context. But it is ugly and I'm not proposing it for
upstream ;)

Just wanted to make you aware that there is a bug.

---
 init/main.c                  |    4 ++++
 kernel/trace/trace_irqsoff.c |    3 +--
 2 files changed, 5 insertions(+), 2 deletions(-)

Index: linux-2.6/kernel/trace/trace_irqsoff.c
===================================================================
--- linux-2.6.orig/kernel/trace/trace_irqsoff.c
+++ linux-2.6/kernel/trace/trace_irqsoff.c
@@ -482,7 +482,7 @@ static struct tracer preemptirqsoff_trac
 # define register_preemptirqsoff(trace) do { } while (0)
 #endif
 
-__init static int init_irqsoff_tracer(void)
+int init_irqsoff_tracer(void)
 {
 	register_irqsoff(irqsoff_tracer);
 	register_preemptoff(preemptoff_tracer);
@@ -490,4 +490,3 @@ __init static int init_irqsoff_tracer(vo
 
 	return 0;
 }
-device_initcall(init_irqsoff_tracer);
Index: linux-2.6/init/main.c
===================================================================
--- linux-2.6.orig/init/main.c
+++ linux-2.6/init/main.c
@@ -789,6 +789,8 @@ static void run_init_process(char *init_
 	kernel_execve(init_filename, argv_init, envp_init);
 }
 
+extern int init_irqsoff_tracer(void);
+
 /* This is a non __init function. Force it to be noinline otherwise gcc
  * makes it inline to init() and it becomes part of init.text section
  */
@@ -800,6 +802,8 @@ static int noinline init_post(void)
 	system_state = SYSTEM_RUNNING;
 	numa_default_policy();
 
+	init_irqsoff_tracer();
+
 	if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0)
 		printk(KERN_WARNING "Warning: unable to open an initial console.\n");
 

             reply	other threads:[~2008-11-18 12:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-18 12:54 Heiko Carstens [this message]
2008-11-18 13:48 ` ftrace: preemptoff selftest not working Ingo Molnar
2008-11-18 13:49 ` Steven Rostedt
2008-11-18 13:52   ` Ingo Molnar
2008-11-18 14:32     ` Steven Rostedt
2008-11-18 14:47       ` Ingo Molnar
2008-11-18 17:06         ` Heiko Carstens
2008-11-18 17:21           ` Steven Rostedt
2008-11-18 20:55             ` Ingo Molnar
2008-11-19  9:02               ` Ingo Molnar
2008-11-19  9:23                 ` Heiko Carstens

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20081118125359.GA4417@osiris.boeblingen.de.ibm.com \
    --to=heiko.carstens@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=rostedt@goodmis.org \
    --cc=schwidefsky@de.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.