[PATCH v2 0/2] Allow configurable stack size (especially 32k on PPC64)
David Laight
David.Laight at ACULAB.COM
Fri Feb 24 20:54:56 AEDT 2017
From: Hamish Martin
> Sent: 24 February 2017 00:52
> This patch series adds the ability to configure the THREAD_SHIFT value and
> thereby alter the stack size on powerpc systems. We are particularly interested
> in configuring for a 32k stack on PPC64.
>
> Using an NXP T2081 (e6500 PPC64 cores) we are observing stack overflows as a
> result of applying a DTS overlay containing some I2C devices. Our scenario is
> an ethernet switch chassis with plug-in cards. The I2C is driven from the T2081
> through a PCA9548 mux on the main board. When we detect insertion of the plugin
> card we schedule work for a call to of_overlay_create() to install a DTS
> overlay for the plugin board. This DTS overlay contains a further PCA9548 mux
> with more devices hanging off it including a PCA9539 GPIO expander. The
> ultimate installed I2C tree is:
>
> T2081 --- PCA9548 MUX --- PCA9548 MUX --- PCA9539 GPIO Expander
>
> When we install the overlay the devices described in the overlay are probed and
> we see a large number of stack frames used as a result. If this is coupled with
> an interrupt happening that requires moderate to high stack use we observe
> stack corruption. Here is an example long stack (from a 4.10-rc8 kernel) that
> does not show corruption but does demonstrate the length and frame sizes
> involved.
...
ISTM that the device probe needs to be iterative rather than recursive so
that deeply nested buses don't require deep stacks.
Switching stacks on interrupt entry would also make it much less likely that
you'll get an unexpected stack corruption.
The problem with just doubling the stack size is that code will just eat
it all up and, in a few years, something will hit the limit again.
David
More information about the Linuxppc-dev
mailing list