Skip to content

riscv: Idle thread using Zawrs extension

Xu Lu linux-riscv lkml 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest2 patches 6 repliesIn review
  2. v2 RFC2 patches 0 repliesSuperseded
  3. v1 RFC2 patches 12 repliesSuperseded

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2riscv: process: Introduce idle thread using Zawrs extensionarch/riscv/Kconfig arch/riscv/include/asm/cpuidle.h arch/riscv/include/asm/processor.h +2 more+74 -116 replies
2/2riscv: Use Zawrs to accelerate IPI to idle cpuarch/riscv/include/asm/processor.h arch/riscv/include/asm/smp.h arch/riscv/kernel/process.c +1 more+131 -130 replies

Reviews trailers per patch

1 of 2 patches has a Reviewed-by or Acked-by.

PatchHangjing LiLiang DengWen Chai
1/2R-b R-b R-b
2/2

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v3 thread

Cover letter [PATCH v3 0/2] riscv: Idle thread using Zawrs extension

This is the third version of idle thread based on Zawrs extension. We noticed that Zawrs is supported in v6.11 now and rebased our code on it. Below is the original description.

This patch series introduces a new implementation of idle thread using Zawrs extension.

The Zawrs[0] extension introduces two new instructions named WRS.STO and WRS.NTO in RISC-V. When software registers a reservation set using LR instruction, a subsequent WRS.STO or WRS.NTO instruction will cause the hart to stall in a low-power state until a store happens to the reservation set or an interrupt becomes pending. The difference between these two instructions is that WRS.STO will terminate stall after an implementation-defined timeout while WRS.NTO won't.

This patch series implements idle thread using WRS.NTO instruction. Besides, we found there is no need to send a real IPI to wake up an idle CPU. Instead, we write IPI information to the reservation set of an idle CPU to wake it up and let it handle IPI quickly, without going through tranditional interrupt handling routine.

[0] https://github.com/riscv/riscv-zawrs/blob/main/zawrs.adoc

Xu Lu (2):
riscv: process: Introduce idle thread using Zawrs extension
riscv: Use Zawrs to accelerate IPI to idle cpu

 arch/riscv/Kconfig                 |  10 +++
 arch/riscv/include/asm/cpuidle.h   |  11 +---
 arch/riscv/include/asm/processor.h |  32 +++++++++
 arch/riscv/include/asm/smp.h       |  14 ++++
 arch/riscv/kernel/cpu.c            |   5 ++
 arch/riscv/kernel/process.c        | 102 ++++++++++++++++++++++++++++-
 arch/riscv/kernel/smp.c            |  51 +++++++++++----
 7 files changed, 203 insertions(+), 22 deletions(-)
Signature · 1 line
2.20.1