[PATCH v1] RISC-V: take text_mutex during alternative patching

Guenter Roeck linux at roeck-us.net
Wed Feb 15 23:07:29 PST 2023


On 2/15/23 14:00, Heiko Stübner wrote:
[ ... ]
> again with the same variants
> - qemu-riscv32 without zbb
> - qemu-riscv32 with zbb
> - qemu-riscv64 without zbb
> - qemu-riscv64 with zbb
> 
> And all of them booted fine into a nfs-root (debian for riscv64 and a
> buildroot for riscv32).
> 
> I even forced a bug into the zbb code to make sure the patching worked
> correctly (where the kernel failed as expected).
> 
> Qemu-version for me was 7.2.50 (v7.2.0-744-g5a3633929a-dirty)
> 
> I did try the one from Debian-stable (qemu-5.2) but that was too old and
> didn't support Zbb yet.
> 
> One thing of note, the "active" 32bit config I had, somehow didn't produce
> working images and I needed to start a new build using the rv32_defconfig.
> 
> So right now, I'm not sure what more to test though.
> 

Try this:

- Use next-20230216 as base.
- Apply
     RISC-V: take text_mutex during alternative patching
     RISC-V: Don't check text_mutex during stop_machine
   on top of it.
- Configure defconfig + CONFIG_PROVE_LOCKING.
- Run something like
   qemu-system-riscv64 -M virt -m 512M -no-reboot \
     -kernel arch/riscv/boot/Image -initrd rootfs.cpio \
     -append "rdinit=/sbin/init console=ttyS0,115200 earlycon=uart8250,mmio,0x10000000,115200" \
     -nographic -monitor none

That should give you

WARNING: CPU: 0 PID: 0 at kernel/trace/trace_events.c:448 trace_event_raw_init+0xde/0x642
...
event neigh_update has unsafe dereference of argument 9
and lots of follow-up messages.

I tried with qemu v7.2.0 and qemu master (v7.2.0-1434-g6a50f64ca0).

Guenter




More information about the linux-riscv mailing list