qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [RFC 0/4] target-ppc: handle KVM timebase migration


From: David Gibson
Subject: Re: [Qemu-devel] [RFC 0/4] target-ppc: handle KVM timebase migration
Date: Fri, 15 Apr 2016 15:27:04 +1000
User-agent: Mutt/1.5.24 (2015-08-30)

On Thu, Apr 07, 2016 at 04:23:10PM +0100, Mark Cave-Ayland wrote:
> This RFC series follows on from discussions in the "Migrating decrementer"
> thread relating to handling migration of the timebase and decrementer
> registers for both TCG and KVM. The aim is to provide a consistent virtual
> clock when migrating PPC machines TCG-TCG (already handled) and
> KVM-KVM with both paused and live VMs in a unified manner for all PPC
> machine types.
> 
> The existing code to handle timebase migration on PPC has a few issues:
> 
> 1) It uses cpu_get_host_ticks() which doesn't work correctly on TCG with
> different host architectures

Yeah, that's just wrong.  We should be using qemu_clock_get_ns()
instead.

> 2) tb_offset is calculated from the difference in the host clock between
> source and destination. Thus if the guest is paused then the resulting
> offset is calculated incorrectly since the host clock still runs, regardless
> of the state of the virtual clock.
> 
> 3) Due to a typo in the existing implementation (MIN instead of MAX) then
> guest_tb never takes migration_duration_tb into account

The statement above is not correct.  The problem is not MIN vs. MAX.
The problem is that it was assuming a 1s limit on downtime during
migration which is Just Plain Wrong - especialy in the case where it's
actually a savevm / restore rather than a live migration.

Having a long downtime shouldn't break the guest's timebase sync with
realtime.

> Patches 1-2 introduce a new PPCMachineClass and derive all the PPC machine
> classes from it, not dissimilar to x86's PCMachineClass.
> 
> Patch 3 adds a VM state change hook into PCMachineClass and updates the
> tb_offset from the host when the machine (re)starts as discussed in the
> thread. Note that it may be possible to add the hook to specific machine
> types, however using PPCMachineClass allows all PPC machines to pick up
> this functionality automatically.
> 
> Patch 4 temporarily disables the existing timebase migration code to allow
> testing.
> 
> Note that this has only been compile-tested on x86 as I have no KVM PPC
> hardware and so it's really an RFC to determine whether this approach can
> work, and to invite testing and discussion from existing KVM PPC users.
> 
> Signed-off-by: Mark Cave-Ayland <address@hidden>
> 
> 
> Mark Cave-Ayland (4):
>   target-ppc: introduce PPCMachineClass and PPCMachineState
>   target-ppc: derive all PPC machine classes to have PPCMachineClass as
>     their superclass
>   target-ppc: synchronise tb_offset with KVM host on machine start
>   target-ppc: hack to remove existing timebase migration code for
>     testing
> 
>  hw/ppc/e500plat.c       |    7 +++-
>  hw/ppc/mac_newworld.c   |   17 ++------
>  hw/ppc/mac_oldworld.c   |    6 ++-
>  hw/ppc/mpc8544ds.c      |    7 +++-
>  hw/ppc/ppc.c            |  100 
> +++++++++++++++++++++++++++++------------------
>  hw/ppc/ppc405_boards.c  |   28 +++----------
>  hw/ppc/ppc440_bamboo.c  |    6 ++-
>  hw/ppc/prep.c           |    6 ++-
>  hw/ppc/spapr.c          |    2 +-
>  hw/ppc/virtex_ml507.c   |    6 ++-
>  include/hw/ppc/ppc.h    |   35 +++++++++++++++++
>  include/qemu/typedefs.h |    2 +
>  12 files changed, 135 insertions(+), 87 deletions(-)
> 

-- 
David Gibson                    | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
                                | _way_ _around_!
http://www.ozlabs.org/~dgibson

Attachment: signature.asc
Description: PGP signature


reply via email to

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