Skip to contentSkip to conversation

lib: sbi_hsm: Put the resume_pending hart in the interruptible hart mask

PATCH New Nick Hu 3 participants 3 messages Dec 1, 2023 – Dec 10, 2023

lore
Share & tools
lore

Nick Hu

author
#0 lore raw

PATCH 1/1 lib: sbi_hsm: Put the resume_pending hart in the interruptible hart mask

Current interruptible hart mask doesn't include the hart which HSM state is SBI_HSM_STATE_RESUME_PENDING. So when there is a request to send an IPI to the hart which is in the resume process, this hart would miss the IPI forever. Put the SBI_HSM_STATE_RESUME_PENDING hart in the interruptible hart mask to fix the issue.

---
 lib/sbi/sbi_hsm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
lib/sbi/sbi_hsm.c +2 -1
index 147f954..3d60ceb 100644
@@ -128,7 +128,8 @@ int sbi_hsm_hart_interruptible_mask(const struct sbi_domain *dom,
 
 		hstate = __sbi_hsm_hart_get_state(hbase + i);
 		if (hstate == SBI_HSM_STATE_STARTED ||
-		    hstate == SBI_HSM_STATE_SUSPENDED)
+		    hstate == SBI_HSM_STATE_SUSPENDED ||
+		    hstate == SBI_HSM_STATE_RESUME_PENDING)
 			*out_hmask |= hmask;
 	}
 
Signature · 1 line
2.34.1
#1 lore raw

PATCH 1/1 lib: sbi_hsm: Put the resume_pending hart in the interruptible hart mask

? 2023-12-01???? 17:51 +0800?Nick Hu???

Quoted 7 lines

Current interruptible hart mask doesn't include the hart which HSM state is SBI_HSM_STATE_RESUME_PENDING. So when there is a request to send an IPI to the hart which is in the resume process, this hart would miss the IPI forever. Put the SBI_HSM_STATE_RESUME_PENDING hart in the interruptible hart mask to fix the issue.

LGTM

Quoted 22 lines

---
?lib/sbi/sbi_hsm.c | 3 ++-
?1 file changed, 2 insertions(+), 1 deletion(-)

lib/sbi/sbi_hsm.c +0 -0
index 147f954..3d60ceb 100644
@@ -128,7 +128,8 @@ int sbi_hsm_hart_interruptible_mask(const struct sbi_domain *dom,

?
? hstate = __sbi_hsm_hart_get_state(hbase + i);
? if (hstate == SBI_HSM_STATE_STARTED ||

lib/sbi/sbi_hsm.c +2 -1
-		??? hstate == SBI_HSM_STATE_SUSPENDED)
+		??? hstate == SBI_HSM_STATE_SUSPENDED ||
+		??? hstate == SBI_HSM_STATE_RESUME_PENDING)

? *out_hmask |= hmask;
? }
?

Signature · 1 line
2.34.1
Applied
#2 lore raw

PATCH 1/1 lib: sbi_hsm: Put the resume_pending hart in the interruptible hart mask

In reply to Nick Hu
Quoted 8 lines · On Fri, Dec 1, 2023 at 3:22?PM Nick Hu <[email protected]> wrote:

Current interruptible hart mask doesn't include the hart which HSM state is SBI_HSM_STATE_RESUME_PENDING. So when there is a request to send an IPI to the hart which is in the resume process, this hart would miss the IPI forever. Put the SBI_HSM_STATE_RESUME_PENDING hart in the interruptible hart mask to fix the issue.

Looks good to me.

Applied this patch to the riscv/opensbi repo.

Thanks,
Anup

Quoted 26 lines
---
 lib/sbi/sbi_hsm.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
lib/sbi/sbi_hsm.c +2 -2
index 147f954..3d60ceb 100644
@@ -128,7 +128,8 @@ int sbi_hsm_hart_interruptible_mask(const struct sbi_domain *dom,
 
                hstate = __sbi_hsm_hart_get_state(hbase + i);
                if (hstate == SBI_HSM_STATE_STARTED ||
-                   hstate == SBI_HSM_STATE_SUSPENDED)
+                   hstate == SBI_HSM_STATE_SUSPENDED ||
+                   hstate == SBI_HSM_STATE_RESUME_PENDING)
                        *out_hmask |= hmask;
        }
 
--

2.34.1

--
opensbi mailing list
opensbi at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/opensbi