On Mon, 8 Jul 2024 12:41:03 +0800 Gongming Chen <chengongming1...@outlook.com> wrote:
> diff --git a/lib/vhost/vhost_thread.c b/lib/vhost/vhost_thread.c > new file mode 100644 > index 0000000000..f3ff182976 > --- /dev/null > +++ b/lib/vhost/vhost_thread.c > @@ -0,0 +1,33 @@ > +#include <rte_rwlock.h> > + > +#include "vhost_thread.h" > + > +static rte_rwlock_t vhost_thread_lock = RTE_RWLOCK_INITIALIZER; > + > +void > +vhost_thread_read_lock(void) > + __rte_no_thread_safety_analysis > +{ > + rte_rwlock_read_lock(&vhost_thread_lock); > +} > + > +void > +vhost_thread_read_unlock(void) > + __rte_no_thread_safety_analysis > +{ > + rte_rwlock_read_unlock(&vhost_thread_lock); > +} > + > +void > +vhost_thread_write_lock(void) > + __rte_no_thread_safety_analysis > +{ > + rte_rwlock_write_lock(&vhost_thread_lock); > +} > + > +void > +vhost_thread_write_unlock(void) > + __rte_no_thread_safety_analysis > +{ > + rte_rwlock_write_unlock(&vhost_thread_lock); > +} Looking at the back catalog and spotted this. What is the reason for moving all the vhost_thread locks into a file? Also turning off thread safety is a bad idea. And mixing DPDK locks with pthread mutex is not wise either. This is not going to be critical path so why not use a pthread_mutex?