qemu-commits
[Top][All Lists]
Advanced

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

[Qemu-commits] [qemu/qemu] 569239: backends: Introduce chr-testdev


From: GitHub
Subject: [Qemu-commits] [qemu/qemu] 569239: backends: Introduce chr-testdev
Date: Thu, 07 Aug 2014 10:00:07 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 5692399f0af2b48b164b3c0b5c4c532b186b33ae
      
https://github.com/qemu/qemu/commit/5692399f0af2b48b164b3c0b5c4c532b186b33ae
  Author: Paolo Bonzini <address@hidden>
  Date:   2014-08-06 (Wed, 06 Aug 2014)

  Changed paths:
    M backends/Makefile.objs
    A backends/testdev.c
    M include/sysemu/char.h
    M qapi-schema.json
    M qemu-char.c
    M stubs/Makefile.objs
    A stubs/chr-testdev.c

  Log Message:
  -----------
  backends: Introduce chr-testdev

From: Paolo Bonzini <address@hidden>

chr-testdev enables a virtio serial channel to be used for guest
initiated qemu exits. hw/misc/debugexit already enables guest
initiated qemu exits, but only for PC targets. chr-testdev supports
any virtio-capable target. kvm-unit-tests/arm is already making use
of this backend.

Currently there is a single command implemented, "q".  It takes a
(prefix) argument for the exit code, thus an exit is implemented by
writing, e.g. "1q", to the virtio-serial port.

It can be used as:
   $QEMU ... \
     -device virtio-serial-device \
     -device virtserialport,chardev=ctd -chardev testdev,id=ctd

or, use:
   $QEMU ... \
     -device virtio-serial-device \
     -device virtconsole,chardev=ctd -chardev testdev,id=ctd

to bind it to virtio-serial port0.

Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: Andrew Jones <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>


  Commit: c96778bb843c029846196e62a4977e75fb5ef9b3
      
https://github.com/qemu/qemu/commit/c96778bb843c029846196e62a4977e75fb5ef9b3
  Author: KONRAD Frederic <address@hidden>
  Date:   2014-08-06 (Wed, 06 Aug 2014)

  Changed paths:
    M cpus.c

  Log Message:
  -----------
  icount: put icount variables into TimerState.

This puts qemu_icount and qemu_icount_bias into TimerState structure to allow
them to be migrated.

Signed-off-by: KONRAD Frederic <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>


  Commit: d09eae3726418d4c8df2e195fd1a3bf05074dd48
      
https://github.com/qemu/qemu/commit/d09eae3726418d4c8df2e195fd1a3bf05074dd48
  Author: KONRAD Frederic <address@hidden>
  Date:   2014-08-06 (Wed, 06 Aug 2014)

  Changed paths:
    M cpus.c

  Log Message:
  -----------
  migration: migrate icount fields.

This fixes a bug where qemu_icount and qemu_icount_bias are not migrated.
It adds a subsection "timer/icount" to vmstate_timers so icount is migrated only
when needed.

Signed-off-by: KONRAD Frederic <address@hidden>
Reviewed-by: Amit Shah <address@hidden>
Reviewed-by: Juan Quintela <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>


  Commit: 3f03131390a8c91a0cac530f7ae79b04b42ab928
      
https://github.com/qemu/qemu/commit/3f03131390a8c91a0cac530f7ae79b04b42ab928
  Author: KONRAD Frederic <address@hidden>
  Date:   2014-08-06 (Wed, 06 Aug 2014)

  Changed paths:
    M cpus.c
    M include/qemu/timer.h

  Log Message:
  -----------
  timer: add cpu_icount_to_ns function.

This adds cpu_icount_to_ns function which is needed for reverse execution.

It returns the time for a specific instruction.

Signed-off-by: KONRAD Frederic <address@hidden>
Reviewed-by: Paolo Bonzini <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>


  Commit: 714683950547ea8173aefe25f574874c06233455
      
https://github.com/qemu/qemu/commit/714683950547ea8173aefe25f574874c06233455
  Author: Sebastian Tanase <address@hidden>
  Date:   2014-08-06 (Wed, 06 Aug 2014)

  Changed paths:
    M cpus.c

  Log Message:
  -----------
  icount: Fix virtual clock start value on ARM

When using the icount option on ARM, the virtual
clock starts counting at realtime clock but it
should start at 0.

The reason why the virtual clock starts at realtime clock
is because the first time we call qemu_clock_warp (which
calls icount_warp_rt) in tcg_exec_all, qemu_icount_bias
(which is part of the virtual time computation mechanism)
will increment by realtime - vm_clock_warp_start, with
vm_clock_warp_start being 0 (see icount_warp_rt in cpus.c).

By changing the value of vm_clock_warp_start from 0 to -1,
the first time we call qemu_clock_warp which calls
icount_warp_rt, we will return immediatly because
icount_warp_rt first checks if vm_clock_warp_start is -1
and if it's the case it returns. Therefore, qemu_icount_bias
will first be incremented by the value of a virtual timer
deadline when the virtual cpu goes from active to inactive.

The virtual time will start at 0 and increment based
on the instruction counter when the vcpu is active or
the qemu_icount_bias value when inactive.

Signed-off-by: Sebastian Tanase <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>


  Commit: 1ad9580bd730f195a59136d11fdc431f90f266aa
      
https://github.com/qemu/qemu/commit/1ad9580bd730f195a59136d11fdc431f90f266aa
  Author: Sebastian Tanase <address@hidden>
  Date:   2014-08-06 (Wed, 06 Aug 2014)

  Changed paths:
    M cpus.c
    M include/qemu-common.h
    M qemu-options.hx
    M qtest.c
    M vl.c

  Log Message:
  -----------
  icount: Add QemuOpts for icount

Make icount parameter use QemuOpts style options in order
to easily add other suboptions.

Signed-off-by: Sebastian Tanase <address@hidden>
Tested-by: Camille Bégué <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>


  Commit: a8bfac37085c3372366d722f131a7e18d664ee4d
      
https://github.com/qemu/qemu/commit/a8bfac37085c3372366d722f131a7e18d664ee4d
  Author: Sebastian Tanase <address@hidden>
  Date:   2014-08-06 (Wed, 06 Aug 2014)

  Changed paths:
    M cpus.c
    M include/qemu-common.h
    M qemu-options.hx
    M vl.c

  Log Message:
  -----------
  icount: Add align option to icount

The align option is used for activating the align algorithm
in order to synchronise the host clock and the guest clock.

Signed-off-by: Sebastian Tanase <address@hidden>
Tested-by: Camille Bégué <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>


  Commit: c2aa5f819900660f936faadfe92fe5d60a562482
      
https://github.com/qemu/qemu/commit/c2aa5f819900660f936faadfe92fe5d60a562482
  Author: Sebastian Tanase <address@hidden>
  Date:   2014-08-06 (Wed, 06 Aug 2014)

  Changed paths:
    M cpu-exec.c
    M cpus.c
    M include/qemu/timer.h

  Log Message:
  -----------
  cpu-exec: Add sleeping algorithm

The goal is to sleep qemu whenever the guest clock
is in advance compared to the host clock (we use
the monotonic clocks). The amount of time to sleep
is calculated in the execution loop in cpu_exec.

At first, we tried to approximate at each for loop the real time elapsed
while searching for a TB (generating or retrieving from cache) and
executing it. We would then approximate the virtual time corresponding
to the number of virtual instructions executed. The difference between
these 2 values would allow us to know if the guest is in advance or delayed.
However, the function used for measuring the real time
(qemu_clock_get_ns(QEMU_CLOCK_REALTIME)) proved to be very expensive.
We had an added overhead of 13% of the total run time.

Therefore, we modified the algorithm and only take into account the
difference between the 2 clocks at the begining of the cpu_exec function.
During the for loop we try to reduce the advance of the guest only by
computing the virtual time elapsed and sleeping if necessary. The overhead
is thus reduced to 3%. Even though this method still has a noticeable
overhead, it no longer is a bottleneck in trying to achieve a better
guest frequency for which the guest clock is faster than the host one.

As for the the alignement of the 2 clocks, with the first algorithm
the guest clock was oscillating between -1 and 1ms compared to the host clock.
Using the second algorithm we notice that the guest is 5ms behind the host, 
which
is still acceptable for our use case.

The tests where conducted using fio and stress. The host machine in an i5 CPU at
3.10GHz running Debian Jessie (kernel 3.12). The guest machine is an arm 
versatile-pb
built with buildroot.

Currently, on our test machine, the lowest icount we can achieve that is 
suitable for
aligning the 2 clocks is 6. However, we observe that the IO tests (using fio) 
are
slower than the cpu tests (using stress).

Signed-off-by: Sebastian Tanase <address@hidden>
Tested-by: Camille Bégué <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>


  Commit: 7f7bc144ed653c6026ec956045224666abdec316
      
https://github.com/qemu/qemu/commit/7f7bc144ed653c6026ec956045224666abdec316
  Author: Sebastian Tanase <address@hidden>
  Date:   2014-08-06 (Wed, 06 Aug 2014)

  Changed paths:
    M cpu-exec.c

  Log Message:
  -----------
  cpu-exec: Print to console if the guest is late

If the align option is enabled, we print to the user whenever
the guest clock is behind the host clock in order for he/she
to have a hint about the actual performance. The maximum
print interval is 2s and we limit the number of messages to 100.
If desired, this can be changed in cpu-exec.c

Signed-off-by: Sebastian Tanase <address@hidden>
Tested-by: Camille Bégué <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>


  Commit: 27498bef357de432a9aa403c5ccf11776773ba58
      
https://github.com/qemu/qemu/commit/27498bef357de432a9aa403c5ccf11776773ba58
  Author: Sebastian Tanase <address@hidden>
  Date:   2014-08-07 (Thu, 07 Aug 2014)

  Changed paths:
    M cpu-exec.c
    M cpus.c
    M include/qemu-common.h
    M monitor.c

  Log Message:
  -----------
  monitor: Add drift info to 'info jit'

Show in 'info jit' the current delay between the host clock
and the guest clock. In addition, print the maximum advance
and delay of the guest compared to the host.

Signed-off-by: Sebastian Tanase <address@hidden>
Tested-by: Camille Bégué <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>


  Commit: eddedd546a68f6ac864b71d50dd8d39b939b724b
      
https://github.com/qemu/qemu/commit/eddedd546a68f6ac864b71d50dd8d39b939b724b
  Author: James Hogan <address@hidden>
  Date:   2014-08-07 (Thu, 07 Aug 2014)

  Changed paths:
    M target-mips/op_helper.c

  Log Message:
  -----------
  target-mips: Ignore unassigned accesses with KVM

MIPS registers an unassigned access handler which raises a guest bus
error exception. However this causes QEMU to crash when KVM is enabled
as it isn't called from the main execution loop so longjmp() gets called
without a corresponding setjmp().

Until the KVM API can be updated to trigger a guest exception in
response to an MMIO exit, prevent the bus error exception being raised
from mips_cpu_unassigned_access() if KVM is enabled.

The check is at run time since the do_unassigned_access callback is
initialised before it is known whether KVM will be enabled.

The problem can be triggered with Malta emulation by making the guest
write to the reset region at physical address 0x1bf00000, since it is
marked read-only which is treated as unassigned for writes.

Signed-off-by: James Hogan <address@hidden>
Reviewed-by: Aurelien Jarno <address@hidden>
Cc: Peter Maydell <address@hidden>
Cc: Paolo Bonzini <address@hidden>
Cc: Gleb Natapov <address@hidden>
Cc: Christoffer Dall <address@hidden>
Cc: Sanjay Lal <address@hidden>
Signed-off-by: Paolo Bonzini <address@hidden>


  Commit: 2ee55b8351910e5dd898f52415064a4c5479baba
      
https://github.com/qemu/qemu/commit/2ee55b8351910e5dd898f52415064a4c5479baba
  Author: Peter Maydell <address@hidden>
  Date:   2014-08-07 (Thu, 07 Aug 2014)

  Changed paths:
    M backends/Makefile.objs
    A backends/testdev.c
    M cpu-exec.c
    M cpus.c
    M include/qemu-common.h
    M include/qemu/timer.h
    M include/sysemu/char.h
    M monitor.c
    M qapi-schema.json
    M qemu-char.c
    M qemu-options.hx
    M qtest.c
    M stubs/Makefile.objs
    A stubs/chr-testdev.c
    M target-mips/op_helper.c
    M vl.c

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging

KVM changes include a MIPS patch and the testdev backend used by the
ARM kvm-unit-tests.  icount include the first part of reverse execution
and Sebastian Tanase's patches to slow down -icount execution to the
desired speed of the target.

v1->v2: fix dump_drift_info to print nothing outside icount mode,
  and to compile on 32-bit architectures

# gpg: Signature made Thu 07 Aug 2014 14:09:58 BST using RSA key ID 9B4D86F2
# gpg: Good signature from "Paolo Bonzini <address@hidden>"
# gpg:                 aka "Paolo Bonzini <address@hidden>"

* remotes/bonzini/tags/for-upstream:
  target-mips: Ignore unassigned accesses with KVM
  monitor: Add drift info to 'info jit'
  cpu-exec: Print to console if the guest is late
  cpu-exec: Add sleeping algorithm
  icount: Add align option to icount
  icount: Add QemuOpts for icount
  icount: Fix virtual clock start value on ARM
  timer: add cpu_icount_to_ns function.
  migration: migrate icount fields.
  icount: put icount variables into TimerState.
  backends: Introduce chr-testdev

Signed-off-by: Peter Maydell <address@hidden>


Compare: https://github.com/qemu/qemu/compare/9d8bb3557408...2ee55b835191

reply via email to

[Prev in Thread] Current Thread [Next in Thread]