Skip to content

sync: rvck #116: Collect guest/host statistics during the redirected traps#167

Merged
xmzzz merged 4 commits into
OLK-6.6from
sync/rvck-pr-116
Apr 8, 2026
Merged

sync: rvck #116: Collect guest/host statistics during the redirected traps#167
xmzzz merged 4 commits into
OLK-6.6from
sync/rvck-pr-116

Conversation

@xmzzz
Copy link
Copy Markdown
Contributor

@xmzzz xmzzz commented Apr 8, 2026

Sync commits from rvck PR #116.

Source PR: RVCK-Project/rvck#116

Commits

  • 30d66309150c RISC-V: KVM: Redirect AMO load/store access fault traps to guest
  • 7b071e109258 RISC-V: KVM: Redirect instruction access fault trap to guest
  • 9dbd5aaa1151 RISC-V: KVM: Update firmware counters for various events
  • 207e152565e3 RISC-V: KVM: Add new exit statstics for redirected traps

betterman5240 and others added 4 commits April 8, 2026 14:59
mainline inclusion
from Linux 6.13
commit e325618349cdc1fbbe63574080249730e7cff9ea
category: feature
bugzilla: RVCK-Project/rvck#115

--------------------------------

The KVM RISC-V does not delegate AMO load/store access fault traps to
VS-mode (hedeleg) so typically M-mode takes these traps and redirects
them back to HS-mode. However, upon returning from M-mode, the KVM
RISC-V running in HS-mode terminates VS-mode software.
The KVM RISC-V should redirect AMO load/store access fault traps back
to VS-mode and let the VS-mode trap handler determine the next steps.

Signed-off-by: Yu-Wei Hsu <betterman5240@gmail.com>
Signed-off-by: Anup Patel <anup@brainfault.org>
Signed-off-by: yechao-w <wang.yechao255@zte.com.cn>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
(cherry picked from commit 30d6630)
mainline inclusion
from Linux 6.13
commit 51c58956732bb20c5782dea1b2966270827e3aa2
category: feature
bugzilla: RVCK-Project/rvck#115

--------------------------------

The M-mode redirects an unhandled instruction access
fault trap back to S-mode when not delegating it to
VS-mode(hedeleg). However, KVM running in HS-mode
terminates the VS-mode software when back from M-mode.
The KVM should redirect the trap back to VS-mode, and
let VS-mode trap handler decide the next step.

Signed-off-by: Quan Zhou <zhouquan@iscas.ac.cn>
Signed-off-by: Atish Patra <atishp@rivosinc.com>
Signed-off-by: Anup Patel <anup@brainfault.org>
Signed-off-by: yechao-w <wang.yechao255@zte.com.cn>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
(cherry picked from commit 7b071e1)
mainline inclusion
from Linux 6.13
commit 2f15b5eaff79b70b004b0aae79dee62d3b3abda0
category: feature
bugzilla: RVCK-Project/rvck#115

--------------------------------

SBI PMU specification defines few firmware counters which can be
used by the guests to collect the statstics about various traps
occurred in the host.
Update these counters whenever a corresponding trap is taken

Signed-off-by: Atish Patra <atishp@rivosinc.com>
Signed-off-by: Anup Patel <anup@brainfault.org>
Signed-off-by: yechao-w <wang.yechao255@zte.com.cn>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
(cherry picked from commit 9dbd5aa)
mainline inclusion
from Linux 6.13
commit af79caa83f6aa41e9092292a2ba7f701e57353ec
category: feature
bugzilla: RVCK-Project/rvck#115

--------------------------------

Currently, kvm doesn't delegate the few traps such as misaligned
load/store, illegal instruction and load/store access faults because it
is not expected to occur in the guest very frequently. Thus, kvm gets a
chance to act upon it or collect statistics about it before redirecting
the traps to the guest.
Collect both guest and host visible statistics during the traps.
Enable them so that both guest and host can collect the stats about
them if required.

Signed-off-by: Atish Patra <atishp@rivosinc.com>
Signed-off-by: Anup Patel <anup@brainfault.org>
Signed-off-by: yechao-w <wang.yechao255@zte.com.cn>
Signed-off-by: Yanteng Si <si.yanteng@linux.dev>
Signed-off-by: Mingzheng Xing <xingmingzheng@iscas.ac.cn>
(cherry picked from commit 207e152)
@xmzzz xmzzz merged commit be7f7c5 into OLK-6.6 Apr 8, 2026
@xmzzz xmzzz deleted the sync/rvck-pr-116 branch April 8, 2026 07:00
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 8, 2026


开始测试 log: https://github.com/RVCK-Project/rvck-olk/actions/runs/24122386042

参数解析结果
args value
repository RVCK-Project/rvck-olk
head ref pull/167/head
base ref OLK-6.6
LAVA repo RVCK-Project/lavaci
LAVA Template lava-job-template/qemu/qemu-ltp.yaml
Testcase path lava-testcases/common-test/ltp/ltp.yaml
need run job kunit-test,kernel-build,check-patch,lava-trigger

测试完成

详细结果:

RVCK result

check result
kunit-test success
kernel-build failure
lava-trigger skipped
check-patch success

Kunit Test Result

[07:05:05] Testing complete. Ran 454 tests: passed: 442, skipped: 12

Kernel Build Result

Kernel build failed.

Check Patch Result

Total Errors 0
Total Warnings 0

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.

4 participants