From: Paul Walmsley <pjw@kernel.org>
To: Nam Cao <namcao@linutronix.de>,
samuel.holland@sifive.com, Rui Qi <qirui.001@bytedance.com>,
Michael Ellerman <mpe@kernel.org>
Cc: palmer@dabbelt.com, pjw@kernel.org, aou@eecs.berkeley.edu,
alex@ghiti.fr, conor@kernel.org,
linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] riscv: Fix 32-bit call_on_irq_stack() frame pointer ABI
Date: Thu, 25 Jun 2026 13:50:40 -0600 (MDT) [thread overview]
Message-ID: <7f93b3b9-4ba5-fb7e-a454-b67536a9351c@kernel.org> (raw)
In-Reply-To: <87pl1fvwce.fsf@yellow.woof>
On Thu, 25 Jun 2026, Nam Cao wrote:
> Michael Ellerman <mpe@kernel.org> writes:
> > On 24/6/26 9:31 pm, Rui Qi wrote:
> >> call_on_irq_stack() uses struct member offsets to set up its link in the
> >> frame record list. On riscv32, struct stackframe is the wrong size to
> >> maintain stack pointer alignment, so STACKFRAME_SIZE_ON_STACK includes
> >> padding. However, the ABI requires the frame record to be placed
> >> immediately below the address stored in s0, so the padding must come
> >> before the struct members.
> >>
> >> Fix the layout by making STACKFRAME_FP and STACKFRAME_RA the negative
> >> offsets from s0, instead of the positive offsets from sp.
> >
> > The fact that all uses of the defines need to add back STACKFRAME_SIZE_ON_STACK
> > makes me think the defines don't have the most useful values.
> >
> > If the values were offset + padding then the uses could be left unchanged.
>
> At the moment we only have only one user which has nothing except the
> stack frame on the stack. Other potential users do not necessarily add back
> STACKFRAME_SIZE_ON_STACK.
>
> The offset value depends on the function. So I think it's better to
> leave that offset calculation to users.
Since it's a fix, I queued Rui's resend of Samuel's patch for v7.2-rc,
after cleaning it up along the lines of Nam's suggestions.
Michael, if you think those changes are worth a followup patch for the
list to consider, maybe you can send it as a separate patch?
- Paul
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2026-06-25 19:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-24 11:31 [PATCH] riscv: Fix 32-bit call_on_irq_stack() frame pointer ABI Rui Qi
2026-06-24 12:38 ` Nam Cao
2026-06-25 8:05 ` Michael Ellerman
2026-06-25 8:49 ` Nam Cao
2026-06-25 19:50 ` Paul Walmsley [this message]
2026-06-25 20:52 ` Samuel Holland
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=7f93b3b9-4ba5-fb7e-a454-b67536a9351c@kernel.org \
--to=pjw@kernel.org \
--cc=alex@ghiti.fr \
--cc=aou@eecs.berkeley.edu \
--cc=conor@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=mpe@kernel.org \
--cc=namcao@linutronix.de \
--cc=palmer@dabbelt.com \
--cc=qirui.001@bytedance.com \
--cc=samuel.holland@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