CV-Bowen opened a new pull request, #21409:
URL: https://github.com/apache/nuttx/pull/21409

   ## Summary
   
   The `virtqueue_*_lock()` helpers in `include/nuttx/virtio/virtio.h` take
   the driver's spinlock with `spin_lock_irqsave()`, which emits a spinlock
   note when `CONFIG_SCHED_INSTRUMENTATION_SPINLOCKS` is on. If the note
   backend itself sends through a virtio device, the note path enters the
   same helper again and recurses:
   
   ```
   spin_lock_irqsave_notrace (lock=<note backend lock>)
   note_netdev_add (...)
   sched_note_spinlock (spinlock=<virtqueue lock>, type=12)
   spin_lock_irqsave (lock=<virtqueue lock>)
   virtqueue_add_buffer_lock (...)
   virtio_net_addbuffer (...)
   virtio_net_send (...)
   ```
   
   Use `spin_lock_irqsave_notrace()`/`spin_unlock_irqrestore_notrace()` in
   all seven helpers. The syslog interrupt buffer already does the same for
   the same reason.
   
   ## Impact
   
   Spinlock notes are no longer emitted for the virtqueue locks. No other
   behaviour change, no API or Kconfig change.
   
   ## Testing
   
   Host: Ubuntu 22.04.5 LTS x86_64, QEMU version 10.2.1, sim: cc (Ubuntu 
13.1.0-8ubuntu1~22.04) 13.1.0, qemu-armv8a: aarch64-none-elf-gcc (Arm GNU 
Toolchain 12.2.Rel1 (Build arm-12.24)) 12.2.1 20221205
   
   The backtrace above is from a note backend that sends over virtio-net,
   which is not in the tree, so the recursion itself is not reproduced here.
   
   qemu-armv8a:netnsh with `CONFIG_SCHED_INSTRUMENTATION=y` and
   `CONFIG_SCHED_INSTRUMENTATION_SPINLOCKS=y` added (virtio-mmio with
   virtio-net, virtio-blk and virtio-rng): `ping -c 3 10.0.2.2` gets 3 of 3
   replies, a 1 MiB `dd` copy on `/dev/virtblk0` matches the source when
   compared on the host, and `hexdump /dev/random` returns data.
   
   Baseline: No regression in rpmsg: sim:rpserver/rpproxy and 
qemu-armv8a:rpserver/rpproxy boot and pass the fixed rpmsg cases (dump, ping, 
rpmsgfs; 15/15). qemu-armv8a was built with LIBC_ENVPATH and BINFMT_CHECKEXEC 
disabled, which current master needs for nxinit to start nsh there; unrelated 
to this change.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to