[RFC PATCH 05/19] accel/kvm: Prefer local AccelState over global MachineState::accel

Philippe Mathieu-Daudé posted 19 patches 5 months, 1 week ago
Maintainers: Richard Henderson <richard.henderson@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, Cameron Esfahani <dirty@apple.com>, Roman Bolshakov <rbolshakov@ddn.com>, Phil Dennis-Jordan <phil@philjordan.eu>, Fabiano Rosas <farosas@suse.de>, Laurent Vivier <lvivier@redhat.com>, Stefano Stabellini <sstabellini@kernel.org>, Anthony PERARD <anthony@xenproject.org>, Paul Durrant <paul@xen.org>, "Edgar E. Iglesias" <edgar.iglesias@gmail.com>, Warner Losh <imp@bsdimp.com>, Kyle Evans <kevans@freebsd.org>, Peter Maydell <peter.maydell@linaro.org>, Reinoud Zandijk <reinoud@netbsd.org>, Sunil Muthuswamy <sunilmut@microsoft.com>
There is a newer version of this series
[RFC PATCH 05/19] accel/kvm: Prefer local AccelState over global MachineState::accel
Posted by Philippe Mathieu-Daudé 5 months, 1 week ago
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 accel/kvm/kvm-all.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index 5b28b15ccec..551a462926d 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -2582,15 +2582,13 @@ static int kvm_init(MachineState *ms, AccelState *as)
         { /* end of list */ }
     }, *nc = num_cpus;
     int soft_vcpus_limit, hard_vcpus_limit;
-    KVMState *s;
+    KVMState *s = KVM_STATE(as);
     const KVMCapabilityInfo *missing_cap;
     int ret;
     int type;
 
     qemu_mutex_init(&kml_slots_lock);
 
-    s = KVM_STATE(ms->accelerator);
-
     /*
      * On systems where the kernel can support different base page
      * sizes, host page size may be different from TARGET_PAGE_SIZE,
-- 
2.49.0


Re: [RFC PATCH 05/19] accel/kvm: Prefer local AccelState over global MachineState::accel
Posted by Richard Henderson 5 months, 1 week ago
On 6/6/25 17:44, Philippe Mathieu-Daudé wrote:
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   accel/kvm/kvm-all.c | 4 +---
>   1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
> index 5b28b15ccec..551a462926d 100644
> --- a/accel/kvm/kvm-all.c
> +++ b/accel/kvm/kvm-all.c
> @@ -2582,15 +2582,13 @@ static int kvm_init(MachineState *ms, AccelState *as)
>           { /* end of list */ }
>       }, *nc = num_cpus;
>       int soft_vcpus_limit, hard_vcpus_limit;
> -    KVMState *s;
> +    KVMState *s = KVM_STATE(as);
>       const KVMCapabilityInfo *missing_cap;
>       int ret;
>       int type;
>   
>       qemu_mutex_init(&kml_slots_lock);
>   
> -    s = KVM_STATE(ms->accelerator);
> -
>       /*
>        * On systems where the kernel can support different base page
>        * sizes, host page size may be different from TARGET_PAGE_SIZE,

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~