From: Avi Kivity <avi@redhat.com>
To: Joerg Roedel <joro@8bytes.org>
Cc: Joerg Roedel <joerg.roedel@amd.com>,
Marcelo Tosatti <mtosatti@redhat.com>,
Zachary Amsden <zamsden@redhat.com>,
kvm@vger.kernel.org
Subject: Re: [PATCH 4/6] KVM: SVM: Propagate requested TSC frequency on vcpu init
Date: Thu, 24 Mar 2011 12:30:38 +0200 [thread overview]
Message-ID: <4D8B1D4E.10008@redhat.com> (raw)
In-Reply-To: <20110324102129.GF18867@8bytes.org>
On 03/24/2011 12:21 PM, Joerg Roedel wrote:
> On Thu, Mar 24, 2011 at 12:04:13PM +0200, Avi Kivity wrote:
> > On 03/24/2011 09:40 AM, Joerg Roedel wrote:
> >> This patch implements the propagation of the VM
> >> virtual_tsc_khz into each vcpu data-structure to enable the
> >> tsc-scaling feature.
> >> static void svm_write_tsc_offset(struct kvm_vcpu *vcpu, u64 offset)
> >> {
> >> struct vcpu_svm *svm = to_svm(vcpu);
> >> @@ -1093,6 +1123,9 @@ static struct kvm_vcpu *svm_create_vcpu(struct kvm *kvm, unsigned int id)
> >> if (err)
> >> goto free_svm;
> >>
> >> + if (!svm_vcpu_init_tsc(kvm, svm))
> >> + goto uninit;
> >> +
> >
> > Need to set err.
> >
> > I'm not really happy about failing on vcpu creation. Prefer to fail
> > when setting the frequency.
>
> Yes, in theory this shouldn't happen anyway because wrong frequencies
> are catched when setting them via the ioctl. This is just another check,
> but it should probably be turned into a BUG_ON in svm_vcpu_init_tsc()
> because it is a bug that userspace could set an invalid khz value.
Yes, I saw later. But BUG_ON() is too dangerous - if the checks don't
exactly match a malicious user could cause a DOS.
We can just avoid setting the scale and run with the host tsc frequency.
--
error compiling committee.c: too many arguments to function
next prev parent reply other threads:[~2011-03-24 10:30 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-24 7:40 [PATCH 0/6][RESEND] TSC scaling support for KVM v2 Joerg Roedel
2011-03-24 7:40 ` [PATCH 1/6] KVM: SVM: Implement infrastructure for TSC_RATE_MSR Joerg Roedel
2011-03-24 9:51 ` Avi Kivity
2011-03-24 9:58 ` Joerg Roedel
2011-03-24 7:40 ` [PATCH 2/6] KVM: X86: Let kvm-clock report the right tsc frequency Joerg Roedel
2011-03-24 9:58 ` Avi Kivity
2011-03-24 7:40 ` [PATCH 3/6] KVM: X86: Make tsc_delta calculation a function of guest tsc Joerg Roedel
2011-03-24 7:40 ` [PATCH 4/6] KVM: SVM: Propagate requested TSC frequency on vcpu init Joerg Roedel
2011-03-24 10:04 ` Avi Kivity
2011-03-24 10:21 ` Joerg Roedel
2011-03-24 10:30 ` Avi Kivity [this message]
2011-03-24 7:40 ` [PATCH 5/6] KVM: X86: Delegate tsc-offset calculation to architecture code Joerg Roedel
2011-03-24 7:40 ` [PATCH 6/6] KVM: X86: Implement userspace interface to set virtual_tsc_khz Joerg Roedel
2011-03-24 10:14 ` Avi Kivity
2011-03-24 10:41 ` Joerg Roedel
2011-03-24 10:44 ` Avi Kivity
2011-03-24 10:47 ` Joerg Roedel
-- strict thread matches above, loose matches on Subject: below --
2011-03-15 9:36 [PATCH 0/6] TSC scaling support for KVM v2 Joerg Roedel
2011-03-15 9:36 ` [PATCH 4/6] KVM: SVM: Propagate requested TSC frequency on vcpu init Joerg Roedel
2011-02-09 17:29 [PATCH 0/6] KVM support for TSC scaling Joerg Roedel
2011-02-09 17:29 ` [PATCH 4/6] KVM: SVM: Propagate requested TSC frequency on vcpu init Joerg Roedel
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=4D8B1D4E.10008@redhat.com \
--to=avi@redhat.com \
--cc=joerg.roedel@amd.com \
--cc=joro@8bytes.org \
--cc=kvm@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 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.