diff mbox series

accel/kvm: Make "kernel_irqchip" default on

Message ID 20191228093222.18431-1-xiaoyao.li@intel.com
State New
Headers show
Series accel/kvm: Make "kernel_irqchip" default on | expand

Commit Message

Xiaoyao Li Dec. 28, 2019, 9:32 a.m. UTC
Commit 11bc4a13d1f4 ("kvm: convert "-machine kernel_irqchip" to an
accelerator property") moves kernel_irqchip property from "-machine" to
"-accel kvm", but it forgets to set the default value of
kernel_irqchip_allowed and kernel_irqchip_split.

Also cleaning up the three useless members (kernel_irqchip_allowed,
kernel_irqchip_required, kernel_irqchip_split) in struct MachineState.

Fixes: 11bc4a13d1f4 ("kvm: convert "-machine kernel_irqchip" to an accelerator property")
Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
---
 accel/kvm/kvm-all.c | 3 +++
 include/hw/boards.h | 3 ---
 2 files changed, 3 insertions(+), 3 deletions(-)

Comments

Paolo Bonzini Dec. 28, 2019, 10:02 a.m. UTC | #1
Il sab 28 dic 2019, 09:48 Xiaoyao Li <xiaoyao.li@intel.com> ha scritto:

> Commit 11bc4a13d1f4 ("kvm: convert "-machine kernel_irqchip" to an
> accelerator property") moves kernel_irqchip property from "-machine" to
> "-accel kvm", but it forgets to set the default value of
> kernel_irqchip_allowed and kernel_irqchip_split.
>
> Also cleaning up the three useless members (kernel_irqchip_allowed,
> kernel_irqchip_required, kernel_irqchip_split) in struct MachineState.
>
> Fixes: 11bc4a13d1f4 ("kvm: convert "-machine kernel_irqchip" to an
> accelerator property")
> Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
>

Please also add a Reported-by line for Vitaly Kuznetsov.

---
>  accel/kvm/kvm-all.c | 3 +++
>  include/hw/boards.h | 3 ---
>  2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
> index b2f1a5bcb5ef..40f74094f8d3 100644
> --- a/accel/kvm/kvm-all.c
> +++ b/accel/kvm/kvm-all.c
> @@ -3044,8 +3044,11 @@ bool kvm_kernel_irqchip_split(void)
>  static void kvm_accel_instance_init(Object *obj)
>  {
>      KVMState *s = KVM_STATE(obj);
> +    MachineClass *mc = MACHINE_GET_CLASS(current_machine);
>
>      s->kvm_shadow_mem = -1;
> +    s->kernel_irqchip_allowed = true;
> +    s->kernel_irqchip_split = mc->default_kernel_irqchip_split;
>

Can you initialize this from the init_machine method instead of assuming
that current_machine has been initialized earlier?

Thanks for the quick fix!

Paolo

>  }
>
>  static void kvm_accel_class_init(ObjectClass *oc, void *data)
> diff --git a/include/hw/boards.h b/include/hw/boards.h
> index 61f8bb8e5a42..fb1b43d5b972 100644
> --- a/include/hw/boards.h
> +++ b/include/hw/boards.h
> @@ -271,9 +271,6 @@ struct MachineState {
>
>      /*< public >*/
>
> -    bool kernel_irqchip_allowed;
> -    bool kernel_irqchip_required;
> -    bool kernel_irqchip_split;
>      char *dtb;
>      char *dumpdtb;
>      int phandle_start;
> --
> 2.19.1
>
>
Xiaoyao Li Dec. 28, 2019, 10:16 a.m. UTC | #2
On Sat, 2019-12-28 at 10:02 +0000, Paolo Bonzini wrote:
> 
> 
> Il sab 28 dic 2019, 09:48 Xiaoyao Li <xiaoyao.li@intel.com> ha scritto:
> > Commit 11bc4a13d1f4 ("kvm: convert "-machine kernel_irqchip" to an
> > accelerator property") moves kernel_irqchip property from "-machine" to
> > "-accel kvm", but it forgets to set the default value of
> > kernel_irqchip_allowed and kernel_irqchip_split.
> > 
> > Also cleaning up the three useless members (kernel_irqchip_allowed,
> > kernel_irqchip_required, kernel_irqchip_split) in struct MachineState.
> > 
> > Fixes: 11bc4a13d1f4 ("kvm: convert "-machine kernel_irqchip" to an
> > accelerator property")
> > Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
> 
> Please also add a Reported-by line for Vitaly Kuznetsov.

Sure.

> > ---
> >  accel/kvm/kvm-all.c | 3 +++
> >  include/hw/boards.h | 3 ---
> >  2 files changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
> > index b2f1a5bcb5ef..40f74094f8d3 100644
> > --- a/accel/kvm/kvm-all.c
> > +++ b/accel/kvm/kvm-all.c
> > @@ -3044,8 +3044,11 @@ bool kvm_kernel_irqchip_split(void)
> >  static void kvm_accel_instance_init(Object *obj)
> >  {
> >      KVMState *s = KVM_STATE(obj);
> > +    MachineClass *mc = MACHINE_GET_CLASS(current_machine);
> > 
> >      s->kvm_shadow_mem = -1;
> > +    s->kernel_irqchip_allowed = true;
> > +    s->kernel_irqchip_split = mc->default_kernel_irqchip_split;
> 
> Can you initialize this from the init_machine method instead of assuming that
> current_machine has been initialized earlier?

OK, will do it in v2.

> Thanks for the quick fix!

BTW, it seems that this patch makes kernel_irqchip default on to workaround the
bug. 
However, when explicitly configuring kernel_irqchip=off, guest still fails
booting due to "KVM: failed to send PV IPI: -95" with a latest upstream kernel
ubuntu guest. Any idea about this? 

> Paolo
> >  }
> > 
> >  static void kvm_accel_class_init(ObjectClass *oc, void *data)
> > diff --git a/include/hw/boards.h b/include/hw/boards.h
> > index 61f8bb8e5a42..fb1b43d5b972 100644
> > --- a/include/hw/boards.h
> > +++ b/include/hw/boards.h
> > @@ -271,9 +271,6 @@ struct MachineState {
> > 
> >      /*< public >*/
> > 
> > -    bool kernel_irqchip_allowed;
> > -    bool kernel_irqchip_required;
> > -    bool kernel_irqchip_split;
> >      char *dtb;
> >      char *dumpdtb;
> >      int phandle_start;
Paolo Bonzini Dec. 28, 2019, 10:57 a.m. UTC | #3
Il sab 28 dic 2019, 10:24 Xiaoyao Li <xiaoyao.li@intel.com> ha scritto:

> BTW, it seems that this patch makes kernel_irqchip default on to
> workaround the
> bug.
> However, when explicitly configuring kernel_irqchip=off, guest still fails
> booting due to "KVM: failed to send PV IPI: -95" with a latest upstream
> kernel
> ubuntu guest. Any idea about this?
>

We need to clear the PV IPI feature for userspace irqchip. Are you using
-cpu host by chance?

Paolo


> > Paolo
> > >  }
> > >
> > >  static void kvm_accel_class_init(ObjectClass *oc, void *data)
> > > diff --git a/include/hw/boards.h b/include/hw/boards.h
> > > index 61f8bb8e5a42..fb1b43d5b972 100644
> > > --- a/include/hw/boards.h
> > > +++ b/include/hw/boards.h
> > > @@ -271,9 +271,6 @@ struct MachineState {
> > >
> > >      /*< public >*/
> > >
> > > -    bool kernel_irqchip_allowed;
> > > -    bool kernel_irqchip_required;
> > > -    bool kernel_irqchip_split;
> > >      char *dtb;
> > >      char *dumpdtb;
> > >      int phandle_start;
>
>
Xiaoyao Li Dec. 28, 2019, 11:14 a.m. UTC | #4
On Sat, 2019-12-28 at 10:57 +0000, Paolo Bonzini wrote:
> 
> 
> Il sab 28 dic 2019, 10:24 Xiaoyao Li <xiaoyao.li@intel.com> ha scritto:
> > BTW, it seems that this patch makes kernel_irqchip default on to workaround
> > the
> > bug. 
> > However, when explicitly configuring kernel_irqchip=off, guest still fails
> > booting due to "KVM: failed to send PV IPI: -95" with a latest upstream
> > kernel
> > ubuntu guest. Any idea about this? 
> 
> We need to clear the PV IPI feature for userspace irqchip. Are you using -cpu
> host by chance?

Yes, I used -cpu host.

After using "-cpu host,-kvm-pv-ipi" with kernel_irqchip=off, it can boot
successfully.

> Paolo
> 
> > > Paolo
> > > >  }
> > > > 
> > > >  static void kvm_accel_class_init(ObjectClass *oc, void *data)
> > > > diff --git a/include/hw/boards.h b/include/hw/boards.h
> > > > index 61f8bb8e5a42..fb1b43d5b972 100644
> > > > --- a/include/hw/boards.h
> > > > +++ b/include/hw/boards.h
> > > > @@ -271,9 +271,6 @@ struct MachineState {
> > > > 
> > > >      /*< public >*/
> > > > 
> > > > -    bool kernel_irqchip_allowed;
> > > > -    bool kernel_irqchip_required;
> > > > -    bool kernel_irqchip_split;
> > > >      char *dtb;
> > > >      char *dumpdtb;
> > > >      int phandle_start;
> >
diff mbox series

Patch

diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index b2f1a5bcb5ef..40f74094f8d3 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -3044,8 +3044,11 @@  bool kvm_kernel_irqchip_split(void)
 static void kvm_accel_instance_init(Object *obj)
 {
     KVMState *s = KVM_STATE(obj);
+    MachineClass *mc = MACHINE_GET_CLASS(current_machine);
 
     s->kvm_shadow_mem = -1;
+    s->kernel_irqchip_allowed = true;
+    s->kernel_irqchip_split = mc->default_kernel_irqchip_split;
 }
 
 static void kvm_accel_class_init(ObjectClass *oc, void *data)
diff --git a/include/hw/boards.h b/include/hw/boards.h
index 61f8bb8e5a42..fb1b43d5b972 100644
--- a/include/hw/boards.h
+++ b/include/hw/boards.h
@@ -271,9 +271,6 @@  struct MachineState {
 
     /*< public >*/
 
-    bool kernel_irqchip_allowed;
-    bool kernel_irqchip_required;
-    bool kernel_irqchip_split;
     char *dtb;
     char *dumpdtb;
     int phandle_start;