From mboxrd@z Thu Jan 1 00:00:00 1970 From: Haozhong Zhang Subject: Re: [PATCH v3 04/13] x86/time.c: Scale host TSC in pvclock properly Date: Fri, 8 Jan 2016 21:50:43 +0800 Message-ID: <20160108135043.GE16393@hz-desktop.sh.intel.com> References: <1451531020-29964-1-git-send-email-haozhong.zhang@intel.com> <1451531020-29964-5-git-send-email-haozhong.zhang@intel.com> <568F8D5902000078000C4B85@prv-mh.provo.novell.com> <20160108132258.GB16393@hz-desktop.sh.intel.com> <568FCB2002000078000C4E4A@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: <568FCB2002000078000C4E4A@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 06:43, Jan Beulich wrote: > >>> On 08.01.16 at 14:22, wrote: > > On 01/08/16 02:20, Jan Beulich wrote: > >> >>> On 31.12.15 at 04:03, wrote: > >> > --- a/xen/arch/x86/time.c > >> > +++ b/xen/arch/x86/time.c > >> > @@ -815,10 +815,18 @@ static void __update_vcpu_system_time(struct vcpu *v, int force) > >> > } > >> > else > >> > { > >> > - tsc_stamp = t->local_tsc_stamp; > >> > - > >> > - _u.tsc_to_system_mul = t->tsc_scale.mul_frac; > >> > - _u.tsc_shift = (s8)t->tsc_scale.shift; > >> > + if ( has_hvm_container_domain(d) && cpu_has_tsc_ratio ) > >> > >> For symmetry with patches 1 and 2 I'd expect !d->arch.vtsc to be > >> added here too. > > > > even though it's already in the !d->arch.vtsc branch? But I'm fine to > > add it for symmetric. > > Ah, no, I didn't realize (only looking at the patch) that it's in the > else to a respective if(). No need to change it then. > > >> > + { > >> > + tsc_stamp = hvm_funcs.scale_tsc(v, > > t->local_tsc_stamp); > >> > + _u.tsc_to_system_mul = d->arch.vtsc_to_ns.mul_frac; > >> > + _u.tsc_shift = d->arch.vtsc_to_ns.shift; > >> > + } > >> > + else > >> > + { > >> > + tsc_stamp = t->local_tsc_stamp; > >> > + _u.tsc_to_system_mul = t->tsc_scale.mul_frac; > >> > + _u.tsc_shift = (s8)t->tsc_scale.shift; > >> > >> The case has been pointless anyway, and you don't add a similar > >> one in the if() branch - please delete it. > > > > I don't understand why it's pointless. The inner if branch is to > > ensure pvclock provides the scaled TSC information when TSC scaling is > > used, and the inner else branch is to keep the existing behavior when > > TSC scaling is not used. For the outer if branch, TSC scaling is never > > used, so no change is needed. > > Sorry, I see I typo-ed my reply. It was meant to start "The cast > has been ..." > OK, I'll remove it. Haozhong