All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Sherman <shermanpauldylan@gmail.com>
To: Paul Walmsley <pjw@kernel.org>
Cc: palmer@dabbelt.com, aou@eecs.berkeley.edu, alex@ghiti.fr,
	hchauhan@ventanamicro.com, apatel@ventanamicro.com,
	linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] riscv: sbi: fix errno mapping for SBI_ERR_ALREADY_* error codes
Date: Wed, 29 Jul 2026 17:01:25 -0700	[thread overview]
Message-ID: <amqUVf8KLUivRUMW@got-milk> (raw)
In-Reply-To: <8760a4fc-fde1-85be-174d-dc6dc6012265@kernel.org>

Hi,

On Wed, Jul 29, 2026 at 12:43:30PM -0600, Paul Walmsley wrote:

> It looks like -EALREADY is defined as "connection already in progress," 
> which doesn't quite map to the meaning of these errors, here.
> 
> https://en.cppreference.com/cpp/error/errno_macros

You're right that the POSIX description is networking-specific. My
reasoning was that it was the closest existing errno expressing "the
requested operation was unnecessary because the target was already in
the requested state." If you think another errno is a better fit I'm
happy to respin with that mapping.

> Does this patch fix anything or change any behavior?

Yes, concretely. Today SBI_ERR_ALREADY_STARTED falls through to
-ENOTSUPP, so callers cannot distinguish "already running" from an
unsupported SBI implementation. The companion patch updates
cpu_ops_sbi.c to recognize the translated errno and treat the
"already started" response as success, which fixes the boot-hart
bringup path on many-hart multi-node platforms like SG2042 where
firmware releases all harts simultaneously before SBI HSM state
is established.

> I don't think the comment is a good idea; it creates one more artifact 
> that can get out of sync with the code.  We'd just expect people to read 
> the code, I think.

Agreed, dropping it in v2.

Thanks,
Paul

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

WARNING: multiple messages have this Message-ID (diff)
From: Paul Sherman <shermanpauldylan@gmail.com>
To: Paul Walmsley <pjw@kernel.org>
Cc: palmer@dabbelt.com, aou@eecs.berkeley.edu, alex@ghiti.fr,
	hchauhan@ventanamicro.com, apatel@ventanamicro.com,
	linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] riscv: sbi: fix errno mapping for SBI_ERR_ALREADY_* error codes
Date: Wed, 29 Jul 2026 17:01:25 -0700	[thread overview]
Message-ID: <amqUVf8KLUivRUMW@got-milk> (raw)
In-Reply-To: <8760a4fc-fde1-85be-174d-dc6dc6012265@kernel.org>

Hi,

On Wed, Jul 29, 2026 at 12:43:30PM -0600, Paul Walmsley wrote:

> It looks like -EALREADY is defined as "connection already in progress," 
> which doesn't quite map to the meaning of these errors, here.
> 
> https://en.cppreference.com/cpp/error/errno_macros

You're right that the POSIX description is networking-specific. My
reasoning was that it was the closest existing errno expressing "the
requested operation was unnecessary because the target was already in
the requested state." If you think another errno is a better fit I'm
happy to respin with that mapping.

> Does this patch fix anything or change any behavior?

Yes, concretely. Today SBI_ERR_ALREADY_STARTED falls through to
-ENOTSUPP, so callers cannot distinguish "already running" from an
unsupported SBI implementation. The companion patch updates
cpu_ops_sbi.c to recognize the translated errno and treat the
"already started" response as success, which fixes the boot-hart
bringup path on many-hart multi-node platforms like SG2042 where
firmware releases all harts simultaneously before SBI HSM state
is established.

> I don't think the comment is a good idea; it creates one more artifact 
> that can get out of sync with the code.  We'd just expect people to read 
> the code, I think.

Agreed, dropping it in v2.

Thanks,
Paul

  reply	other threads:[~2026-07-30  0:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-27 22:15 [PATCH] riscv: sbi: fix errno mapping for SBI_ERR_ALREADY_* error codes Paul Sherman
2026-07-27 22:15 ` Paul Sherman
2026-07-29 18:43 ` Paul Walmsley
2026-07-29 18:43   ` Paul Walmsley
2026-07-30  0:01   ` Paul Sherman [this message]
2026-07-30  0:01     ` Paul Sherman

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=amqUVf8KLUivRUMW@got-milk \
    --to=shermanpauldylan@gmail.com \
    --cc=alex@ghiti.fr \
    --cc=aou@eecs.berkeley.edu \
    --cc=apatel@ventanamicro.com \
    --cc=hchauhan@ventanamicro.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=pjw@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.