On Sat, Nov 18, 2023 at 10:25:31AM -0800, Daniel Hoffman wrote:
> `kvm_enabled()` is compiled down to `0` and short-circuit logic is
> used to remmove references to undefined symbols at the compile stage.
> Some build configurations with some compilers don't attempt to
> simplify this logic down in some cases (the pattern appears to be
> that the literal false must be the first term) and this was causing
> some builds to emit references to undefined symbols.
> 
> Signed-off-by: Daniel Hoffman <dhoff...@gmail.com>

Could we add a bit more detail here? Will help make sure
this does not break again in the future.

> ---
>  hw/i386/x86.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/hw/i386/x86.c b/hw/i386/x86.c
> index b3d054889bb..d339c8f3ef8 100644
> --- a/hw/i386/x86.c
> +++ b/hw/i386/x86.c
> @@ -132,7 +132,7 @@ void x86_cpus_init(X86MachineState *x86ms, int 
> default_cpu_version)
>       * Can we support APIC ID 255 or higher?  With KVM, that requires
>       * both in-kernel lapic and X2APIC userspace API.
>       */
> -    if (x86ms->apic_id_limit > 255 && kvm_enabled() &&
> +    if (kvm_enabled() && x86ms->apic_id_limit > 255 &&
>          (!kvm_irqchip_in_kernel() || !kvm_enable_x2apic())) {
>          error_report("current -smp configuration requires kernel "
>                       "irqchip and X2APIC API support.");
> @@ -418,8 +418,8 @@ void x86_cpu_pre_plug(HotplugHandler *hotplug_dev,
>      }
>      cpu->thread_id = topo_ids.smt_id;
>  
> -    if (hyperv_feat_enabled(cpu, HYPERV_FEAT_VPINDEX) &&
> -        kvm_enabled() && !kvm_hv_vpindex_settable()) {
> +    if (kvm_enabled() && hyperv_feat_enabled(cpu, HYPERV_FEAT_VPINDEX) &&
> +        !kvm_hv_vpindex_settable()) {
>          error_setg(errp, "kernel doesn't allow setting HyperV VP_INDEX");
>          return;
>      }
> -- 
> 2.40.1


Reply via email to