CHERIoT ASR-faulting CSR read counted as retired on WritebackStage=0
Maintainer thường phản hồi trong vòng 2 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 46/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Lĩnh vực
- backend
Hướng nghiên cứu
Start with the reported paths in ibex_wb_stage.sv, ibex_id_stage.sv, and ibex_controller.sv, then compare how CHERIoT faults affect instr_perf_count_id_o and perf_instr_ret_wb_o when WritebackStage=0. Reproduce with the attached csr_asr_minstret.S testcase and compare the mscratch retired count across both configurations. Done means the faulting CSR read does not retire in wb0, matching the expected count of 43.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Observed Behavior
In CHERIoT mode with WritebackStage=0, csrr mscratch raises a Permit_Access_System_Registers exception and is included in the retired-instruction count. The other test reads cycle. Only the CSR read differs.
| build | CSR read | retired | trap? | record (mcause, mtval, rd) |
|---|---|---|---|---|
tag_zeros (WritebackStage=1) |
cycle |
37 | no | 0x0, 0x0, 0x21 |
tag_zeros (WritebackStage=1) |
mscratch |
43 | yes | 0x1c, 0x418, 0x0 |
wb0 (WritebackStage=0) |
cycle |
37 | no | 0x0, 0x0, 0x24 |
wb0 (WritebackStage=0) |
mscratch |
44 | yes | 0x1c, 0x418, 0x0 |
On the cycle rows the third word is the counter value the test stores.
Expected Behavior
Per the RISC-V Privileged Specification, "Hardware Performance Monitor" (machine.adoc, Zicntr):
The
minstretCSR counts the number of instructions the hart has retired.
An instruction that raises an exception does not retire. The wb0 mscratch row should retire 43, the same as tag_zeros.
Steps to reproduce the issue
cheriot_enable_itied on inexamples/simple_system/rtl/ibex_simple_system.sv.RV32E=0,SecureIbex=0.tag_zeros:WritebackStage=1.wb0:WritebackStage=0.riscv64-unknown-elf-gcc13.2.0,-march=rv32imc_zicsr -mabi=ilp32.csr_asr_minstret.Sandlink.ldare attached.
GCC=riscv64-unknown-elf-gcc
SIM_TAG=/path/to/build_tag_zeros/sim-verilator/Vibex_simple_system
SIM_WB0=/path/to/build_wb0/sim-verilator/Vibex_simple_system
for c in 1 2; do
$GCC -march=rv32imc_zicsr -mabi=ilp32 -nostdlib -nostartfiles \
-DCASE=$c -T link.ld \
-o csr_asr_case$c.elf csr_asr_minstret.S
done
for build in tag_zeros wb0; do
for c in 1 2; do
mkdir -p runs/${build}_case$c
( cd runs/${build}_case$c && \
timeout 120 "$SIM_${build^^}" \
--meminit=ram,csr_asr_case$c.elf -c 20000 > sim.out 2>&1 )
grep -aE 'Instructions Retired|Cycles' \
runs/${build}_case$c/ibex_simple_system_pcount.csv
python3 rec.py runs/${build}_case$c/trace_core_00000000.log
done
done
tag_zeros case1: Cycles,44 Instructions Retired,37
tag_zeros case2: Cycles,54 Instructions Retired,43
wb0 case1: Cycles,48 Instructions Retired,37
wb0 case2: Cycles,59 Instructions Retired,44
Attached: csr_asr_minstret.S, link.ld, csr_asr_case1.elf, csr_asr_case2.elf, rec.py, and logs/tag_zeros_case1/, logs/tag_zeros_case2/, logs/wb0_case1/, logs/wb0_case2/ (each has pcount.csv and trace.log).
My Environment
EDA tool and version: Verilator (Vibex_simple_system elaborations).
Operating system: Linux 6.8.0-90-generic x86_64.
Version of the Ibex source code: d513671dae09e701ceb6cd732d2da5fb52c13856. The only source change is the cheriot_enable_i tie-off above.
With WritebackStage=0, perf_instr_ret_wb_o is instr_perf_count_id_i & en_wb_i & ~dummy_instr_wb_o & ~(lsu_resp_valid_i & lsu_resp_err_i) (ibex_wb_stage.sv:269). instr_perf_count_id_o (ibex_id_stage.sv:1209) does not include cheriot_asr_err_d (ibex_controller.sv:269). cheriot_wb_err_i is unused (ibex_wb_stage.sv:294).
#2552 (fab0d86) masks CHERIoT faults raised in writeback, and says traps raised in ID are never counted. This fault is csrr mscratch in ID.
- Ngôn ngữ chính
- SystemVerilog
- Star
- 2.2k
- Fork
- 836
- Merge trung bình
- 5 ngày 8 giờ
- Pull request đã merge (30 ngày)
- 22
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của lowRISC/ibex
-
[Bug Report] rvfi_intr is not set on the first instruction of an exception handlerCó thể đã có người làm @h-filali đã nhận 7 ngày trước. Đang mởType:Bug
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 68/100
lowRISC/ibex#2556 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Type:Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
lowRISC/ibex#2528 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
mip documentation errorĐang mởType:Bug
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 2 ngày
-
[doc] Document basic commands for running/checking IbexCó thể đã có người làm @shrutikbalwan đã nhận 47 ngày trước. Đang mởComponent:Doc Good First Issue Type:Task
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
lowRISC/ibex#741 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 42/100
Maintainer thường phản hồi trong vòng 2 ngày
Issue tương tự
-
parse: child keys like `007`, `1e3`, `0x1f`, `-1` make the parent an empty array and hide the valueĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
OCA/account-invoicing#2529 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
jlcodes99/cockpit-tools#3125 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
deadfin-org/deadfin#35 ·