rcutorture: Tweak kvm options
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Wed, 24 Apr 2019 07:34:46 +0000 (09:34 +0200)
committerPaul E. McKenney <paulmck@linux.ibm.com>
Tue, 28 May 2019 16:06:09 +0000 (09:06 -0700)
In one of my rcutorture tests the TSC clocksource got marked unstable
due to a large difference in the TSC value. I'm not sure if the guest
run for a long time with disabled interrupts or if the host was very
busy and didn't schedule the guest for some time.

I took a look on the qemu/KVM options and decided to update the options:

- Use kvm{32|64} as CPU. We could probably use `host' (like ARM does)
  for maximum available features but since we don't run any userland I'm
  not sure if it makes any difference.

- Drop the "noapic" option. There is no history why the APIC was disabled,
  I see no reason for it.  Once old qemu versions fade away, we can add
  "x2apic=on,tsc-deadline=on,hypervisor=on,tsc_adjust=on".

- Additional config options. It ensures that the kernel knowns that it
  runs as a kvm guest and can use virt devices like the kvm-clock as
  clocksource. The kvm-clock was the main motivation here.

- I didn't add a random HW device. It would make the random device ready
  earlier (not it doesn't complete the initialisation at all) but I
  doubt that there is any need for this.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
[ paulmck: The world is not quite ready for CONFIG_PARAVIRT_SPINLOCKS=y
  and x2apic, so they are omitted for the time being. ]
Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com>
tools/testing/selftests/rcutorture/bin/functions.sh
tools/testing/selftests/rcutorture/configs/rcu/CFcommon

index 6bcb8b5..c3a49fb 100644 (file)
@@ -172,7 +172,7 @@ identify_qemu_append () {
        local console=ttyS0
        case "$1" in
        qemu-system-x86_64|qemu-system-i386)
-               echo noapic selinux=0 initcall_debug debug
+               echo selinux=0 initcall_debug debug
                ;;
        qemu-system-aarch64)
                console=ttyAMA0
@@ -191,8 +191,19 @@ identify_qemu_append () {
 # Output arguments for qemu arguments based on the TORTURE_QEMU_MAC
 # and TORTURE_QEMU_INTERACTIVE environment variables.
 identify_qemu_args () {
+       local KVM_CPU=""
+       case "$1" in
+       qemu-system-x86_64)
+               KVM_CPU=kvm64
+               ;;
+       qemu-system-i386)
+               KVM_CPU=kvm32
+               ;;
+       esac
        case "$1" in
        qemu-system-x86_64|qemu-system-i386)
+               echo -machine q35,accel=kvm
+               echo -cpu ${KVM_CPU}
                ;;
        qemu-system-aarch64)
                echo -machine virt,gic-version=host -cpu host
index d2d2a86..e19a444 100644 (file)
@@ -1,2 +1,5 @@
 CONFIG_RCU_TORTURE_TEST=y
 CONFIG_PRINTK_TIME=y
+CONFIG_HYPERVISOR_GUEST=y
+CONFIG_PARAVIRT=y
+CONFIG_KVM_GUEST=y