mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Fengguang Wu <fengguang.wu@intel.com>
Cc: LKML <linux-kernel@vger.kernel.org>, LKP <lkp@01.org>
Subject: Re: [trace] kernel BUG at kernel/sched/core.c:2881!
Date: Tue, 7 Jul 2015 15:03:31 -0400	[thread overview]
Message-ID: <20150707150331.6181f431@gandalf.local.home> (raw)
In-Reply-To: <20150707110627.2a638539@gandalf.local.home>

On Tue, 7 Jul 2015 11:06:27 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> On Tue, 30 Jun 2015 22:18:03 +0800
> Fengguang Wu <fengguang.wu@intel.com> wrote:
> 
> > Hi Rostedt,
> > 
> > FYI, this merge changes kernel crash to some more obvious kernel BUG
> > message. If it's still not helpful, I can try bisect the old crash
> > or split up the merge and bisect into them.
> > 
> > git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> > 
> 
> This has been a bug for some time. Does this fix it?
> 

Test this patch instead, this is the one I'm testing and will be
pushing to Linus.

-- Steve

---
 kernel/trace/trace.h        |    1 +
 kernel/trace/trace_branch.c |   13 ++++++++-----
 2 files changed, 9 insertions(+), 5 deletions(-)

Index: linux-trace.git/kernel/trace/trace.h
===================================================================
--- linux-trace.git.orig/kernel/trace/trace.h	2015-07-07 14:28:27.391715136 -0400
+++ linux-trace.git/kernel/trace/trace.h	2015-07-07 14:29:08.133213493 -0400
@@ -444,6 +444,7 @@ enum {
 
 	TRACE_CONTROL_BIT,
 
+	TRACE_BRANCH_BIT,
 /*
  * Abuse of the trace_recursion.
  * As we need a way to maintain state if we are tracing the function
Index: linux-trace.git/kernel/trace/trace_branch.c
===================================================================
--- linux-trace.git.orig/kernel/trace/trace_branch.c	2015-07-07 14:28:27.391715136 -0400
+++ linux-trace.git/kernel/trace/trace_branch.c	2015-07-07 14:56:52.036764240 -0400
@@ -36,9 +36,12 @@ probe_likely_condition(struct ftrace_bra
 	struct trace_branch *entry;
 	struct ring_buffer *buffer;
 	unsigned long flags;
-	int cpu, pc;
+	int pc;
 	const char *p;
 
+	if (current->trace_recursion & TRACE_BRANCH_BIT)
+		return;
+
 	/*
 	 * I would love to save just the ftrace_likely_data pointer, but
 	 * this code can also be used by modules. Ugly things can happen
@@ -50,9 +53,9 @@ probe_likely_condition(struct ftrace_bra
 		return;
 
 	local_irq_save(flags);
-	cpu = raw_smp_processor_id();
-	data = per_cpu_ptr(tr->trace_buffer.data, cpu);
-	if (atomic_inc_return(&data->disabled) != 1)
+	current->trace_recursion |= TRACE_BRANCH_BIT;
+	data = this_cpu_ptr(tr->trace_buffer.data);
+	if (atomic_read(&data->disabled))
 		goto out;
 
 	pc = preempt_count();
@@ -81,7 +84,7 @@ probe_likely_condition(struct ftrace_bra
 		__buffer_unlock_commit(buffer, event);
 
  out:
-	atomic_dec(&data->disabled);
+	current->trace_recursion &= ~TRACE_BRANCH_BIT;
 	local_irq_restore(flags);
 }
 

  reply	other threads:[~2015-07-07 19:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-30 14:18 Fengguang Wu
2015-07-02 19:56 ` Steven Rostedt
2015-07-07 15:06 ` Steven Rostedt
2015-07-07 19:03   ` Steven Rostedt [this message]
2015-07-07 22:37     ` Steven Rostedt
2015-07-08  3:57       ` Fengguang Wu

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=20150707150331.6181f431@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=fengguang.wu@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@01.org \
    /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 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®