[RFC PATCH v3 0/8] vhost lock annotations
David Marchand
david.marchand at redhat.com
Mon Apr 11 13:00:05 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
Depends-on: patch-108840 ("vhost: fix missing virtqueue lock protection")
--
David Marchand
Changes since RFC v2:
- fixed trylock annotations for rwlock,
- annotated _tm flavors of spinlock and rwlock,
- removed Maxime vhost fix from series (since Mimecast does not like
me sending Maxime patch...), added a dependency on original fix
as a hint for reviewers,
- renamed attributes,
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 accesses
vhost: annotate need reply handling
vhost: annotate vDPA device list accesses
vhost: annotate IOTLB locks
vhost: enable lock check
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 | 27 +++++++--
lib/eal/include/generic/rte_spinlock.h | 40 +++++++++----
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 | 50 ++++++++--------
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, 306 insertions(+), 72 deletions(-)
create mode 100644 lib/eal/include/rte_lock_annotations.h
--
2.23.0
More information about the dev
mailing list