Re: [kvm-unit-tests PATCH v2 1/1] arm: Replace MAX_SMP probe loop in favor of reading directly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 30/01/2023 20.19, Colton Lewis wrote:
Thomas Huth <thuth@xxxxxxxxxx> writes:

On 11/01/2023 22.54, Colton Lewis wrote:
Replace the MAX_SMP probe loop in favor of reading a number directly
from the QEMU error message. This is equally safe as the existing code
because the error message has had the same format as long as it has
existed, since QEMU v2.10. The final number before the end of the
error message line indicates the max QEMU supports. A short awk
program is used to extract the number, which becomes the new MAX_SMP
value.

This loop logic is broken for machines with a number of CPUs that
isn't a power of two. A machine with 8 CPUs will test with MAX_SMP=8
but a machine with 12 CPUs will test with MAX_SMP=6 because 12 >> 2 ==
6. This can, in rare circumstances, lead to different test results
depending only on the number of CPUs the machine has.

A previous comment explains the loop should only apply to kernels
<=v4.3 on arm and suggests deletion when it becomes tiresome to
maintian. However, it is always theoretically possible to test on a
machine that has more CPUs than QEMU supports, so it makes sense to
leave some check in place.

Signed-off-by: Colton Lewis <coltonlewis@xxxxxxxxxx>
---
...
+if $RUNTIME_arch_run _NO_FILE_4Uhere_ -smp $MAX_SMP \
+      |& grep -qi 'exceeds max CPUs'; then
+    GET_LAST_NUM='/exceeds max CPUs/ {match($0, /[[:digit:]]+)$/); print substr($0, RSTART, RLENGTH-1)}' +    MAX_SMP=$($RUNTIME_arch_run _NO_FILE_4Uhere_ -smp $MAX_SMP |& awk "$GET_LAST_NUM")
+fi

Is that string with "exceeds" really still the recent error message of the
latest QEMU versions? When I'm running

   qemu-system-aarch64 -machine virt -smp 1024

I'm getting:

   qemu-system-aarch64: Invalid SMP CPUs 1024. The max CPUs
   supported by machine 'virt-8.0' is 512

... thus no "exceeds" in here? What do I miss? Maybe it's better to just
grep for "max CPUs" ?

The full qemu command run by the test is much more complicated. It takes
a different code path and results in different errors, including the
"exceeds" one. All my testing has been done with QEMU v7.0, released
2022.

Could you please provide such a command line? I haven't been able to reproduce this with the current development version of QEMU (using TCG) - either I (likely) did something wrong, or the behavior of QEMU changed in the past months...

 Thanks,
  Thomas




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux