From: Haozhong Zhang Subject: Re: [PATCH 04/13] x86/hvm: Setup TSC scaling ratio Date: Fri, 23 Oct 2015 16:40:00 +0800 Message-ID: <20151023083931.GA19728@hzzhang-OptiPlex-9020.sh.intel.com> References: <1443424438-13404-1-git-send-email-haozhong.zhang@intel.com> <1443424438-13404-5-git-send-email-haozhong.zhang@intel.com> <5628FD0302000078000AD8EE@prv-mh.provo.novell.com> <20151023074441.GD3830@hzzhang-OptiPlex-9020.sh.intel.com> <562A051202000078000ADD9B@prv-mh.provo.novell.com> <20151023081820.GF3830@hzzhang-OptiPlex-9020.sh.intel.com> <562A0C6F02000078000ADE0E@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: <562A0C6F02000078000ADE0E@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 , Wei Liu , Ian Campbell , Stefano Stabellini , Jun Nakajima , Andrew Cooper , Ian Jackson , xen-devel@lists.xen.org, Aravind Gopalakrishnan , Suravee Suthikulpanit , Keir Fraser , Boris Ostrovsky List-Id: xen-devel@lists.xenproject.org On Fri, Oct 23, 2015 at 02:31:11AM -0600, Jan Beulich wrote: > >>> On 23.10.15 at 10:18, wrote: > > On Fri, Oct 23, 2015 at 01:59:46AM -0600, Jan Beulich wrote: > >> >>> On 23.10.15 at 09:44, wrote: > >> > On Thu, Oct 22, 2015 at 07:13:07AM -0600, Jan Beulich wrote: > >> >> >>> On 28.09.15 at 09:13, wrote: > >> > >> Please remember to trim your replies. > >> > >> >> > @@ -2023,6 +2051,9 @@ static int hvm_load_cpu_ctxt(struct domain *d, > > hvm_domain_context_t *h) > >> >> > if ( hvm_funcs.load_cpu_ctxt(v, &ctxt) < 0 ) > >> >> > return -EINVAL; > >> >> > > >> >> > + if ( !v->domain->arch.vtsc && hvm_funcs.tsc_scaling_supported ) > >> >> > + hvm_setup_tsc_scaling(v); > >> >> > >> >> What's the rationale for putting it in this function? > >> > > >> > hvm_load_cpu_ctxt() is called in the migration to restore vcpu's state > >> > including TSC related things, so hvm_setup_tsc_scaling() is called > >> > here. > >> > > >> > hvm_vcpu_reset_state() is not called in the migration, so we cannot > >> > rely on the call to hvm_setup_tsc_scaling() there. > >> > >> All that is understood, but doesn't explain why the scaling setup gets > >> done here instead of somewhere after _all_ state got loaded. > > > > Because vcpu is waken up at the end of hvm_vcpu_reset_state(), the > > setup of TSC scaling should be done before that. > > But we're talking about hvm_load_cpu_ctxt() here. > Sorry for the typo. s/hvm_vcpu_reset_state/hvm_load_cpu_ctxt > Jan >