All of lore.kernel.org
 help / color / mirror / Atom feed
From: Russell King - ARM Linux admin <linux@armlinux.org.uk>
To: Arnd Bergmann <arnd@kernel.org>
Cc: v.narang@samsung.com, a.sahrawat@samsung.com,
	"Marc Zyngier" <maz@kernel.org>,
	"Sebastian Andrzej Siewior" <bigeasy@linutronix.de>,
	"Vincent Whitchurch" <vincent.whitchurch@axis.com>,
	"Nick Desaulniers" <ndesaulniers@google.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Nathan Huckleberry" <nhuck@google.com>,
	"Jian Cai" <caij2003@gmail.com>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"Dmitry Safonov" <0x7f454c46@gmail.com>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Maninder Singh" <maninder1.s@samsung.com>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Will Deacon" <will@kernel.org>,
	"Valentin Schneider" <valentin.schneider@arm.com>,
	"Linux ARM" <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 0/3] IRQ stack support for ARM
Date: Wed, 21 Oct 2020 13:34:00 +0100	[thread overview]
Message-ID: <20201021123400.GK1551@shell.armlinux.org.uk> (raw)
In-Reply-To: <CAK8P3a2tmRo0voZJLqYbNQGG9FZCGuKzMj8Zo8f+WL+dvOourw@mail.gmail.com>

On Wed, Oct 21, 2020 at 01:58:21PM +0200, Arnd Bergmann wrote:
> (replying to my own mail, apparently my normal outgoing email server is
> blacklisted, so resending from @kernel.org)
> 
> On Fri, Oct 16, 2020 at 12:09 PM Arnd Bergmann <arnd@arndb.de> wrote:
> >
> > On Thu, Oct 8, 2020 at 10:32 AM Russell King - ARM Linux admin
> > <linux@armlinux.org.uk> wrote:
> > > On Thu, Oct 08, 2020 at 12:45:30PM +0530, Maninder Singh wrote:
> > > > Observed Stack Overflow on 8KB kernel stack on ARM specially
> > > > incase on network interrupts, which results in undeterministic behaviour.
> > > > So there is need for per cpu dedicated IRQ stack for ARM.
> > > >
> > > > As ARm does not have extra co-processor register
> > > > to save thread info pointer, IRQ stack will be at some
> > > > performance cost, so code is under CONFIG_IRQ_STACK.
> > > >
> > > > and we don't have much knowledge and set up for CLANG
> > > > and ARM_UNWIND, so dependency added for both cases.
> > > >
> > > > Tested patch set with QEMU for latest kernel
> > > > and 4.1 kernel for ARM target with same patch set.
> > >
> > > You need to investigate and show where and why this is happening. My
> > > guess is you have a network driver that uses a lot of kernel stack
> > > space, which itself would be a bug.
> >
> > Agreed.
> >
> > > Note that there are compiler versions out there that mis-optimise and
> > > eat stack space - the kernel build should be warning if a function
> > > uses a large amount of stack.
> >
> > Some more ideas for figuring it out:
> >
> > CONFIG_DEBUG_STACK_USAGE may also be helpful in identifying
> > code paths that are deeply nested with multiple functions taking a
> > lot of stack space, but each one staying under the limit.
> >
> > CONFIG_DEBUG_STACKOVERFLOW would also help here but
> > is not supported on Arm at the moment. There was a patch[1] from
> > Uwe Kleine-König to add this, and I suppose we should still add
> > that, in particular if it helps debug this problem.
> >
> > CONFIG_VMAP_STACK is probably the best way to debug
> > random runtime stack overflows because using a guard page
> > turns random memory corruption into an immediate oops,
> > but I don't think there is an implementation for Arm yet and
> > using a lot of vmalloc space means we might not be able to
> > default to this.
> >
> > Regardless of identifying and fixing the bug Maninder found, I
> > also think that supporting separate async stacks on Arm is useful
> > for determinism. Most of the popular architectures use irqstack
> > for this reason, and I was actually surprised that we don't do it
> > on arch/arm/.
> >
> >      Arnd
> >
> > [1] https://lore.kernel.org/linux-arm-kernel/20200108082913.29710-1-u.kleine-koenig@pengutronix.de/

We don't do it because we don't have a separate register to be able
to store the thread_info pointer, and copying that lump between the
SVC and IRQ stack will add massively to IRQ latency, especially for
older machines.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Russell King - ARM Linux admin <linux@armlinux.org.uk>
To: Arnd Bergmann <arnd@kernel.org>
Cc: "Maninder Singh" <maninder1.s@samsung.com>,
	v.narang@samsung.com, a.sahrawat@samsung.com,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Marc Zyngier" <maz@kernel.org>,
	"Sebastian Andrzej Siewior" <bigeasy@linutronix.de>,
	"Vincent Whitchurch" <vincent.whitchurch@axis.com>,
	"Nick Desaulniers" <ndesaulniers@google.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Valentin Schneider" <valentin.schneider@arm.com>,
	"Dmitry Safonov" <0x7f454c46@gmail.com>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"Nathan Huckleberry" <nhuck@google.com>,
	"Will Deacon" <will@kernel.org>, "Jian Cai" <caij2003@gmail.com>,
	"Linux ARM" <linux-arm-kernel@lists.infradead.org>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
Subject: Re: [PATCH 0/3] IRQ stack support for ARM
Date: Wed, 21 Oct 2020 13:34:00 +0100	[thread overview]
Message-ID: <20201021123400.GK1551@shell.armlinux.org.uk> (raw)
In-Reply-To: <CAK8P3a2tmRo0voZJLqYbNQGG9FZCGuKzMj8Zo8f+WL+dvOourw@mail.gmail.com>

On Wed, Oct 21, 2020 at 01:58:21PM +0200, Arnd Bergmann wrote:
> (replying to my own mail, apparently my normal outgoing email server is
> blacklisted, so resending from @kernel.org)
> 
> On Fri, Oct 16, 2020 at 12:09 PM Arnd Bergmann <arnd@arndb.de> wrote:
> >
> > On Thu, Oct 8, 2020 at 10:32 AM Russell King - ARM Linux admin
> > <linux@armlinux.org.uk> wrote:
> > > On Thu, Oct 08, 2020 at 12:45:30PM +0530, Maninder Singh wrote:
> > > > Observed Stack Overflow on 8KB kernel stack on ARM specially
> > > > incase on network interrupts, which results in undeterministic behaviour.
> > > > So there is need for per cpu dedicated IRQ stack for ARM.
> > > >
> > > > As ARm does not have extra co-processor register
> > > > to save thread info pointer, IRQ stack will be at some
> > > > performance cost, so code is under CONFIG_IRQ_STACK.
> > > >
> > > > and we don't have much knowledge and set up for CLANG
> > > > and ARM_UNWIND, so dependency added for both cases.
> > > >
> > > > Tested patch set with QEMU for latest kernel
> > > > and 4.1 kernel for ARM target with same patch set.
> > >
> > > You need to investigate and show where and why this is happening. My
> > > guess is you have a network driver that uses a lot of kernel stack
> > > space, which itself would be a bug.
> >
> > Agreed.
> >
> > > Note that there are compiler versions out there that mis-optimise and
> > > eat stack space - the kernel build should be warning if a function
> > > uses a large amount of stack.
> >
> > Some more ideas for figuring it out:
> >
> > CONFIG_DEBUG_STACK_USAGE may also be helpful in identifying
> > code paths that are deeply nested with multiple functions taking a
> > lot of stack space, but each one staying under the limit.
> >
> > CONFIG_DEBUG_STACKOVERFLOW would also help here but
> > is not supported on Arm at the moment. There was a patch[1] from
> > Uwe Kleine-König to add this, and I suppose we should still add
> > that, in particular if it helps debug this problem.
> >
> > CONFIG_VMAP_STACK is probably the best way to debug
> > random runtime stack overflows because using a guard page
> > turns random memory corruption into an immediate oops,
> > but I don't think there is an implementation for Arm yet and
> > using a lot of vmalloc space means we might not be able to
> > default to this.
> >
> > Regardless of identifying and fixing the bug Maninder found, I
> > also think that supporting separate async stacks on Arm is useful
> > for determinism. Most of the popular architectures use irqstack
> > for this reason, and I was actually surprised that we don't do it
> > on arch/arm/.
> >
> >      Arnd
> >
> > [1] https://lore.kernel.org/linux-arm-kernel/20200108082913.29710-1-u.kleine-koenig@pengutronix.de/

We don't do it because we don't have a separate register to be able
to store the thread_info pointer, and copying that lump between the
SVC and IRQ stack will add massively to IRQ latency, especially for
older machines.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!

  reply	other threads:[~2020-10-21 12:39 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CGME20201008071628epcas5p24d196a6023a47a3b0bfa7b7f231ec811@epcas5p2.samsung.com>
2020-10-08  7:15 ` [PATCH 0/3] IRQ stack support for ARM Maninder Singh
2020-10-08  7:15   ` Maninder Singh
2020-10-08  7:15   ` [PATCH 1/3] arm: introduce self pointer in thread info Maninder Singh
2020-10-08  7:15     ` Maninder Singh
2020-10-08  7:15   ` [PATCH 2/3] arm: introduce IRQ stacks Maninder Singh
2020-10-08  7:15     ` Maninder Singh
     [not found]     ` <CAK8P3a2RYeNiTy9QmwFVKtFifXxWc9XfAT6ThPoSH9wGYsKGpA@mail.gmail.com>
2020-10-21 12:42       ` Arnd Bergmann
2020-10-21 12:42         ` Arnd Bergmann
2020-10-21 12:45         ` Russell King - ARM Linux admin
2020-10-21 12:45           ` Russell King - ARM Linux admin
2020-10-21 12:55           ` Arnd Bergmann
2020-10-21 12:55             ` Arnd Bergmann
2020-10-21 12:57           ` Russell King - ARM Linux admin
2020-10-21 12:57             ` Russell King - ARM Linux admin
2020-10-21 13:46             ` Vaneet Narang
2020-10-21 13:46               ` Vaneet Narang
2020-10-21 15:59             ` Arnd Bergmann
2020-10-21 15:59               ` Arnd Bergmann
2020-11-09 14:45               ` Tony Lindgren
2020-11-09 14:45                 ` Tony Lindgren
2020-11-09 19:10                 ` Arnd Bergmann
2020-11-09 19:10                   ` Arnd Bergmann
2020-11-10  9:19                   ` Tony Lindgren
2020-11-10  9:19                     ` Tony Lindgren
2020-11-10 10:04                     ` Arnd Bergmann
2020-11-10 10:04                       ` Arnd Bergmann
2020-11-10 12:04                       ` Tony Lindgren
2020-11-10 12:04                         ` Tony Lindgren
2020-11-10 13:35                         ` Arnd Bergmann
2020-11-10 13:35                           ` Arnd Bergmann
2020-11-11  6:56                           ` Tony Lindgren
2020-11-11  6:56                             ` Tony Lindgren
2020-10-08  7:15   ` [PATCH 3/3] arm: Modify stack trace and dump for use with irq stack Maninder Singh
2020-10-08  7:15     ` Maninder Singh
2020-10-08  7:53   ` [PATCH 0/3] IRQ stack support for ARM Sebastian Andrzej Siewior
2020-10-08  7:53     ` Sebastian Andrzej Siewior
2020-10-08  8:30   ` Russell King - ARM Linux admin
2020-10-08  8:30     ` Russell King - ARM Linux admin
2020-10-15 20:59     ` Nick Desaulniers
2020-10-15 20:59       ` Nick Desaulniers
2020-10-15 21:16       ` Florian Fainelli
2020-10-15 21:16         ` Florian Fainelli
     [not found]     ` <CAK8P3a0h=D8_Kn_fpHbsik_jf4to2jayxj7K7B7=HaNFzKqNnw@mail.gmail.com>
2020-10-21 11:58       ` Arnd Bergmann
2020-10-21 11:58         ` Arnd Bergmann
2020-10-21 12:34         ` Russell King - ARM Linux admin [this message]
2020-10-21 12:34           ` Russell King - ARM Linux admin
2020-10-21 12:46           ` Arnd Bergmann
2020-10-21 12:46             ` Arnd Bergmann

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=20201021123400.GK1551@shell.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=0x7f454c46@gmail.com \
    --cc=a.sahrawat@samsung.com \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@kernel.org \
    --cc=bigeasy@linutronix.de \
    --cc=caij2003@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=maninder1.s@samsung.com \
    --cc=maz@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=nhuck@google.com \
    --cc=tglx@linutronix.de \
    --cc=u.kleine-koenig@pengutronix.de \
    --cc=v.narang@samsung.com \
    --cc=valentin.schneider@arm.com \
    --cc=vincent.whitchurch@axis.com \
    --cc=will@kernel.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.