public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Christian Borntraeger <borntraeger@de.ibm.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
	Alexander Graf <agraf@suse.de>,
	"Jason J. Herne" <jjherne@linux.vnet.ibm.com>,
	kvm@vger.kernel.org, cornelia.huck@de.ibm.com, aik@ozlabs.ru
Subject: Re: [PATCH 1/1] kvm-s390: Provide guest TOD Clock Get/Set Controls
Date: Thu, 06 Nov 2014 09:43:35 +0100	[thread overview]
Message-ID: <545B34B7.2070401@de.ibm.com> (raw)
In-Reply-To: <545A7E67.5020507@redhat.com>

Am 05.11.2014 20:45, schrieb Paolo Bonzini:
> 
> 
> On 05/11/2014 18:56, Christian Borntraeger wrote:
>>>>
>>>> Whether you want to follow that approach or do it as VM attribute
>>>> straight away, I don't mind much :).
>> given that top programmable field and epoch are available as ONEREG, lets do the same for TOD.
> 
> Is the epoch per-cpu?

two answers :-)

- the implementation is one epoch per control block, so someone could do that per CPU...but:
- guest TOD == host TOD + epochdiff. architecture mandates that there is only one TOD per system, so all guest TODs must be synced and so must be all epochdiffs

Some background. We provided access to the epoch value about 2 years ago with other things as ONEREG. Asumming that all hosts are time synced, we could just migrate the epoch value.
Now: this is not the case all the time. Just migrating the epoch could result in time jumping forth and back.

This thing is now: QEMU cannot calculate a correction reliably, because it cannot rely on the value of the TOD (by using stck) since the kernel might do tricks with the host TOD value as soon as we enable time synching between z boxes.
(Thats why normal userspace should not use stck either, it should use gettimeofday because the kernel might have offsets etc due to NTP or time synching between boxes). So we finally cam up with just migrating the guest visible TOD, which seems to work fine.

As a recap we have now:
#define KVM_REG_S390_TODPR     (KVM_REG_S390 | KVM_REG_SIZE_U32 | 0x1)
#define KVM_REG_S390_EPOCHDIFF (KVM_REG_S390 | KVM_REG_SIZE_U64 | 0x2)

and we would
add
#define KVM_REG_S390_TOD       (KVM_REG_S390 | KVM_REG_SIZE_U64 | 0x3) 
#define KVM_REG_S390_TOD_INDEX (KVM_REG_S390 | KVM_REG_SIZE_U8 | 0x4)
(any better name?)

Makes sense?

Christian


  reply	other threads:[~2014-11-06  8:43 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-27 15:44 [PATCH 0/1] kvm-s390: Provide guest TOD Clock Get/Set Controls Jason J. Herne
2014-10-27 15:44 ` [PATCH 1/1] " Jason J. Herne
2014-11-05 10:07   ` Alexander Graf
2014-11-05 12:28     ` Christian Borntraeger
2014-11-05 13:11       ` Paolo Bonzini
2014-11-05 14:32         ` Alexander Graf
2014-11-05 14:54           ` Paolo Bonzini
2014-11-05 16:48         ` Christian Borntraeger
2014-11-05 17:37           ` Alexander Graf
2014-11-05 17:56             ` Christian Borntraeger
2014-11-05 19:45               ` Paolo Bonzini
2014-11-06  8:43                 ` Christian Borntraeger [this message]
2014-11-06  8:46                   ` Christian Borntraeger
2014-11-06  9:57                   ` Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=545B34B7.2070401@de.ibm.com \
    --to=borntraeger@de.ibm.com \
    --cc=agraf@suse.de \
    --cc=aik@ozlabs.ru \
    --cc=cornelia.huck@de.ibm.com \
    --cc=jjherne@linux.vnet.ibm.com \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox