From: Oliver Upton <oupton@google.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: kvm@vger.kernel.org, Sean Christopherson <seanjc@google.com>,
Vitaly Kuznetsov <vkuznets@redhat.com>,
Wanpeng Li <wanpengli@tencent.com>,
Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
David Woodhouse <dwmw2@infradead.org>,
David Woodhouse <dwmw@amazon.co.uk>
Subject: Re: [PATCH] Documentation: KVM: Describe guest TSC scaling in migration algorithm
Date: Sat, 19 Mar 2022 07:59:57 +0000 [thread overview]
Message-ID: <YjWNfQThS4URRMZC@google.com> (raw)
In-Reply-To: <0bff64ae-0420-2f69-10ba-78b9c5ac7b81@redhat.com>
On Sat, Mar 19, 2022 at 08:52:56AM +0100, Paolo Bonzini wrote:
> On 3/18/22 19:39, Oliver Upton wrote:
> > Hi Paolo,
> >
> > On Wed, Mar 16, 2022 at 08:47:59AM +0100, Paolo Bonzini wrote:
> > > On 3/16/22 05:53, Oliver Upton wrote:
> > > > The VMM has control of both the guest's TSC scale and offset. Extend the
> > > > described migration algorithm in the KVM_VCPU_TSC_OFFSET documentation
> > > > to cover TSC scaling.
> > > >
> > > > Reported-by: David Woodhouse<dwmw@amazon.co.uk>
> > > > Signed-off-by: Oliver Upton<oupton@google.com>
> > > > ---
> > > >
> > > > Applies to kvm/queue (references KVM_{GET,SET}_TSC_KHZ on a VM fd).
> > >
> > > A few more things that have to be changed:
> > >
> > > > 1. Invoke the KVM_GET_CLOCK ioctl to record the host TSC (tsc_src),
> > > > kvmclock nanoseconds (guest_src), and host CLOCK_REALTIME nanoseconds
> > > > (host_src).
> > > >
> > >
> > > One of two changes:
> > >
> > > a) Add "Multiply tsc_src by guest_freq / src_freq to obtain scaled_tsc_src",
> > > add a new device attribute for the host TSC frequency.
> > >
> > > b) Add "Multiply tsc_src by src_ratio to obtain scaled_tsc_src", add a new
> > > device attribute for the guest_frequency/host_frequency ratio.
> > >
> > > A third would be scaling the host TSC frequency in KVM_GETCLOCK, but that's
> > > confusing IMO.
> >
> > Agreed -- I think kvmclock should remain as is.
> >
> > A fourth would be to expose the host's TSC frequency outside of KVM
> > since we're really in the business of guest features, not host ones :-)
> > We already have a patch that does this internally, and its visible in
> > some of our open source userspace libraries [1].
>
> Yeah, it was a bit of a cop out on my part but adding it to sysfs would be
> nice. Please tell me if any of you going to send a patch, or even just
> share it so that I can handle the upstream submission.
I'll have some time to look at it next week and send upstream. I was
somewhat panning if there were any other ideas here, but sysfs does seem
sensible :)
--
Thanks,
Oliver
next prev parent reply other threads:[~2022-03-19 8:00 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-16 4:53 [PATCH] Documentation: KVM: Describe guest TSC scaling in migration algorithm Oliver Upton
2022-03-16 7:47 ` Paolo Bonzini
2022-03-18 18:39 ` Oliver Upton
2022-03-19 7:52 ` Paolo Bonzini
2022-03-19 7:59 ` Oliver Upton [this message]
2022-03-19 8:08 ` David Woodhouse
2022-03-19 11:54 ` Paolo Bonzini
2022-03-19 13:00 ` Paolo Bonzini
2022-03-19 13:13 ` David Woodhouse
2022-03-20 8:10 ` Paolo Bonzini
2022-03-20 8:52 ` Oliver Upton
2022-03-20 9:46 ` David Woodhouse
2022-03-21 0:38 ` Oliver Upton
2022-03-21 19:43 ` David Woodhouse
2022-03-21 21:23 ` Oliver Upton
2022-03-20 13:39 ` Paolo Bonzini
2022-03-21 0:51 ` Oliver Upton
2022-03-21 12:36 ` Paolo Bonzini
2022-03-21 12:56 ` David Woodhouse
2022-03-21 12:16 ` David Woodhouse
2022-03-21 13:10 ` Paolo Bonzini
2022-03-21 14:59 ` David Woodhouse
-- strict thread matches above, loose matches on Subject: below --
2022-03-22 19:18 Franke, Daniel
2022-03-22 21:53 ` Oliver Upton
2022-03-23 12:35 ` David Woodhouse
2022-03-23 16:21 ` Oliver Upton
2022-03-25 9:03 ` David Woodhouse
2022-03-25 17:47 ` Oliver Upton
2022-03-29 14:19 ` Thomas Gleixner
2022-03-29 16:02 ` Oliver Upton
2022-03-29 19:34 ` Thomas Gleixner
2022-06-30 11:58 ` David Woodhouse
2022-07-05 14:43 ` David Woodhouse
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=YjWNfQThS4URRMZC@google.com \
--to=oupton@google.com \
--cc=dwmw2@infradead.org \
--cc=dwmw@amazon.co.uk \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=vkuznets@redhat.com \
--cc=wanpengli@tencent.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.