Re: [PATCH V4 8/8] riscv: Add config of thread stack size

From: Guo Ren
Date: Mon Sep 12 2022 - 00:15:03 EST


On Mon, Sep 12, 2022 at 2:40 AM Arnd Bergmann <arnd@xxxxxxxx> wrote:
>
>
>
> On Sun, Sep 11, 2022, at 1:35 AM, Guo Ren wrote:
> > On Sun, Sep 11, 2022 at 12:07 AM Arnd Bergmann <arnd@xxxxxxxx> wrote:
> >>
> >> On Sat, Sep 10, 2022, at 2:52 PM, Guo Ren wrote:
> >> > On Thu, Sep 8, 2022 at 3:37 PM Arnd Bergmann <arnd@xxxxxxxx> wrote:
> >> >> On Thu, Sep 8, 2022, at 4:25 AM, guoren@xxxxxxxxxx wrote:
> >> >> > From: Guo Ren <guoren@xxxxxxxxxxxxxxxxx>
> >> >> - When VMAP_STACK is set, make it possible to select non-power-of-two
> >> >> stack sizes. Most importantly, 12KB should be a really interesting
> >> >> choice as 8KB is probably still not enough for many 64-bit workloads,
> >> >> but 16KB is often more than what you need. You probably don't
> >> >> want to allow 64BIT/8KB without VMAP_STACK anyway since that just
> >> >> makes it really hard to debug, so hiding the option when VMAP_STACK
> >> >> is disabled may also be a good idea.
> >> > I don't want this config to depend on VMAP_STACK. Some D1 chips would
> >> > run with an 8K stack size and !VMAP_STACK.
> >>
> >> That sounds like a really bad idea, why would you want to risk
> >> using such a small stack without CONFIG_VMAP_STACK?
> >>
> >> Are you worried about increased memory usage or something else?
> > The requirement is from [1], and I think disabling CONFIG_VMAP_STACK
> > would be the last step after serious testing.
>
> I still don't see why you need to turn off VMAP_STACK at all
> if it works. The only downside I can see with using VMAP_STACK
> on a 64-bit system is that it may expose bugs with device
> drivers that do DMA to stack data. Once you have tested the
> system successfully, you can also assume that you have no such
> drivers.
1st, VMAP_STACK could be enabled&disabled in arch/Kconfig. If we don't
force users to enable VMAP_STACK, why couldn't user adjust
THREAD_SIZE?
2nd, VMAP_STACK is not free, we still need 1KB shadow_stack.
The EXPERT is enough for your concern.


>
> Arnd



--
Best Regards
Guo Ren