[PATCH] softmmu/vl: Include "qemu/rcu.h" for rcu_disable_atfork()

Philippe Mathieu-Daudé posted 1 patch 3 years, 9 months ago
Test checkpatch passed
Test docker-mingw@fedora passed
Test FreeBSD passed
Test docker-quick@centos7 passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20200709133411.23929-1-philmd@redhat.com
softmmu/vl.c | 1 +
1 file changed, 1 insertion(+)
[PATCH] softmmu/vl: Include "qemu/rcu.h" for rcu_disable_atfork()
Posted by Philippe Mathieu-Daudé 3 years, 9 months ago
In commit 73c6e4013b we let vl.c use rcu_disable_atfork()
which is declared in "qemu/rcu.h", but forgot to include
this header. Fortunately has never been a problem since
vl.c includes "exec/memory.h" which includes "qemu/rcu.h".

Include the missing header now in case we split vl.c later.

Fixes: 73c6e4013b ("rcu: disable pthread_atfork callbacks ASAP")
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 softmmu/vl.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/softmmu/vl.c b/softmmu/vl.c
index ecbc18ba75..f243745c51 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -83,6 +83,7 @@
 #include "qemu/config-file.h"
 #include "qemu-options.h"
 #include "qemu/main-loop.h"
+#include "qemu/rcu.h"
 #ifdef CONFIG_VIRTFS
 #include "fsdev/qemu-fsdev.h"
 #endif
-- 
2.21.3


Re: [PATCH] softmmu/vl: Include "qemu/rcu.h" for rcu_disable_atfork()
Posted by Alexander Bulekov 3 years, 9 months ago
Reviewed-by: Alexander Bulekov <alxndr@bu.edu>

If rcu.h should be explicitly included, should any of these other files
that reference the rcu but do not explicitly #include qemu/rcu.h also
get such includes?

util/qht.c
166:    struct rcu_head rcu;

migration/savevm.c
1822:    rcu_register_thread();

util/log.c
43:    rcu_read_lock();

linux-user/syscall.c
6000:    rcu_register_thread();

hw/virtio/virtio.c
74:    struct rcu_head rcu;

target/arm/kvm.c
998:    rcu_read_lock();

On 200709 1534, Philippe Mathieu-Daudé wrote:
> In commit 73c6e4013b we let vl.c use rcu_disable_atfork()
> which is declared in "qemu/rcu.h", but forgot to include
> this header. Fortunately has never been a problem since
> vl.c includes "exec/memory.h" which includes "qemu/rcu.h".
> 
> Include the missing header now in case we split vl.c later.
> 
> Fixes: 73c6e4013b ("rcu: disable pthread_atfork callbacks ASAP")
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
>  softmmu/vl.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/softmmu/vl.c b/softmmu/vl.c
> index ecbc18ba75..f243745c51 100644
> --- a/softmmu/vl.c
> +++ b/softmmu/vl.c
> @@ -83,6 +83,7 @@
>  #include "qemu/config-file.h"
>  #include "qemu-options.h"
>  #include "qemu/main-loop.h"
> +#include "qemu/rcu.h"
>  #ifdef CONFIG_VIRTFS
>  #include "fsdev/qemu-fsdev.h"
>  #endif
> -- 
> 2.21.3
> 
> 

Re: [PATCH] softmmu/vl: Include "qemu/rcu.h" for rcu_disable_atfork()
Posted by Philippe Mathieu-Daudé 3 years, 9 months ago
On 7/9/20 5:25 PM, Alexander Bulekov wrote:
> Reviewed-by: Alexander Bulekov <alxndr@bu.edu>
> 
> If rcu.h should be explicitly included, should any of these other files
> that reference the rcu but do not explicitly #include qemu/rcu.h also
> get such includes?

Personally I think so, yes.

> 
> util/qht.c
> 166:    struct rcu_head rcu;
> 
> migration/savevm.c
> 1822:    rcu_register_thread();
> 
> util/log.c
> 43:    rcu_read_lock();
> 
> linux-user/syscall.c
> 6000:    rcu_register_thread();
> 
> hw/virtio/virtio.c
> 74:    struct rcu_head rcu;
> 
> target/arm/kvm.c
> 998:    rcu_read_lock();
>