From: Haozhong Zhang Subject: Re: [PATCH v3 03/13] x86/hvm: Scale host TSC when setting/getting guest TSC Date: Fri, 8 Jan 2016 22:04:54 +0800 Message-ID: <20160108140454.GG16393@hz-desktop.sh.intel.com> References: <1451531020-29964-1-git-send-email-haozhong.zhang@intel.com> <1451531020-29964-4-git-send-email-haozhong.zhang@intel.com> <568F8C4E02000078000C4B4E@prv-mh.provo.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <568F8C4E02000078000C4B4E@prv-mh.provo.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Jan Beulich Cc: Kevin Tian , Keir Fraser , Suravee Suthikulpanit , Andrew Cooper , xen-devel@lists.xen.org, Aravind Gopalakrishnan , Jun Nakajima , Boris Ostrovsky List-Id: xen-devel@lists.xenproject.org On 01/08/16 02:15, Jan Beulich wrote: > >>> On 31.12.15 at 04:03, wrote: > > --- a/xen/arch/x86/hvm/svm/svm.c > > +++ b/xen/arch/x86/hvm/svm/svm.c > > @@ -804,6 +804,16 @@ static uint64_t scale_tsc(uint64_t host_tsc, uint64_t ratio) > > return scaled_host_tsc; > > } > > > > +static uint64_t svm_scale_tsc(struct vcpu *v, uint64_t tsc) > > +{ > > + struct domain *d = v->domain; > > + > > + if ( !cpu_has_tsc_ratio || d->arch.vtsc ) > > The left side of this check is redundant with those at both call sites. > It should either be removed altogether, or converted to an ASSERT(). > Perhaps the right side should move into the callers too (as being > vendor independent), or if not at least the pointless local variable > should be eliminated. > Yes, I'll remove the left check and move the right check to callers. > Further I suppose this new hook really could/should have its > first argument const qualified (the hook isn't supposed to fiddle > with the vCPU). > I'll add 'const'. Haozhong