On Wed, 24 Jan 2024 09:42, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>Replace the manual rcu_read_(un)lock calls by the
>WITH_RCU_READ_LOCK_GUARD macro (See commit ef46ae67ba
>"docs/style: call out the use of GUARD macros").
>
>Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>---
> hw/virtio/vhost.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
>diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
>index 2c9ac79468..1f5ecb843e 100644
>--- a/hw/virtio/vhost.c
>+++ b/hw/virtio/vhost.c
>@@ -186,12 +186,12 @@ static int vhost_sync_dirty_bitmap(struct vhost_dev *dev,
> hwaddr phys, s, offset;
>
> while (used_size) {
>- rcu_read_lock();
>- iotlb = address_space_get_iotlb_entry(dev->vdev->dma_as,
>+ WITH_RCU_READ_LOCK_GUARD() {
>+ iotlb = address_space_get_iotlb_entry(dev->vdev->dma_as,
> used_phys,
> true,
> MEMTXATTRS_UNSPECIFIED);
>- rcu_read_unlock();
>+ }
>
> if (!iotlb.target_as) {
> qemu_log_mask(LOG_GUEST_ERROR, "translation "
>--
>2.41.0
>
Reviewed-by: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>