* [PATCH v3] system: Select HVF by default when no other accelerator is available
@ 2024-12-03 9:42 Philippe Mathieu-Daudé
2024-12-03 10:05 ` Daniel P. Berrangé
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-12-03 9:42 UTC (permalink / raw)
To: qemu-devel
Cc: Paolo Bonzini, Thomas Huth, Daniel P . Berrangé,
Philippe Mathieu-Daudé
When testing with a HVF-only binary, we get:
3/12 qemu:func-quick+func-aarch64 / func-aarch64-version ERROR 0.29s exit status 1
stderr:
Traceback (most recent call last):
File "tests/functional/test_version.py", line 22, in test_qmp_human_info_version
self.vm.launch()
File "machine/machine.py", line 461, in launch
raise VMLaunchFailure(
qemu.machine.machine.VMLaunchFailure: ConnectError: Failed to establish session: EOFError
Exit code: 1
Command: build/qemu-system-aarch64 -display none -vga none -chardev socket,id=mon,fd=5 -mon chardev=mon,mode=control -machine none -nodefaults
Output: qemu-system-aarch64: No accelerator selected and no default accelerator available
Fix by checking for HVF in configure_accelerators() and using
it by default when no other accelerator is available.
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
v2 was https://lore.kernel.org/qemu-devel/20241203091036.59898-1-philmd@linaro.org/
---
system/vl.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/system/vl.c b/system/vl.c
index 54998fdbc7e..2f855d83fbb 100644
--- a/system/vl.c
+++ b/system/vl.c
@@ -2362,6 +2362,7 @@ static void configure_accelerators(const char *progname)
/* Select the default accelerator */
bool have_tcg = accel_find("tcg");
bool have_kvm = accel_find("kvm");
+ bool have_hvf = accel_find("hvf");
if (have_tcg && have_kvm) {
if (g_str_has_suffix(progname, "kvm")) {
@@ -2374,6 +2375,8 @@ static void configure_accelerators(const char *progname)
accelerators = "kvm";
} else if (have_tcg) {
accelerators = "tcg";
+ } else if (have_hvf) {
+ accelerators = "hvf";
} else {
error_report("No accelerator selected and"
" no default accelerator available");
--
2.45.2
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v3] system: Select HVF by default when no other accelerator is available
2024-12-03 9:42 [PATCH v3] system: Select HVF by default when no other accelerator is available Philippe Mathieu-Daudé
@ 2024-12-03 10:05 ` Daniel P. Berrangé
2024-12-03 10:17 ` Thomas Huth
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Daniel P. Berrangé @ 2024-12-03 10:05 UTC (permalink / raw)
To: Philippe Mathieu-Daudé; +Cc: qemu-devel, Paolo Bonzini, Thomas Huth
On Tue, Dec 03, 2024 at 10:42:32AM +0100, Philippe Mathieu-Daudé wrote:
> When testing with a HVF-only binary, we get:
>
> 3/12 qemu:func-quick+func-aarch64 / func-aarch64-version ERROR 0.29s exit status 1
> stderr:
> Traceback (most recent call last):
> File "tests/functional/test_version.py", line 22, in test_qmp_human_info_version
> self.vm.launch()
> File "machine/machine.py", line 461, in launch
> raise VMLaunchFailure(
> qemu.machine.machine.VMLaunchFailure: ConnectError: Failed to establish session: EOFError
> Exit code: 1
> Command: build/qemu-system-aarch64 -display none -vga none -chardev socket,id=mon,fd=5 -mon chardev=mon,mode=control -machine none -nodefaults
> Output: qemu-system-aarch64: No accelerator selected and no default accelerator available
>
> Fix by checking for HVF in configure_accelerators() and using
> it by default when no other accelerator is available.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> v2 was https://lore.kernel.org/qemu-devel/20241203091036.59898-1-philmd@linaro.org/
> ---
> system/vl.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/system/vl.c b/system/vl.c
> index 54998fdbc7e..2f855d83fbb 100644
> --- a/system/vl.c
> +++ b/system/vl.c
> @@ -2362,6 +2362,7 @@ static void configure_accelerators(const char *progname)
> /* Select the default accelerator */
> bool have_tcg = accel_find("tcg");
> bool have_kvm = accel_find("kvm");
> + bool have_hvf = accel_find("hvf");
>
> if (have_tcg && have_kvm) {
> if (g_str_has_suffix(progname, "kvm")) {
> @@ -2374,6 +2375,8 @@ static void configure_accelerators(const char *progname)
> accelerators = "kvm";
> } else if (have_tcg) {
> accelerators = "tcg";
> + } else if (have_hvf) {
> + accelerators = "hvf";
> } else {
> error_report("No accelerator selected and"
> " no default accelerator available");
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This is a no-brainer first step IMHO, given it passes all functional tests.
I think we should subsequently consider whether to even rank HVF above
TCG, on the basis that HW acceleration is faster and should provide a
host<->guest security boundary that we don't claim for TCG
With regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3] system: Select HVF by default when no other accelerator is available
2024-12-03 9:42 [PATCH v3] system: Select HVF by default when no other accelerator is available Philippe Mathieu-Daudé
2024-12-03 10:05 ` Daniel P. Berrangé
@ 2024-12-03 10:17 ` Thomas Huth
2024-12-03 13:51 ` Richard Henderson
2024-12-03 15:53 ` Philippe Mathieu-Daudé
3 siblings, 0 replies; 5+ messages in thread
From: Thomas Huth @ 2024-12-03 10:17 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: Paolo Bonzini, Daniel P . Berrangé
On 03/12/2024 10.42, Philippe Mathieu-Daudé wrote:
> When testing with a HVF-only binary, we get:
>
> 3/12 qemu:func-quick+func-aarch64 / func-aarch64-version ERROR 0.29s exit status 1
> stderr:
> Traceback (most recent call last):
> File "tests/functional/test_version.py", line 22, in test_qmp_human_info_version
> self.vm.launch()
> File "machine/machine.py", line 461, in launch
> raise VMLaunchFailure(
> qemu.machine.machine.VMLaunchFailure: ConnectError: Failed to establish session: EOFError
> Exit code: 1
> Command: build/qemu-system-aarch64 -display none -vga none -chardev socket,id=mon,fd=5 -mon chardev=mon,mode=control -machine none -nodefaults
> Output: qemu-system-aarch64: No accelerator selected and no default accelerator available
>
> Fix by checking for HVF in configure_accelerators() and using
> it by default when no other accelerator is available.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> v2 was https://lore.kernel.org/qemu-devel/20241203091036.59898-1-philmd@linaro.org/
> ---
> system/vl.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/system/vl.c b/system/vl.c
> index 54998fdbc7e..2f855d83fbb 100644
> --- a/system/vl.c
> +++ b/system/vl.c
> @@ -2362,6 +2362,7 @@ static void configure_accelerators(const char *progname)
> /* Select the default accelerator */
> bool have_tcg = accel_find("tcg");
> bool have_kvm = accel_find("kvm");
> + bool have_hvf = accel_find("hvf");
>
> if (have_tcg && have_kvm) {
> if (g_str_has_suffix(progname, "kvm")) {
> @@ -2374,6 +2375,8 @@ static void configure_accelerators(const char *progname)
> accelerators = "kvm";
> } else if (have_tcg) {
> accelerators = "tcg";
> + } else if (have_hvf) {
> + accelerators = "hvf";
> } else {
> error_report("No accelerator selected and"
> " no default accelerator available");
Reviewed-by: Thomas Huth <thuth@redhat.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3] system: Select HVF by default when no other accelerator is available
2024-12-03 9:42 [PATCH v3] system: Select HVF by default when no other accelerator is available Philippe Mathieu-Daudé
2024-12-03 10:05 ` Daniel P. Berrangé
2024-12-03 10:17 ` Thomas Huth
@ 2024-12-03 13:51 ` Richard Henderson
2024-12-03 15:53 ` Philippe Mathieu-Daudé
3 siblings, 0 replies; 5+ messages in thread
From: Richard Henderson @ 2024-12-03 13:51 UTC (permalink / raw)
To: qemu-devel
On 12/3/24 03:42, Philippe Mathieu-Daudé wrote:
> When testing with a HVF-only binary, we get:
>
> 3/12 qemu:func-quick+func-aarch64 / func-aarch64-version ERROR 0.29s exit status 1
> stderr:
> Traceback (most recent call last):
> File "tests/functional/test_version.py", line 22, in test_qmp_human_info_version
> self.vm.launch()
> File "machine/machine.py", line 461, in launch
> raise VMLaunchFailure(
> qemu.machine.machine.VMLaunchFailure: ConnectError: Failed to establish session: EOFError
> Exit code: 1
> Command: build/qemu-system-aarch64 -display none -vga none -chardev socket,id=mon,fd=5 -mon chardev=mon,mode=control -machine none -nodefaults
> Output: qemu-system-aarch64: No accelerator selected and no default accelerator available
>
> Fix by checking for HVF in configure_accelerators() and using
> it by default when no other accelerator is available.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
> v2 was https://lore.kernel.org/qemu-devel/20241203091036.59898-1-philmd@linaro.org/
> ---
> system/vl.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/system/vl.c b/system/vl.c
> index 54998fdbc7e..2f855d83fbb 100644
> --- a/system/vl.c
> +++ b/system/vl.c
> @@ -2362,6 +2362,7 @@ static void configure_accelerators(const char *progname)
> /* Select the default accelerator */
> bool have_tcg = accel_find("tcg");
> bool have_kvm = accel_find("kvm");
> + bool have_hvf = accel_find("hvf");
>
> if (have_tcg && have_kvm) {
> if (g_str_has_suffix(progname, "kvm")) {
> @@ -2374,6 +2375,8 @@ static void configure_accelerators(const char *progname)
> accelerators = "kvm";
> } else if (have_tcg) {
> accelerators = "tcg";
> + } else if (have_hvf) {
> + accelerators = "hvf";
Nit, drop the variable and do if (accel_find("hvf")),
so that accel_find is not called unless the tcg test fails.
r~
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3] system: Select HVF by default when no other accelerator is available
2024-12-03 9:42 [PATCH v3] system: Select HVF by default when no other accelerator is available Philippe Mathieu-Daudé
` (2 preceding siblings ...)
2024-12-03 13:51 ` Richard Henderson
@ 2024-12-03 15:53 ` Philippe Mathieu-Daudé
3 siblings, 0 replies; 5+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-12-03 15:53 UTC (permalink / raw)
To: qemu-devel; +Cc: Paolo Bonzini, Thomas Huth, Daniel P . Berrangé
On 3/12/24 10:42, Philippe Mathieu-Daudé wrote:
> When testing with a HVF-only binary, we get:
>
> 3/12 qemu:func-quick+func-aarch64 / func-aarch64-version ERROR 0.29s exit status 1
> stderr:
> Traceback (most recent call last):
> File "tests/functional/test_version.py", line 22, in test_qmp_human_info_version
> self.vm.launch()
> File "machine/machine.py", line 461, in launch
> raise VMLaunchFailure(
> qemu.machine.machine.VMLaunchFailure: ConnectError: Failed to establish session: EOFError
> Exit code: 1
> Command: build/qemu-system-aarch64 -display none -vga none -chardev socket,id=mon,fd=5 -mon chardev=mon,mode=control -machine none -nodefaults
> Output: qemu-system-aarch64: No accelerator selected and no default accelerator available
>
> Fix by checking for HVF in configure_accelerators() and using
> it by default when no other accelerator is available.
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
> v2 was https://lore.kernel.org/qemu-devel/20241203091036.59898-1-philmd@linaro.org/
> ---
> system/vl.c | 3 +++
> 1 file changed, 3 insertions(+)
Patch queued.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-12-03 15:54 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-03 9:42 [PATCH v3] system: Select HVF by default when no other accelerator is available Philippe Mathieu-Daudé
2024-12-03 10:05 ` Daniel P. Berrangé
2024-12-03 10:17 ` Thomas Huth
2024-12-03 13:51 ` Richard Henderson
2024-12-03 15:53 ` Philippe Mathieu-Daudé
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).