Page MenuHomeFreeBSD

HyperV/vmm: improve locking of hv_ring_buffer
AbandonedPublic

Authored by howard0su_gmail.com on Feb 2 2016, 5:10 AM.
Tags
None
Referenced Files
F151589440: D5164.diff
Thu, Apr 9, 9:04 AM
Unknown Object (File)
Thu, Apr 2, 2:32 PM
Unknown Object (File)
Sat, Mar 28, 11:46 AM
Unknown Object (File)
Wed, Mar 18, 2:19 PM
Unknown Object (File)
Sat, Mar 14, 8:33 PM
Unknown Object (File)
Sat, Mar 14, 5:00 PM
Unknown Object (File)
Thu, Mar 12, 10:19 PM
Unknown Object (File)
Feb 26 2026, 2:09 PM

Details

Summary
  1. convert spin lock to def lock
  2. reading always happen in single thread, remove lock protection

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 2358
Build 2374: arc lint + arc unit

Event Timeline

howard0su_gmail.com retitled this revision from to HyperV/vmm: improve locking of hv_ring_buffer.
howard0su_gmail.com updated this object.
howard0su_gmail.com edited the test plan for this revision. (Show Details)
sepherosa_gmail.com edited edge metadata.

Seems reasonable to me

This revision is now accepted and ready to land.Feb 5 2016, 12:17 PM
sys/dev/hyperv/vmbus/hv_ring_buffer.c
357

So this is nit picking, but do yo need memory barriers here if you intend to peek? the lock ends up being effectively a memory barrier..

No. Since read/peek are happened in single thread, no mb is needed. Peek is just a normal read except it copies less data and doesn't advance the read position.

I just double checked the code. It is not MPSAFE to process the recv ring w/o lock, e.g. storvsc_poll(), which could be called in another thread. I think the spinlock -> default mtx change should be fine.

I just double checked the code. It is not MPSAFE to process the recv ring w/o lock, e.g. storvsc_poll(), which could be called in another thread. I think the spinlock -> default mtx change should be fine.

I think we could pass a flag down to the recv ring read/peek, so that we could do lockless read for other drivers.