All of lore.kernel.org
 help / color / mirror / Atom feed
From: Frederic Weisbecker <fweisbec@gmail.com>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: linux-kernel@vger.kernel.org, tglx@linutronix.de,
	Linus Torvalds <torvalds@linux-foundation.org>,
	davem@davemloft.net, Paul Mackerras <paulus@au1.ibm.com>
Subject: Re: do_softirq() vs __do_softirq() in irq_exit() and stack overflow
Date: Thu, 5 Sep 2013 15:29:15 +0200	[thread overview]
Message-ID: <20130905132914.GD20519@somewhere> (raw)
In-Reply-To: <1378330796.4321.50.camel@pasglop>

On Thu, Sep 05, 2013 at 07:39:56AM +1000, Benjamin Herrenschmidt wrote:
> Hi Folks !
> 
> It appears that the current version of irq_exit() calls __do_softirq()
> directly rather than do_softirq().
> 
> That means we are going to call the softirq's in the current interrupt
> frame rather than on the separate softirq stack.
> 
> The current frame is also still the normal kernel stack, because
> do_IRQ() itself only switches to the interrupt stack for processing
> the handlers (it's back to the original stack by the time it calls
> irq_exit).
> 
> That means that we end up stacking the normal stack, the actually HW
> interrupt stack frame (which can be pretty big on ppc) + do_IRQ's own,
> then the softirq (networks stack can create HUGE stack frames) and ...
> we are in softirq, so HW irqs are enable, we can thus can another irq
> stack frame piled up on top of that (or a perf stack).
> 
> We are observing actual overflows, here's an example blowing up our 16k
> stack on ppc64, you notice that it's all on the normal kernel stack:

I see, __do_softirq() is sometimes called to avoid irqsafe and softirq_pending
check they are not necessary but OTOH this bypass the arch overriden handler.

I'm going to try something and post soon.

Thanks.

  parent reply	other threads:[~2013-09-05 13:29 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-04 21:39 do_softirq() vs __do_softirq() in irq_exit() and stack overflow Benjamin Herrenschmidt
2013-09-05  0:27 ` Benjamin Herrenschmidt
2013-09-05 13:29 ` Frederic Weisbecker [this message]
2013-09-05 15:33 ` [RFC PATCH 0/3] irq: Fix stack overflow due to softirq called on current stack Frederic Weisbecker
2013-09-05 15:33   ` [PATCH 1/3] irq: Consolidate do_softirq() arch overriden implementations Frederic Weisbecker
2013-09-05 15:33   ` [PATCH 2/3] irq: Execute softirq on its own stack on irq exit Frederic Weisbecker
2013-09-05 15:33   ` [PATCH 3/3] irq: Comment on the use of inline stack for ksoftirq Frederic Weisbecker
2013-09-05 22:56     ` Frederic Weisbecker
2013-09-05 22:18   ` [RFC PATCH 0/3] irq: Fix stack overflow due to softirq called on current stack Benjamin Herrenschmidt
2013-09-18  6:51   ` Paul Mackerras
2013-09-19 15:38     ` Frederic Weisbecker

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=20130905132914.GD20519@somewhere \
    --to=fweisbec@gmail.com \
    --cc=benh@kernel.crashing.org \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulus@au1.ibm.com \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.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 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.