riscv-software-src / riscv-software-src/opensbi

Store page fault loop when landing pads are enabled

Open
#400 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
1.5k
Forks
712
PR merge metrics
No merged PRs in 30d

Description

Currently adding landing pad support to an operating system other than linux (https://github.com/IkerGalardi/zeptOS/pull/31/) and running into a page fault loop. The next are logs from qemu when interrupt logging is enabled:

riscv_cpu_do_interrupt: hart:0, async:0, cause:0000000000000012, epc:0x0000003ffffff09c, tval:0x0000000000000002, desc=reserved
riscv_cpu_do_interrupt: hart:0, async:0, cause:000000000000000f, epc:0x0000003ffffff00c, tval:0x0000003fffffe028, desc=store_page_fault
riscv_cpu_do_interrupt: hart:0, async:0, cause:000000000000000f, epc:0x0000003ffffff00c, tval:0x0000003fffffe028, desc=store_page_fault
riscv_cpu_do_interrupt: hart:0, async:0, cause:000000000000000f, epc:0x0000003ffffff00c, tval:0x0000003fffffe028, desc=store_page_fault
riscv_cpu_do_interrupt: hart:0, async:0, cause:000000000000000f, epc:0x0000003ffffff00c, tval:0x0000003fffffe028, desc=store_page_fault
riscv_cpu_do_interrupt: hart:0, async:0, cause:000000000000000f, epc:0x0000003ffffff00c, tval:0x0000003fffffe028, desc=store_page_fault
riscv_cpu_do_interrupt: hart:0, async:0, cause:000000000000000f, epc:0x0000003ffffff00c, tval:0x0000003fffffe028, desc=store_page_fault

Disabling landing pads makes everything work again so must be related to that. The first exception addres 0x3ffffff09c belongs to a fence.vma instruction. Next exceptions are simple stores to a structure saved in the scratch CSR (kernel context?).

Don't really know how to debug this. Tried using the file command on gdb but the firmware seems to be compiled using PIE or PIC so addresses are wrong. Could help debug this issue but I need some indications.

Used software:

  • OpenSBI V1.6
  • GDB Multiarch 15.2
  • Qemu 9.2.3

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the loop with landing pads enabled on OpenSBI V1.6 under QEMU 9.2.3, then trace the fence.vma exception and repeated stores to the structure referenced by the scratch CSR. Use the QEMU interrupt logs and GDB Multiarch 15.2, accounting for the PIE/PIC address layout; done means identifying and correcting the cause of the repeated store page faults.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.