* [PATCH 0/2] more rcu_read_(un)lock conversions
@ 2019-10-25 10:34 Dr. David Alan Gilbert (git)
2019-10-25 10:34 ` [PATCH 1/2] virtio/vhost: Use auto_rcu_read macros Dr. David Alan Gilbert (git)
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2019-10-25 10:34 UTC (permalink / raw)
To: qemu-devel, mst, jasowang
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
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(-)
--
2.23.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] virtio/vhost: Use auto_rcu_read macros
2019-10-25 10:34 [PATCH 0/2] more rcu_read_(un)lock conversions Dr. David Alan Gilbert (git)
@ 2019-10-25 10:34 ` Dr. David Alan Gilbert (git)
2019-10-25 10:34 ` [PATCH 2/2] virtio_net: use RCU_READ_LOCK_GUARD Dr. David Alan Gilbert (git)
2019-10-25 11:50 ` [PATCH 0/2] more rcu_read_(un)lock conversions Michael S. Tsirkin
2 siblings, 0 replies; 4+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2019-10-25 10:34 UTC (permalink / raw)
To: qemu-devel, mst, jasowang
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Use RCU_READ_LOCK_GUARD instead of manual rcu_read_(un)lock
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
hw/virtio/vhost.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index 99de5f196f..4da0d5a6c5 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -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;
}
--
2.23.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] virtio_net: use RCU_READ_LOCK_GUARD
2019-10-25 10:34 [PATCH 0/2] more rcu_read_(un)lock conversions Dr. David Alan Gilbert (git)
2019-10-25 10:34 ` [PATCH 1/2] virtio/vhost: Use auto_rcu_read macros Dr. David Alan Gilbert (git)
@ 2019-10-25 10:34 ` Dr. David Alan Gilbert (git)
2019-10-25 11:50 ` [PATCH 0/2] more rcu_read_(un)lock conversions Michael S. Tsirkin
2 siblings, 0 replies; 4+ messages in thread
From: Dr. David Alan Gilbert (git) @ 2019-10-25 10:34 UTC (permalink / raw)
To: qemu-devel, mst, jasowang
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Use RCU_READ_LOCK_GUARD rather than the manual rcu_read_(un)lock call.
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
---
hw/net/virtio-net.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 9f11422337..80622861a8 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -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,
--
2.23.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 0/2] more rcu_read_(un)lock conversions
2019-10-25 10:34 [PATCH 0/2] more rcu_read_(un)lock conversions Dr. David Alan Gilbert (git)
2019-10-25 10:34 ` [PATCH 1/2] virtio/vhost: Use auto_rcu_read macros Dr. David Alan Gilbert (git)
2019-10-25 10:34 ` [PATCH 2/2] virtio_net: use RCU_READ_LOCK_GUARD Dr. David Alan Gilbert (git)
@ 2019-10-25 11:50 ` Michael S. Tsirkin
2 siblings, 0 replies; 4+ messages in thread
From: Michael S. Tsirkin @ 2019-10-25 11:50 UTC (permalink / raw)
To: Dr. David Alan Gilbert (git); +Cc: jasowang, qemu-devel
On Fri, Oct 25, 2019 at 11:34:01AM +0100, Dr. David Alan Gilbert (git) wrote:
> From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
>
> 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.
Indeed, I'll queue this.
> 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(-)
>
> --
> 2.23.0
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-10-25 11:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-25 10:34 [PATCH 0/2] more rcu_read_(un)lock conversions Dr. David Alan Gilbert (git)
2019-10-25 10:34 ` [PATCH 1/2] virtio/vhost: Use auto_rcu_read macros Dr. David Alan Gilbert (git)
2019-10-25 10:34 ` [PATCH 2/2] virtio_net: use RCU_READ_LOCK_GUARD Dr. David Alan Gilbert (git)
2019-10-25 11:50 ` [PATCH 0/2] more rcu_read_(un)lock conversions Michael S. Tsirkin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).