From mboxrd@z Thu Jan 1 00:00:00 1970 From: Boris Ostrovsky Subject: Re: [PATCH v3 1/1] x86/HVM: Use fixed TSC value when saving or restoring domain Date: Thu, 10 Apr 2014 10:33:50 -0400 Message-ID: <5346ABCE.70401@oracle.com> References: <1397064597-11133-1-git-send-email-boris.ostrovsky@oracle.com> <1397064597-11133-2-git-send-email-boris.ostrovsky@oracle.com> <53465C73020000780000777E@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <53465C73020000780000777E@nat28.tlf.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@intel.com, eddie.dong@intel.com, jun.nakajima@intel.com, suravee.suthikulpanit@amd.com, xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org On 04/10/2014 02:55 AM, Jan Beulich wrote: > >> --- a/xen/arch/x86/hvm/hvm.c >> +++ b/xen/arch/x86/hvm/hvm.c >> @@ -255,16 +255,20 @@ int hvm_set_guest_pat(struct vcpu *v, u64 guest_pat) >> return 1; >> } >> >> -void hvm_set_guest_tsc(struct vcpu *v, u64 guest_tsc) >> +void hvm_set_guest_tsc_fixed(struct vcpu *v, u64 guest_tsc, u64 at_tsc) > What I now started wondering is (namely with the struct > hvm_function_table pointer also gaining the extra argument): Is > this ever being called with a zero at_tsc when > v->domain->arch.chkpt_tsc is non-zero? If not, rather than passing > around the value I guess the function could simply read it itself. And > yes, this is meant only for the "set" version, I'm relatively convinced > that the "get" ones would (or could easily become) different. I couldn't convince myself that v->domain->arch.chkpt_tsc is always the same as at_tsc. I think it is (and that's why arch_hvm_save_done() was added) but I was worried that there may be some other path to hvm_set_guest_tsc(). The other reason was for symmetry with the the "get" counterpart. > >> --- a/xen/include/asm-x86/domain.h >> +++ b/xen/include/asm-x86/domain.h >> @@ -308,6 +308,8 @@ struct arch_domain >> (possibly other cases in the future */ >> uint64_t vtsc_kerncount; /* for hvm, counts all vtsc */ >> uint64_t vtsc_usercount; /* not used for hvm */ >> + uint64_t chkpt_tsc; /* TSC value that VCPUs use to calculate their >> + tsc_offset value. Used during save/restore */ > I'm sorry for not asking earlier - why does this get put in struct > arch_domain rather than struct hvm_domain? Right. hvm_domain seems like a better place given that this is only relevant to HVM. -boris