more rcu_read_(un)lock conversions
cover more rcu_read_(un)lock conversions
From: "Dr. David Alan Gilbert" <[email protected]>
Hi,
Two more rcu_read_(un)lock conversions around
virtio stuff.
(to go with, but independent of my previous 'virtio: Use auto rcu_read macros')
I like the way that the virtio-net case simplifies the function a lot.
Dr. David Alan Gilbert (2):
virtio/vhost: Use auto_rcu_read macros
virtio_net: use RCU_READ_LOCK_GUARD
hw/net/virtio-net.c | 7 ++----- hw/virtio/vhost.c | 4 +--- 2 files changed, 3 insertions(+), 8 deletions(-)
Signature · 1 line
2.23.0
PATCH 1/2 virtio/vhost: Use auto_rcu_read macros
From: "Dr. David Alan Gilbert" <[email protected]>
Use RCU_READ_LOCK_GUARD instead of manual rcu_read_(un)lock
--- hw/virtio/vhost.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
hw/virtio/vhost.c +1 -3
@@ -924,7 +924,7 @@ int vhost_device_iotlb_miss(struct vhost_dev *dev, uint64_t iova, int write)uint64_t uaddr, len;int ret = -EFAULT ; -rcu_read_lock (); +RCU_READ_LOCK_GUARD ();trace_vhost_iotlb_miss (dev,1 );
@@ -956,8 +956,6 @@ int vhost_device_iotlb_miss(struct vhost_dev *dev, uint64_t iova, int write)trace_vhost_iotlb_miss (dev,2 ); out: -rcu_read_unlock (); -return ret; }
Signature · 1 line
2.23.0
PATCH 2/2 virtio_net: use RCU_READ_LOCK_GUARD
In reply to Dr. David Alan Gilbert (git)From: "Dr. David Alan Gilbert" <[email protected]>
Use RCU_READ_LOCK_GUARD rather than the manual rcu_read_(un)lock call.
--- hw/net/virtio-net.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
hw/net/virtio-net.c +2 -5
@@ -1369,12 +1369,9 @@ static ssize_t virtio_net_receive_rcu(NetClientState *nc, const uint8_t *buf,static ssize_t virtio_net_do_receive (NetClientState *nc,const uint8_t *buf,size_t size) { -ssize_t r; +RCU_READ_LOCK_GUARD (); -rcu_read_lock (); - r =virtio_net_receive_rcu (nc, buf, size); -rcu_read_unlock (); -return r; +return virtio_net_receive_rcu (nc, buf, size); } static void virtio_net_rsc_extract_unit4(VirtioNetRscChain *chain,
Signature · 1 line
2.23.0
Quoted 9 lines · Dr. David Alan Gilbert (git)
From: "Dr. David Alan Gilbert" <[email protected]>
Hi,
Two more rcu_read_(un)lock conversions around
virtio stuff.
(to go with, but independent of my previous 'virtio: Use autorcu_readmacros')I like the way that the virtio-net case simplifies the function a lot.
Indeed, I'll queue this.
Quoted 10 lines
Dr. David Alan Gilbert (2):
virtio/vhost: Useauto_rcu_readmacros
virtio_net: useRCU_READ_LOCK_GUARDhw/net/virtio-net.c | 7 ++----- hw/virtio/vhost.c | 4 +--- 2 files changed, 3 insertions(+), 8 deletions(-)Signature · 1 line
2.23.0