From: "Clément Léger" <cleger@rivosinc.com>
To: Alexandre Ghiti <alex@ghiti.fr>,
Paul Walmsley <paul.walmsley@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Cc: Himanshu Chauhan <hchauhan@ventanamicro.com>,
Anup Patel <apatel@ventanamicro.com>,
Xu Lu <luxu.kernel@bytedance.com>,
Atish Patra <atishp@atishpatra.org>
Subject: Re: [PATCH v3 2/4] riscv: add support for SBI Supervisor Software Events extension
Date: Tue, 28 Jan 2025 09:10:19 +0100 [thread overview]
Message-ID: <32cc0753-a033-4f55-8aca-09416f62faa8@rivosinc.com> (raw)
In-Reply-To: <a0012a8d-0c2b-4948-b5c7-7d8efdf1cab0@ghiti.fr>
On 27/01/2025 09:09, Alexandre Ghiti wrote:
>> I believe the goal is not the same. Using CONFIG_VMAP_STACK allows the
>> kernel exception handling to catch any stack overflow when entering the
>> kernel and thus using vmalloc is required to allocate twice the page
>> size (overflow is when sp is located in the upper half of the allocated
>> vmalloc stack. So basically, this is two distinct purposes.
>>
>> AFAIU, kvmalloc allows to fallback to vmalloc if kmalloc fails. This is
>> not what we are looking for here since our allocation size is always
>> quite small and known (STACK_SIZE basically).
>>
>> But I might be missing something.
>
>
> arch_alloc_vmap_stack() only vmalloc the stack and does not implement
> any stack overflow mechanism, so I'm still unsure we need the define.
Hi Alex,
So actually, the stack overflow check itself is done in the exception
entry. It check if the stack pointer did passed in the upper part of the
vmalloc allocation (see entry.S:122). In this allocation, the stack size
is actually * 2:
#ifdef CONFIG_VMAP_STACK
#define THREAD_ALIGN (2 * THREAD_SIZE)
#else
#define THREAD_ALIGN THREAD_SIZE
#endif
So even though it does nothing special by itself, it centralize the
allocation size/method. And size the size is larger, using vamlloc makes
sense I guess. The same mechanism is used to allocate irq stack as well.
Thanks,
Clément
>
> Thanks,
>
> Alex
next prev parent reply other threads:[~2025-01-28 8:10 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-06 16:30 [PATCH v3 0/4] riscv: add support for SBI Supervisor Software Events Clément Léger
2024-12-06 16:30 ` [PATCH v3 1/4] riscv: add SBI SSE extension definitions Clément Léger
2024-12-06 16:30 ` [PATCH v3 2/4] riscv: add support for SBI Supervisor Software Events extension Clément Léger
2024-12-10 4:51 ` Himanshu Chauhan
2025-01-22 12:15 ` Alexandre Ghiti
2025-01-22 12:23 ` Alexandre Ghiti
2025-01-23 8:41 ` Clément Léger
2025-01-23 8:39 ` Clément Léger
2025-01-27 8:09 ` Alexandre Ghiti
2025-01-28 8:10 ` Clément Léger [this message]
2025-01-30 10:01 ` Alexandre Ghiti
2025-03-19 17:08 ` Andrew Jones
2025-03-20 8:16 ` Clément Léger
2025-03-20 11:52 ` Andrew Jones
2025-03-20 12:26 ` Clément Léger
2024-12-06 16:30 ` [PATCH v3 3/4] drivers: firmware: add riscv SSE support Clément Léger
2024-12-13 5:03 ` Himanshu Chauhan
2024-12-13 8:33 ` Clément Léger
2025-01-16 13:58 ` Conor Dooley
2025-01-23 10:52 ` Clément Léger
2025-01-24 14:15 ` Conor Dooley
2024-12-06 16:31 ` [PATCH v3 4/4] perf: RISC-V: add support for SSE event Clément Léger
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=32cc0753-a033-4f55-8aca-09416f62faa8@rivosinc.com \
--to=cleger@rivosinc.com \
--cc=alex@ghiti.fr \
--cc=apatel@ventanamicro.com \
--cc=atishp@atishpatra.org \
--cc=hchauhan@ventanamicro.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=luxu.kernel@bytedance.com \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
/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