Skip to content

lib: sbi_ipi: Validate hartids against domain, not HSM state#13

Merged
cp0613 merged 1 commit into
XUANTIE-RV:opensbi-v1.7-devfrom
cp0613:opensbi-v1.7-dev
Jun 18, 2026
Merged

lib: sbi_ipi: Validate hartids against domain, not HSM state#13
cp0613 merged 1 commit into
XUANTIE-RV:opensbi-v1.7-devfrom
cp0613:opensbi-v1.7-dev

Conversation

@cp0613

@cp0613 cp0613 commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

Commit 37eaca4 ("lib: sbi_ipi: Return error for invalid hartids") added a weight check against the HSM-interruptible mask, which excludes harts in STOPPED state. This causes sbi_ipi_send_many() to return SBI_EINVAL when the kernel sends a remote fence (e.g. TLB shootdown) whose hmask includes a hart that was stopped by CPU hotplug:

__sbi_rfence_v02_call: hbase = [0] hmask = [0x3] failed (error [-22])

Validate requested hartids against the domain's assigned hartmask instead. This still rejects truly invalid or cross-domain hartids, but allows HSM-STOPPED harts to be silently skipped — which is safe because a stopped hart will do a full local TLB flush on its next HSM start before re-entering S-mode.

Fixes: 37eaca4 ("lib: sbi_ipi: Return error for invalid hartids")

Commit 37eaca4 ("lib: sbi_ipi: Return error for invalid hartids")
added a weight check against the HSM-interruptible mask, which excludes
harts in STOPPED state. This causes sbi_ipi_send_many() to return
SBI_EINVAL when the kernel sends a remote fence (e.g. TLB shootdown)
whose hmask includes a hart that was stopped by CPU hotplug:

  __sbi_rfence_v02_call: hbase = [0] hmask = [0x3] failed (error [-22])

Validate requested hartids against the domain's assigned hartmask
instead. This still rejects truly invalid or cross-domain hartids, but
allows HSM-STOPPED harts to be silently skipped — which is safe because
a stopped hart will do a full local TLB flush on its next HSM start
before re-entering S-mode.

Fixes: 37eaca4 ("lib: sbi_ipi: Return error for invalid hartids")
Signed-off-by: Chen Pei <cp0613@linux.alibaba.com>
@cp0613 cp0613 merged commit 2dce4b4 into XUANTIE-RV:opensbi-v1.7-dev Jun 18, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant