[RFC PATCH v2 0/9] vhost lock annotations
David Marchand
david.marchand at redhat.com
Wed Mar 30 15:49:47 CEST 2022
vhost internals involves multiple locks to protect data access by
multiple threads.
This series is a try at using clang thread safety checks [1] to catch
issues during compilation: EAL spinlock and rwlock are annotated and
vhost code is instrumented so that clang can statically check
correctness.
This is still a work in progress (some documentation and a release note
update are missing).
Those annotations are quite heavy to maintain because the full path of
code must be annotated, but I think it is worth using.
1: https://clang.llvm.org/docs/ThreadSafetyAnalysis.html
--
David Marchand
Changes since RFC v1:
- Cc'd people who have pending patches for vhost,
- moved annotations to EAL and removed wrappers in vhost,
- as a result of moving to EAL, this series will be tested against
the main repo, so patch 1 has been kept as part of the series
even if already applied to next-virtio,
- refined/split patches and annotated all spinlocks in vhost,
David Marchand (8):
eal: annotate spinlock and rwlock
vhost: annotate virtqueue access lock
vhost: fix async access
vhost: annotate async acesses
vhost: annotate need reply handling
vhost: annotate VDPA device list accesses
vhost: annotate IOTLB locks
vhost: enable lock check
Maxime Coquelin (1):
vhost: fix missing virtqueue lock protection
drivers/meson.build | 5 ++
lib/eal/arm/include/rte_rwlock.h | 4 ++
lib/eal/arm/include/rte_spinlock.h | 6 ++
lib/eal/include/generic/rte_rwlock.h | 21 ++++---
lib/eal/include/generic/rte_spinlock.h | 19 ++++--
lib/eal/include/meson.build | 1 +
lib/eal/include/rte_lock_annotations.h | 67 +++++++++++++++++++++
lib/eal/ppc/include/rte_rwlock.h | 4 ++
lib/eal/ppc/include/rte_spinlock.h | 9 +++
lib/eal/x86/include/rte_rwlock.h | 4 ++
lib/eal/x86/include/rte_spinlock.h | 9 +++
lib/meson.build | 5 ++
lib/vhost/iotlb.h | 8 +++
lib/vhost/meson.build | 2 +
lib/vhost/vdpa.c | 18 +++---
lib/vhost/vhost.c | 54 +++++++++--------
lib/vhost/vhost.h | 26 ++++++---
lib/vhost/vhost_crypto.c | 7 +++
lib/vhost/vhost_user.c | 6 ++
lib/vhost/virtio_net.c | 80 ++++++++++++++++++++------
20 files changed, 287 insertions(+), 68 deletions(-)
create mode 100644 lib/eal/include/rte_lock_annotations.h
--
2.23.0
More information about the dev
mailing list