Linux-RISC-V Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Zhan Xusheng <zhanxusheng1024@gmail.com>
To: Jimmy Ho <jimmy.ho@sifive.com>, Paul Walmsley <pjw@kernel.org>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Albert Ou <aou@eecs.berkeley.edu>
Cc: Zhan Xusheng <zhanxusheng@xiaomi.com>,
	Alexandre Ghiti <alex@ghiti.fr>,
	Hui Wang <hui.wang@canonical.com>,
	Ben Dooks <ben.dooks@codethink.co.uk>,
	Samuel Holland <samuel.holland@sifive.com>,
	linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] riscv: cpu_ops_sbi: retry checking if CPU is stopped
Date: Sat,  8 Aug 2026 19:47:58 +0800	[thread overview]
Message-ID: <20260808114759.1677578-1-zhanxusheng@xiaomi.com> (raw)
In-Reply-To: <20260808063242.20178-1-jimmy.ho@sifive.com>

On Sat,  8 Aug 2026 14:32:41 +0800, Jimmy Ho wrote:
> + start = jiffies;
> + end = start + msecs_to_jiffies(100);
> + do {
> +   rc = sbi_hsm_hart_get_status(hartid);
> +   if (rc == SBI_HSM_STATE_STOPPED)
> +     break;
> +
> +   usleep_range(100, 1000);
> + } while (time_before(jiffies, end));

This is cpu_psci_cpu_kill() from arch/arm64/kernel/psci.c, down to the
locals, both delay values and the closing line of the comment.  Please
say so in the commit message.  Right now the 100 ms reads as a bound
derived from something about HSM, and it is not -- it is the arm64 PSCI
value.  Naming the precedent is a better defence of it than silence.

You also dropped arm64's report of how long the poll took.  Deliberate?
It is jiffy-granular, so in the good case it just prints 0 ms, and the
caller already emits "CPU%u: off" -- but it is also the only way anyone
ever learns whether 100 ms is close to what real firmware needs.  As it
stands @start exists only to compute @end.

Separately, sbi_hsm_hart_get_status() returns a negative errno when the
ecall fails, not an HSM state, so a bad hartid gets polled for the full
100 ms.  Worth breaking out on rc < 0.

Thanks,
Zhan Xusheng

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

      reply	other threads:[~2026-08-08 11:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-08  6:32 [PATCH] riscv: cpu_ops_sbi: retry checking if CPU is stopped Jimmy Ho
2026-08-08 11:47 ` Zhan Xusheng [this message]

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=20260808114759.1677578-1-zhanxusheng@xiaomi.com \
    --to=zhanxusheng1024@gmail.com \
    --cc=alex@ghiti.fr \
    --cc=aou@eecs.berkeley.edu \
    --cc=ben.dooks@codethink.co.uk \
    --cc=hui.wang@canonical.com \
    --cc=jimmy.ho@sifive.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=pjw@kernel.org \
    --cc=samuel.holland@sifive.com \
    --cc=zhanxusheng@xiaomi.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