[PATCH 1/3] hw/virtio: Document virtio_queue_packed_empty_rcu is called within RCU

Philippe Mathieu-Daudé posted 3 patches 4 years, 5 months ago
There is a newer version of this series
[PATCH 1/3] hw/virtio: Document virtio_queue_packed_empty_rcu is called within RCU
Posted by Philippe Mathieu-Daudé 4 years, 5 months ago
While virtio_queue_packed_empty_rcu() uses the '_rcu' suffix,
it is not obvious it is called within rcu_read_lock(). All other
functions from this file called with the RCU locked have a comment
describing it. Document this one similarly for consistency.

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 hw/virtio/virtio.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 874377f37a7..a5214bca612 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -634,6 +634,7 @@ static int virtio_queue_split_empty(VirtQueue *vq)
     return empty;
 }
 
+/* Called within rcu_read_lock().  */
 static int virtio_queue_packed_empty_rcu(VirtQueue *vq)
 {
     struct VRingPackedDesc desc;
-- 
2.31.1

Re: [PATCH 1/3] hw/virtio: Document virtio_queue_packed_empty_rcu is called within RCU
Posted by Stefano Garzarella 4 years, 5 months ago
On Thu, Aug 26, 2021 at 07:26:56PM +0200, Philippe Mathieu-Daudé wrote:
>While virtio_queue_packed_empty_rcu() uses the '_rcu' suffix,
>it is not obvious it is called within rcu_read_lock(). All other
>functions from this file called with the RCU locked have a comment
>describing it. Document this one similarly for consistency.
>
>Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
>---
> hw/virtio/virtio.c | 1 +
> 1 file changed, 1 insertion(+)
>
>diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
>index 874377f37a7..a5214bca612 100644
>--- a/hw/virtio/virtio.c
>+++ b/hw/virtio/virtio.c
>@@ -634,6 +634,7 @@ static int virtio_queue_split_empty(VirtQueue *vq)
>     return empty;
> }
>
>+/* Called within rcu_read_lock().  */
> static int virtio_queue_packed_empty_rcu(VirtQueue *vq)
> {
>     struct VRingPackedDesc desc;
>-- 
>2.31.1
>
>

Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>


Re: [PATCH 1/3] hw/virtio: Document virtio_queue_packed_empty_rcu is called within RCU
Posted by Stefan Hajnoczi 4 years, 5 months ago
On Thu, Aug 26, 2021 at 07:26:56PM +0200, Philippe Mathieu-Daudé wrote:
> While virtio_queue_packed_empty_rcu() uses the '_rcu' suffix,
> it is not obvious it is called within rcu_read_lock(). All other
> functions from this file called with the RCU locked have a comment
> describing it. Document this one similarly for consistency.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  hw/virtio/virtio.c | 1 +
>  1 file changed, 1 insertion(+)

Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>