kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] accel: Remove system-mode stubs from user-mode builds
@ 2020-11-09  9:45 Philippe Mathieu-Daudé
  2020-11-09  9:45 ` [PATCH 1/3] accel: Only include TCG stubs in user-mode only builds Philippe Mathieu-Daudé
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-11-09  9:45 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Laurent Vivier, kvm, Philippe Mathieu-Daudé

It is pointless to build/link these stubs into user-mode binaries.

Philippe Mathieu-Daudé (3):
  accel: Only include TCG stubs in user-mode only builds
  accel/stubs: Restrict system-mode emulation stubs
  accel/stubs: Simplify kvm-stub.c

 accel/stubs/kvm-stub.c  |  5 -----
 accel/meson.build       | 10 ++++++----
 accel/stubs/meson.build | 12 ++++++++----
 3 files changed, 14 insertions(+), 13 deletions(-)

-- 
2.26.2


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/3] accel: Only include TCG stubs in user-mode only builds
  2020-11-09  9:45 [PATCH 0/3] accel: Remove system-mode stubs from user-mode builds Philippe Mathieu-Daudé
@ 2020-11-09  9:45 ` Philippe Mathieu-Daudé
  2020-11-09  9:55   ` Claudio Fontana
  2020-11-09  9:45 ` [PATCH 2/3] accel/stubs: Restrict system-mode emulation stubs Philippe Mathieu-Daudé
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-11-09  9:45 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Laurent Vivier, kvm, Philippe Mathieu-Daudé

We only require TCG stubs in user-mode emulation.
Do not build stubs restricted to system-mode emulation
in a user-mode only build.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 accel/meson.build | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/accel/meson.build b/accel/meson.build
index b26cca227a4..609772f129b 100644
--- a/accel/meson.build
+++ b/accel/meson.build
@@ -1,10 +1,12 @@
 softmmu_ss.add(files('accel.c'))
 
-subdir('qtest')
-subdir('kvm')
 subdir('tcg')
-subdir('xen')
-subdir('stubs')
+if have_system
+  subdir('qtest')
+  subdir('kvm')
+  subdir('xen')
+  subdir('stubs')
+endif
 
 dummy_ss = ss.source_set()
 dummy_ss.add(files(
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/3] accel/stubs: Restrict system-mode emulation stubs
  2020-11-09  9:45 [PATCH 0/3] accel: Remove system-mode stubs from user-mode builds Philippe Mathieu-Daudé
  2020-11-09  9:45 ` [PATCH 1/3] accel: Only include TCG stubs in user-mode only builds Philippe Mathieu-Daudé
@ 2020-11-09  9:45 ` Philippe Mathieu-Daudé
  2020-11-09  9:56   ` Claudio Fontana
  2020-11-09  9:45 ` [PATCH 3/3] accel/stubs: Simplify kvm-stub.c Philippe Mathieu-Daudé
  2020-11-09 10:50 ` [PATCH 0/3] accel: Remove system-mode stubs from user-mode builds Paolo Bonzini
  3 siblings, 1 reply; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-11-09  9:45 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Laurent Vivier, kvm, Philippe Mathieu-Daudé

This system-mode emulation stubs are not require
in user-mode binaries. Restrict them to system-mode
binaries.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 accel/stubs/meson.build | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/accel/stubs/meson.build b/accel/stubs/meson.build
index 12dd1539afa..a83408bc0a7 100644
--- a/accel/stubs/meson.build
+++ b/accel/stubs/meson.build
@@ -1,4 +1,8 @@
-specific_ss.add(when: 'CONFIG_HAX', if_false: files('hax-stub.c'))
-specific_ss.add(when: 'CONFIG_XEN', if_false: files('xen-stub.c'))
-specific_ss.add(when: 'CONFIG_KVM', if_false: files('kvm-stub.c'))
-specific_ss.add(when: 'CONFIG_TCG', if_false: files('tcg-stub.c'))
+accel_stubs_ss = ss.source_set()
+
+accel_stubs_ss.add(when: 'CONFIG_HAX', if_false: files('hax-stub.c'))
+accel_stubs_ss.add(when: 'CONFIG_XEN', if_false: files('xen-stub.c'))
+accel_stubs_ss.add(when: 'CONFIG_KVM', if_false: files('kvm-stub.c'))
+accel_stubs_ss.add(when: 'CONFIG_TCG', if_false: files('tcg-stub.c'))
+
+specific_ss.add_all(when: ['CONFIG_SOFTMMU'], if_true: accel_stubs_ss)
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/3] accel/stubs: Simplify kvm-stub.c
  2020-11-09  9:45 [PATCH 0/3] accel: Remove system-mode stubs from user-mode builds Philippe Mathieu-Daudé
  2020-11-09  9:45 ` [PATCH 1/3] accel: Only include TCG stubs in user-mode only builds Philippe Mathieu-Daudé
  2020-11-09  9:45 ` [PATCH 2/3] accel/stubs: Restrict system-mode emulation stubs Philippe Mathieu-Daudé
@ 2020-11-09  9:45 ` Philippe Mathieu-Daudé
  2020-11-09 10:50 ` [PATCH 0/3] accel: Remove system-mode stubs from user-mode builds Paolo Bonzini
  3 siblings, 0 replies; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-11-09  9:45 UTC (permalink / raw)
  To: qemu-devel
  Cc: Paolo Bonzini, Laurent Vivier, kvm, Philippe Mathieu-Daudé

Now than kvm-stub.c is only built on system-mode emulation,
we can simplify its #ifdef'ry.

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
 accel/stubs/kvm-stub.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/accel/stubs/kvm-stub.c b/accel/stubs/kvm-stub.c
index 680e0994637..68fdfce50ed 100644
--- a/accel/stubs/kvm-stub.c
+++ b/accel/stubs/kvm-stub.c
@@ -13,10 +13,7 @@
 #include "qemu/osdep.h"
 #include "cpu.h"
 #include "sysemu/kvm.h"
-
-#ifndef CONFIG_USER_ONLY
 #include "hw/pci/msi.h"
-#endif
 
 KVMState *kvm_state;
 bool kvm_kernel_irqchip;
@@ -91,7 +88,6 @@ int kvm_memcrypt_encrypt_data(uint8_t *ptr, uint64_t len)
   return 1;
 }
 
-#ifndef CONFIG_USER_ONLY
 int kvm_irqchip_add_msi_route(KVMState *s, int vector, PCIDevice *dev)
 {
     return -ENOSYS;
@@ -158,4 +154,3 @@ bool kvm_arm_supports_user_irq(void)
 {
     return false;
 }
-#endif
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/3] accel: Only include TCG stubs in user-mode only builds
  2020-11-09  9:45 ` [PATCH 1/3] accel: Only include TCG stubs in user-mode only builds Philippe Mathieu-Daudé
@ 2020-11-09  9:55   ` Claudio Fontana
  2020-11-09 10:48     ` Paolo Bonzini
  0 siblings, 1 reply; 8+ messages in thread
From: Claudio Fontana @ 2020-11-09  9:55 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Paolo Bonzini, Laurent Vivier, kvm

On 11/9/20 10:45 AM, Philippe Mathieu-Daudé wrote:
> We only require TCG stubs in user-mode emulation.
> Do not build stubs restricted to system-mode emulation
> in a user-mode only build.
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  accel/meson.build | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/accel/meson.build b/accel/meson.build
> index b26cca227a4..609772f129b 100644
> --- a/accel/meson.build
> +++ b/accel/meson.build
> @@ -1,10 +1,12 @@
>  softmmu_ss.add(files('accel.c'))
>  
> -subdir('qtest')
> -subdir('kvm')
>  subdir('tcg')
> -subdir('xen')
> -subdir('stubs')
> +if have_system
> +  subdir('qtest')
> +  subdir('kvm')
> +  subdir('xen')
> +  subdir('stubs')
> +endif
>  
>  dummy_ss = ss.source_set()
>  dummy_ss.add(files(
> 

Ciao Philippe,

I thought that the pattern used by Paolo was, recurse always, and put the check inside the recursed dir meson.build .
Paolo did you indeed intend meson use this way?

Ciao,

Claudio

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/3] accel/stubs: Restrict system-mode emulation stubs
  2020-11-09  9:45 ` [PATCH 2/3] accel/stubs: Restrict system-mode emulation stubs Philippe Mathieu-Daudé
@ 2020-11-09  9:56   ` Claudio Fontana
  0 siblings, 0 replies; 8+ messages in thread
From: Claudio Fontana @ 2020-11-09  9:56 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel
  Cc: Paolo Bonzini, Laurent Vivier, kvm

On 11/9/20 10:45 AM, Philippe Mathieu-Daudé wrote:
> This system-mode emulation stubs are not require

nit: s,require,required,

> in user-mode binaries. Restrict them to system-mode
> binaries.
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
>  accel/stubs/meson.build | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/accel/stubs/meson.build b/accel/stubs/meson.build
> index 12dd1539afa..a83408bc0a7 100644
> --- a/accel/stubs/meson.build
> +++ b/accel/stubs/meson.build
> @@ -1,4 +1,8 @@
> -specific_ss.add(when: 'CONFIG_HAX', if_false: files('hax-stub.c'))
> -specific_ss.add(when: 'CONFIG_XEN', if_false: files('xen-stub.c'))
> -specific_ss.add(when: 'CONFIG_KVM', if_false: files('kvm-stub.c'))
> -specific_ss.add(when: 'CONFIG_TCG', if_false: files('tcg-stub.c'))
> +accel_stubs_ss = ss.source_set()
> +
> +accel_stubs_ss.add(when: 'CONFIG_HAX', if_false: files('hax-stub.c'))
> +accel_stubs_ss.add(when: 'CONFIG_XEN', if_false: files('xen-stub.c'))
> +accel_stubs_ss.add(when: 'CONFIG_KVM', if_false: files('kvm-stub.c'))
> +accel_stubs_ss.add(when: 'CONFIG_TCG', if_false: files('tcg-stub.c'))
> +
> +specific_ss.add_all(when: ['CONFIG_SOFTMMU'], if_true: accel_stubs_ss)
> 


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/3] accel: Only include TCG stubs in user-mode only builds
  2020-11-09  9:55   ` Claudio Fontana
@ 2020-11-09 10:48     ` Paolo Bonzini
  0 siblings, 0 replies; 8+ messages in thread
From: Paolo Bonzini @ 2020-11-09 10:48 UTC (permalink / raw)
  To: Claudio Fontana, Philippe Mathieu-Daudé, qemu-devel
  Cc: Laurent Vivier, kvm

On 09/11/20 10:55, Claudio Fontana wrote:
> Ciao Philippe,
> 
> I thought that the pattern used by Paolo was, recurse always, and put
> the check inside the recursed dir meson.build . Paolo did you indeed
> intend meson use this way?

Generally yeah, I preferred to recurse always.  In this specific case, 
however, an even bigger qualm with the patch is that the patch content 
does not match the commit message.

I also don't understand why it's useful, because patch 2 makes 
everything conditional on CONFIG_SOFTMMU.

Paolo


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/3] accel: Remove system-mode stubs from user-mode builds
  2020-11-09  9:45 [PATCH 0/3] accel: Remove system-mode stubs from user-mode builds Philippe Mathieu-Daudé
                   ` (2 preceding siblings ...)
  2020-11-09  9:45 ` [PATCH 3/3] accel/stubs: Simplify kvm-stub.c Philippe Mathieu-Daudé
@ 2020-11-09 10:50 ` Paolo Bonzini
  3 siblings, 0 replies; 8+ messages in thread
From: Paolo Bonzini @ 2020-11-09 10:50 UTC (permalink / raw)
  To: Philippe Mathieu-Daudé, qemu-devel; +Cc: Laurent Vivier, kvm

On 09/11/20 10:45, Philippe Mathieu-Daudé wrote:
> It is pointless to build/link these stubs into user-mode binaries.
> 
> Philippe Mathieu-Daudé (3):
>    accel: Only include TCG stubs in user-mode only builds
>    accel/stubs: Restrict system-mode emulation stubs
>    accel/stubs: Simplify kvm-stub.c
> 
>   accel/stubs/kvm-stub.c  |  5 -----
>   accel/meson.build       | 10 ++++++----
>   accel/stubs/meson.build | 12 ++++++++----
>   3 files changed, 14 insertions(+), 13 deletions(-)
> 

The series makes sense.  It probably also shows that it makes sense to 
have a "specific_softmmu_ss" sourceset in meson.build.  Let's review 
Alex Bennée's patches and then get back to this one.

Paolo


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-11-09 10:50 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-09  9:45 [PATCH 0/3] accel: Remove system-mode stubs from user-mode builds Philippe Mathieu-Daudé
2020-11-09  9:45 ` [PATCH 1/3] accel: Only include TCG stubs in user-mode only builds Philippe Mathieu-Daudé
2020-11-09  9:55   ` Claudio Fontana
2020-11-09 10:48     ` Paolo Bonzini
2020-11-09  9:45 ` [PATCH 2/3] accel/stubs: Restrict system-mode emulation stubs Philippe Mathieu-Daudé
2020-11-09  9:56   ` Claudio Fontana
2020-11-09  9:45 ` [PATCH 3/3] accel/stubs: Simplify kvm-stub.c Philippe Mathieu-Daudé
2020-11-09 10:50 ` [PATCH 0/3] accel: Remove system-mode stubs from user-mode builds Paolo Bonzini

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).