public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Joerg Roedel <joerg.roedel@amd.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>,
	kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Zachary Amsden <zamsden@redhat.com>
Subject: Re: [PATCH 0/6] KVM support for TSC scaling
Date: Sun, 13 Feb 2011 17:19:19 +0200	[thread overview]
Message-ID: <4D57F677.3090004@redhat.com> (raw)
In-Reply-To: <1297272584-22689-1-git-send-email-joerg.roedel@amd.com>

On 02/09/2011 07:29 PM, Joerg Roedel wrote:
> Hi Avi, Marcelo,
>
> here is the patch-set to implement the TSC-scaling feature of upcoming
> AMD CPUs. When this feature is supported the CPU provides a new MSR
> which holds a multiplier for the hardware TSC which is applied on the
> value rdtsc[p] and reads of MSR 0x10. This feature can be used to
> emulate a given tsc frequency for the guest.
> Patch 1 is not directly related to this patch-set because it only fixes
> a bug which prevented me from testing these patches. In fact it fixes
> the same bug Andre sent a patch for. But after the discussion about his
> patch he told me to just post my patch and thus here it is.
>

Questions:
- the tsc multiplier really is a multiplier, right?  Not an addend that 
is added every cycle.

So

     wrmsr(TSC, 1e9)
     wrmsr(TSC_MULT, 2.0000)
     t = rdtsc()

will return about 2e9, not 1e9 + 2*(time to execute the code snippet) ?

- what's the cost of wrmsr(TSC_MULT)?

There are really two ways to implement this feature.  One is fully 
generic, like you did.  The other is to implement it at the host level - 
have a sysfs file and/or kernel parameter for the desired tsc frequency, 
write it once, and forget about it.  Trust management to set the host 
tsc frequency to the same value on all hosts in a migration cluster.

The advantages of the the simpler implementation are, well, that it's 
simpler, and second that it avoids two wrmsrs per exit.  We could 
combine both implementations, and have

   if (guest_mult != host_mult)
       wrmsr(TSC_MULT, guest_mult)

etc.  But I'd like to understand if there are additional motivations for 
per-guest tsc frequency.

-- 
error compiling committee.c: too many arguments to function


  parent reply	other threads:[~2011-02-13 15:20 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-09 17:29 [PATCH 0/6] KVM support for TSC scaling Joerg Roedel
2011-02-09 17:29 ` [PATCH 1/6] KVM: SVM: Advance instruction pointer in dr_intercept Joerg Roedel
2011-02-22 11:14   ` Roedel, Joerg
2011-02-22 14:01     ` Avi Kivity
2011-02-22 14:33       ` Roedel, Joerg
2011-02-09 17:29 ` [PATCH 2/6] KVM: SVM: Implement infrastructure for TSC_RATE_MSR Joerg Roedel
2011-02-09 17:29 ` [PATCH 3/6] KVM: X86: Let kvm-clock report the right tsc frequency Joerg Roedel
2011-02-09 17:29 ` [PATCH 4/6] KVM: SVM: Propagate requested TSC frequency on vcpu init Joerg Roedel
2011-02-09 17:29 ` [PATCH 5/6] KVM: X86: Delegate tsc-offset calculation to architecture code Joerg Roedel
2011-02-11 22:12   ` Zachary Amsden
2011-02-21 17:16     ` Roedel, Joerg
2011-02-09 17:29 ` [PATCH 6/6] KVM: X86: Implement userspace interface to set virtual_tsc_khz Joerg Roedel
2011-02-13 15:12   ` Avi Kivity
2011-02-21 17:17     ` Roedel, Joerg
2011-02-13 15:19 ` Avi Kivity [this message]
2011-02-21 17:28   ` [PATCH 0/6] KVM support for TSC scaling Roedel, Joerg
2011-02-21 21:25     ` Zachary Amsden
2011-02-22 10:11     ` Avi Kivity
2011-02-22 10:35       ` Roedel, Joerg
2011-02-22 10:41         ` Avi Kivity
2011-02-22 11:11           ` Roedel, Joerg
2011-02-22 14:11             ` Avi Kivity

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=4D57F677.3090004@redhat.com \
    --to=avi@redhat.com \
    --cc=joerg.roedel@amd.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=zamsden@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