All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] q35: catch invalid cpu hotplug configuration
@ 2021-08-12 10:23 Gerd Hoffmann
  2021-08-12 10:28 ` Daniel P. Berrangé
  2021-08-12 14:46 ` Igor Mammedov
  0 siblings, 2 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2021-08-12 10:23 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann, Michael S. Tsirkin

Related: https://bugzilla.redhat.com//show_bug.cgi?id=1985924
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/isa/lpc_ich9.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c
index 5f9de0239cf9..5f143dca17aa 100644
--- a/hw/isa/lpc_ich9.c
+++ b/hw/isa/lpc_ich9.c
@@ -31,6 +31,7 @@
 #include "qemu/osdep.h"
 #include "qemu/log.h"
 #include "cpu.h"
+#include "qapi/error.h"
 #include "qapi/visitor.h"
 #include "qemu/range.h"
 #include "hw/isa/isa.h"
@@ -676,6 +677,18 @@ static void ich9_lpc_realize(PCIDevice *d, Error **errp)
     DeviceState *dev = DEVICE(d);
     ISABus *isa_bus;
 
+    if ((lpc->smi_host_features & BIT_ULL(ICH9_LPC_SMI_F_CPU_HOT_UNPLUG_BIT)) &&
+        !(lpc->smi_host_features & BIT_ULL(ICH9_LPC_SMI_F_CPU_HOTPLUG_BIT))) {
+        /*
+         * smi_features_ok_callback() throws an error on this.
+         *
+         * So bail out here instead of advertizing the invalid
+         * configuration and get obscure firmware failures from that.
+         */
+        error_setg(errp, "cpu hot-unplug requires cpu hot-plug");
+        return;
+    }
+
     isa_bus = isa_bus_new(DEVICE(d), get_system_memory(), get_system_io(),
                           errp);
     if (!isa_bus) {
-- 
2.31.1



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

* Re: [PATCH] q35: catch invalid cpu hotplug configuration
  2021-08-12 10:23 [PATCH] q35: catch invalid cpu hotplug configuration Gerd Hoffmann
@ 2021-08-12 10:28 ` Daniel P. Berrangé
  2021-08-12 11:07   ` Gerd Hoffmann
  2021-08-12 14:46 ` Igor Mammedov
  1 sibling, 1 reply; 4+ messages in thread
From: Daniel P. Berrangé @ 2021-08-12 10:28 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: qemu-devel, Michael S. Tsirkin

On Thu, Aug 12, 2021 at 12:23:41PM +0200, Gerd Hoffmann wrote:
> Related: https://bugzilla.redhat.com//show_bug.cgi?id=1985924
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  hw/isa/lpc_ich9.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c
> index 5f9de0239cf9..5f143dca17aa 100644
> --- a/hw/isa/lpc_ich9.c
> +++ b/hw/isa/lpc_ich9.c
> @@ -31,6 +31,7 @@
>  #include "qemu/osdep.h"
>  #include "qemu/log.h"
>  #include "cpu.h"
> +#include "qapi/error.h"
>  #include "qapi/visitor.h"
>  #include "qemu/range.h"
>  #include "hw/isa/isa.h"
> @@ -676,6 +677,18 @@ static void ich9_lpc_realize(PCIDevice *d, Error **errp)
>      DeviceState *dev = DEVICE(d);
>      ISABus *isa_bus;
>  
> +    if ((lpc->smi_host_features & BIT_ULL(ICH9_LPC_SMI_F_CPU_HOT_UNPLUG_BIT)) &&
> +        !(lpc->smi_host_features & BIT_ULL(ICH9_LPC_SMI_F_CPU_HOTPLUG_BIT))) {
> +        /*
> +         * smi_features_ok_callback() throws an error on this.
> +         *
> +         * So bail out here instead of advertizing the invalid
> +         * configuration and get obscure firmware failures from that.
> +         */
> +        error_setg(errp, "cpu hot-unplug requires cpu hot-plug");
> +        return;
> +    }

What does this actually mean in practice ? AFAIK from the libvirt side
we don't do anything special to enable/disable CPU hotplug. What QEMU
config setting is wrong to lead to this scenario, thta the user/mgmt
app has to fix ?


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] 4+ messages in thread

* Re: [PATCH] q35: catch invalid cpu hotplug configuration
  2021-08-12 10:28 ` Daniel P. Berrangé
@ 2021-08-12 11:07   ` Gerd Hoffmann
  0 siblings, 0 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2021-08-12 11:07 UTC (permalink / raw)
  To: Daniel P. Berrangé; +Cc: qemu-devel, Michael S. Tsirkin

  Hi,

> > +    if ((lpc->smi_host_features & BIT_ULL(ICH9_LPC_SMI_F_CPU_HOT_UNPLUG_BIT)) &&
> > +        !(lpc->smi_host_features & BIT_ULL(ICH9_LPC_SMI_F_CPU_HOTPLUG_BIT))) {
> > +        /*
> > +         * smi_features_ok_callback() throws an error on this.
> > +         *
> > +         * So bail out here instead of advertizing the invalid
> > +         * configuration and get obscure firmware failures from that.
> > +         */
> > +        error_setg(errp, "cpu hot-unplug requires cpu hot-plug");
> > +        return;
> > +    }
> 
> What does this actually mean in practice ? AFAIK from the libvirt side
> we don't do anything special to enable/disable CPU hotplug. What QEMU
> config setting is wrong to lead to this scenario, thta the user/mgmt
> app has to fix ?

It's ICH9-LPC.x-smi-cpu-{hotplug,hotunplug}.  user/mgmt should not mess
with that, but given it is possible I think printing an error is better
than going for an assert().

If this triggers it is most likely qemu getting compat properties wrong.

Full story at https://bugzilla.redhat.com/show_bug.cgi?id=1985924 ;)

take care,
  Gerd



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

* Re: [PATCH] q35: catch invalid cpu hotplug configuration
  2021-08-12 10:23 [PATCH] q35: catch invalid cpu hotplug configuration Gerd Hoffmann
  2021-08-12 10:28 ` Daniel P. Berrangé
@ 2021-08-12 14:46 ` Igor Mammedov
  1 sibling, 0 replies; 4+ messages in thread
From: Igor Mammedov @ 2021-08-12 14:46 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: qemu-devel, Michael S. Tsirkin

On Thu, 12 Aug 2021 12:23:41 +0200
Gerd Hoffmann <kraxel@redhat.com> wrote:

> Related: https://bugzilla.redhat.com//show_bug.cgi?id=1985924
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>

Reviewed-by: Igor Mammedov <imammedo@redhat.com>

> ---
>  hw/isa/lpc_ich9.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/hw/isa/lpc_ich9.c b/hw/isa/lpc_ich9.c
> index 5f9de0239cf9..5f143dca17aa 100644
> --- a/hw/isa/lpc_ich9.c
> +++ b/hw/isa/lpc_ich9.c
> @@ -31,6 +31,7 @@
>  #include "qemu/osdep.h"
>  #include "qemu/log.h"
>  #include "cpu.h"
> +#include "qapi/error.h"
>  #include "qapi/visitor.h"
>  #include "qemu/range.h"
>  #include "hw/isa/isa.h"
> @@ -676,6 +677,18 @@ static void ich9_lpc_realize(PCIDevice *d, Error **errp)
>      DeviceState *dev = DEVICE(d);
>      ISABus *isa_bus;
>  
> +    if ((lpc->smi_host_features & BIT_ULL(ICH9_LPC_SMI_F_CPU_HOT_UNPLUG_BIT)) &&
> +        !(lpc->smi_host_features & BIT_ULL(ICH9_LPC_SMI_F_CPU_HOTPLUG_BIT))) {
> +        /*
> +         * smi_features_ok_callback() throws an error on this.
> +         *
> +         * So bail out here instead of advertizing the invalid
> +         * configuration and get obscure firmware failures from that.
> +         */
> +        error_setg(errp, "cpu hot-unplug requires cpu hot-plug");
> +        return;
> +    }
> +
>      isa_bus = isa_bus_new(DEVICE(d), get_system_memory(), get_system_io(),
>                            errp);
>      if (!isa_bus) {



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

end of thread, other threads:[~2021-08-12 14:47 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-12 10:23 [PATCH] q35: catch invalid cpu hotplug configuration Gerd Hoffmann
2021-08-12 10:28 ` Daniel P. Berrangé
2021-08-12 11:07   ` Gerd Hoffmann
2021-08-12 14:46 ` Igor Mammedov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.