Skip to contentSkip to conversation

i386, machine patches for QEMU 6.1-rc4

GIT PULL Applied Paolo Bonzini 2 participants 5 messages Aug 13, 2021 – Aug 15, 2021

lore
Share & tools
lore
#0 lore raw

The following changes since commit 703e8cd6189cf699c8d5c094bc68b5f3afa6ad71:

Update version for v6.1.0-rc3 release (2021-08-10 19:08:09 +0100)

are available in the Git repository at:

https://gitlab.com/bonzini/qemu.git tags/for-upstream

for you to fetch changes up to ea0aa1752ca88f7856cbf40eef0db62f90f28dcd:

hw/core: fix error checking in smp_parse (2021-08-13 14:43:42 +0200)

This is what is in my queue. The first patch is the one that is most important, though all three are regressions.

----------------------------------------------------------------
Fixes for -smp, and for x86 TCG on Windows.

----------------------------------------------------------------
Daniel P. Berrangé (1):
hw/core: fix error checking in smp_parse

Lara Lazier (1):
target/i386: Fixed size of constant for Windows

Philippe Mathieu-Daudé (1):
hw/core: Add missing return on error

 hw/core/machine.c                    | 3 ++-
 target/i386/tcg/sysemu/misc_helper.c | 2 +-
 target/i386/tcg/sysemu/svm_helper.c  | 2 +-
 3 files changed, 4 insertions(+), 3 deletions(-)
Signature · 1 line
2.31.1
#1 lore raw

[PULL 2/3] hw/core: Add missing return on error

From: Philippe Mathieu-Daudé <[email protected]>

If dies is not supported by this machine's CPU topology, don't keep processing options and return directly.

Fixes 0aebebb561c ("machine: reject -smp dies!=1 for non-PC machines")

Message-Id: <[email protected]>

---
 hw/core/machine.c | 1 +
 1 file changed, 1 insertion(+)
hw/core/machine.c +1 -0
index 943974d411..abaeda589b 100644
@@ -752,6 +752,7 @@ static void smp_parse(MachineState *ms, SMPConfiguration *config, Error **errp)
 
     if (config->has_dies && config->dies != 0 && config->dies != 1) {
         error_setg(errp, "dies not supported by this machine's CPU topology");
+        return;
     }
 
     /* compute missing values, prefer sockets over cores over threads */
Signature · 1 line
2.31.1
#2 lore raw

[PULL 1/3] target/i386: Fixed size of constant for Windows

In reply to Paolo Bonzini

From: Lara Lazier <[email protected]>

~0UL has 64 bits on Linux and 32 bits on Windows.

Message-Id: <[email protected]>

---
 target/i386/tcg/sysemu/misc_helper.c | 2 +-
 target/i386/tcg/sysemu/svm_helper.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
target/i386/tcg/sysemu/misc_helper.c +1 -1
index d347af2a99..e7a2ebde81 100644
@@ -97,7 +97,7 @@ void helper_write_crN(CPUX86State *env, int reg, target_ulong t0)
         break;
     case 3:
         if ((env->efer & MSR_EFER_LMA) &&
-                (t0 & ((~0UL) << env_archcpu(env)->phys_bits))) {
+                (t0 & ((~0ULL) << env_archcpu(env)->phys_bits))) {
             cpu_vmexit(env, SVM_EXIT_ERR, 0, GETPC());
         }
         if (!(env->efer & MSR_EFER_LMA)) {
target/i386/tcg/sysemu/svm_helper.c +1 -1
index e151104b4e..0d549b3d6c 100644
@@ -264,7 +264,7 @@ void helper_vmrun(CPUX86State *env, int aflag, int next_eip_addend)
     }
     new_cr3 = x86_ldq_phys(cs, env->vm_vmcb + offsetof(struct vmcb, save.cr3));
     if ((env->efer & MSR_EFER_LMA) &&
-            (new_cr3 & ((~0UL) << cpu->phys_bits))) {
+            (new_cr3 & ((~0ULL) << cpu->phys_bits))) {
         cpu_vmexit(env, SVM_EXIT_ERR, 0, GETPC());
     }
     new_cr4 = x86_ldq_phys(cs, env->vm_vmcb + offsetof(struct vmcb, save.cr4));
Signature · 1 line
2.31.1
#3 lore raw

[PULL 3/3] hw/core: fix error checking in smp_parse

In reply to Paolo Bonzini

From: Daniel P. Berrangé <[email protected]>

machine_set_smp() mistakenly checks 'errp' not '*errp', and so thinks there is an error every single time it runs. This causes it to jump to the end of the method, skipping the max CPUs checks. The caller meanwhile sees no error and so carries on execution. The result of all this is:

 $ qemu-system-x86_64 -smp -1
 qemu-system-x86_64: GLib: ../glib/gmem.c:142: failed to allocate 481036337048 bytes

instead of

 $ qemu-system-x86_64 -smp -1
 qemu-system-x86_64: Invalid SMP CPUs -1. The max CPUs supported by machine 'pc-i440fx-6.1' is 255

This is a regression from

commit fe68090e8fbd6e831aaf3fc3bb0459c5cccf14cf
Author: Paolo Bonzini <[email protected]>
Date: Thu May 13 09:03:48 2021 -0400

machine: add smp compound property

Message-Id: <[email protected]>

---
 hw/core/machine.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/core/machine.c +1 -1
index abaeda589b..54e040587d 100644
@@ -833,7 +833,7 @@ static void machine_set_smp(Object *obj, Visitor *v, const char *name,
     }
 
     mc->smp_parse(ms, config, errp);
-    if (errp) {
+    if (*errp) {
         goto out_free;
     }
 
Signature · 1 line
2.31.1
#4 lore raw
In reply to Paolo Bonzini
Quoted 13 lines · Paolo Bonzini

The following changes since commit 703e8cd6189cf699c8d5c094bc68b5f3afa6ad71:

Update version for v6.1.0-rc3 release (2021-08-10 19:08:09 +0100)

are available in the Git repository at:

https://gitlab.com/bonzini/qemu.git tags/for-upstream

for you to fetch changes up to ea0aa1752ca88f7856cbf40eef0db62f90f28dcd:

hw/core: fix error checking in smp_parse (2021-08-13 14:43:42 +0200)

Quoted 7 lines

This is what is in my queue. The first patch is the one that is most important, though all three are regressions.

----------------------------------------------------------------
Fixes for -smp, and for x86 TCG on Windows.

----------------------------------------------------------------

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/6.1
for any user-visible changes.

-- PMM