mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Christoph Hellwig <hch@lst.de>
Cc: Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@elte.hu>,
	mingo@redhat.com, hpa@zytor.com, linux-kernel@vger.kernel.org,
	linux-tip-commits@vger.kernel.org
Subject: Re: [tip:x86/irq] x86: Always use irq stacks
Date: Fri, 23 Jul 2010 10:15:16 -0400	[thread overview]
Message-ID: <1279894516.3319.44.camel@gandalf.stny.rr.com> (raw)
In-Reply-To: <20100714154746.GA2074@lst.de>

On Wed, 2010-07-14 at 17:47 +0200, Christoph Hellwig wrote:

> > So you're saying, that the problem appears when
> > CONFIG_FUNCTION_GRAPH_TRACER is enabled w/o being used and that it
> > exists prior to your patches with irq stacks and 8k stack size, but
> > works with 4k stacks. That's definitely more than odd.
> 
> No, the problem does not show up with 8k stack size without irqstacks,
> and does not show up with 4k stacks with irq stacks, but does show up
> with 8k stacks with irqstacks as long as CONFIG_FUNCTION_GRAPH_TRACER is
> enabled. Just disabling it in Ingo's example config makes it work,
> and enabling it in my usual test configs makes the boot fail with
> similar messages to the one Ingo sees.

Examining the difference between 32bit and 64bit (where it only triggers
for 32bit) I found this:

In arch/x86/kernel/dumpstack_64.c:

        tinfo = task_thread_info(task);
[...]
                       bp = ops->walk_stack(tinfo, stack, bp, ops,
                                             data, estack_end, &graph);


Note: tinfo here that is passed to walk_stack() is the actual thread
info structure for the task.

In arch/x86/kernel/dumpstack_32.c:

                context = (struct thread_info *)
                        ((unsigned long)stack & (~(THREAD_SIZE - 1)));
                bp = ops->walk_stack(context, stack, bp, ops, data, NULL, &graph);

Note: here, context (which ends up being tinfo) is just a bitmasking of
the current stack. If the stack is the irqstack, then what is passed to
walk_stack() is not the actual thread info structure.

Note, if THREAD_SIZE is 8k and irqstacks are 4K then context is totally
wrong here.

Now for the reason that function graph noticed this:

static const struct stacktrace_ops print_trace_ops = {
        .warning                = print_trace_warning,
        .warning_symbol         = print_trace_warning_symbol,
        .stack                  = print_trace_stack,
        .address                = print_trace_address,
        .walk_stack             = print_context_stack,
};

Where walk_stack is print_context_stack:

tinfo is pretty much ignored in print_context_stack, but when function
graph is enabled we have:

                print_ftrace_graph_addr(addr, data, ops, tinfo, graph);

Which actually plays with the tinfo structure. If tinfo is corrupted
here, then we get the bug.

-- Steve




  parent reply	other threads:[~2010-07-23 14:15 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-28 12:15 [PATCH 1/2] x86: always " Christoph Hellwig
2010-06-29 10:21 ` [tip:x86/irq] x86: Always " tip-bot for Christoph Hellwig
2010-06-30  7:44   ` Ingo Molnar
2010-06-30  7:52     ` Christoph Hellwig
2010-06-30  7:58       ` Ingo Molnar
2010-06-30  8:04         ` Ingo Molnar
2010-07-08 20:42           ` Ingo Molnar
2010-07-08 20:53             ` Christoph Hellwig
2010-07-14 15:12               ` Christoph Hellwig
2010-07-14 15:27                 ` Thomas Gleixner
2010-07-14 15:47                   ` Christoph Hellwig
2010-07-14 18:21                     ` Steven Rostedt
2010-07-27 12:13                       ` Christoph Hellwig
2010-07-27 16:29                         ` H. Peter Anvin
2010-07-27 18:36                         ` [tip:x86/irq] x86-32: Align IRQ stacks properly tip-bot for Christoph Hellwig
2010-07-23 14:15                     ` Steven Rostedt [this message]
2010-07-23 14:24                       ` [tip:x86/irq] x86: Always use irq stacks Steven Rostedt
2010-07-23 16:39                         ` Christoph Hellwig
2010-07-14 19:02                   ` David Miller
2010-09-03 15:00   ` Ingo Molnar
2010-09-06 18:53     ` Alexander van Heukelum
2010-09-07  4:06       ` [tip:x86/irq] x86, 32-bit: Align percpu area and irq stacks to THREAD_SIZE tip-bot for Alexander van Heukelum
2010-09-07  4:55       ` [tip:x86/irq] x86: Always use irq stacks Ingo Molnar
2010-09-07  8:21         ` Alexander van Heukelum

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=1279894516.3319.44.camel@gandalf.stny.rr.com \
    --to=rostedt@goodmis.org \
    --cc=hch@lst.de \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    /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®