[PATCH v22.11] vhost: fix missing spinlock unlock

David Marchand david.marchand at redhat.com
Thu Jan 11 12:10:33 CET 2024


On Thu, Jan 11, 2024 at 11:52 AM Maxime Coquelin
<maxime.coquelin at redhat.com> wrote:
>
> Two regressions were introduced when backporting below
> patch:
> b4c4e5675c85 ("vhost: fix missing lock protection in power monitor API")
>
> First, rte_vhost_get_monitor_addr did not release the lock
> in the success case. Then, rte_rwlock_read_lock() was
> converted to rte_spinlock_trylock() instead of
> rte_spinlock_lock().
>
> This patch addresses both of these issues.
>

Bugzilla ID: 1338
> Fixes: a07736eb68da ("vhost: fix missing lock protection in power monitor API")
> Cc: stable at dpdk.org
>
> Signed-off-by: Maxime Coquelin <maxime.coquelin at redhat.com>


I backported the lock annotations for the vhost lib in 22.11.
Indeed, clang reports a deadlock in this part of the code which likely
explains the bug report.

[1/2] Compiling C object lib/librte_vhost.a.p/vhost_vhost.c.o
../lib/vhost/vhost.c:2092:1: warning: mutex 'vq->access_lock' is not
held on every path through here [-Wthread-safety-analysis]
}
^
../lib/vhost/vhost.c:2061:7: note: mutex acquired here
        if (!rte_spinlock_trylock(&vq->access_lock))
             ^
1 warning generated.
[2/2] Linking static target lib/librte_vhost.a


I applied this patch and the issue is gone.

Tested-by: David Marchand <david.marchand at redhat.com>

Can the bz reporter test this patch?


-- 
David Marchand



More information about the stable mailing list