From mboxrd@z Thu Jan 1 00:00:00 1970 From: Boris Ostrovsky Subject: Re: [PATCH 06/13] x86/hvm: Scale host TSC when setting/getting guest TSC Date: Thu, 22 Oct 2015 11:44:52 -0400 Message-ID: <56290474.8020404@oracle.com> References: <1443424438-13404-1-git-send-email-haozhong.zhang@intel.com> <1443424438-13404-7-git-send-email-haozhong.zhang@intel.com> <56290C1902000078000AD930@prv-mh.provo.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <56290C1902000078000AD930@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 , Aravind Gopalakrishnan , Suravee Suthikulpanit , Haozhong Zhang Cc: Kevin Tian , Wei Liu , Ian Campbell , Stefano Stabellini , Andrew Cooper , Ian Jackson , xen-devel@lists.xen.org, Jun Nakajima , Keir Fraser List-Id: xen-devel@lists.xenproject.org On 10/22/2015 10:17 AM, Jan Beulich wrote: >>>> On 28.09.15 at 09:13, wrote: >> The existing hvm_set_guest_tsc_fixed() and hvm_get_guest_tsc_fixed() >> calculate the guest TSC by adding the TSC offset to the host TSC. When >> the TSC scaling is enabled, the host TSC should be scaled first. This >> patch adds the scaling logic to those two functions. > Just like mentioned for the first twp patches - I'd first of all like to > understand why the lack of scaling this wasn't an issue for SVM so > far. What you reads plausible, but assuming that SVM TSC scaling > code was tested, I'm hesitant to apply changes to it without > understanding the details (or at least without SVM maintainers' > consent). I don't see that this series will create any regressions in SVM . Most of the changes move SVM-specific code into HVM I didn't see any obvious problems there. I do have concern about patch 5 since I am sure I fully understand whether the new algorithm (in __scale_tsc()) is equivalent to current SVM code. I think you also had questions about that. Having said this, the fact that this patch (and patch 9) fix bugs leads me to believe this feature may not have been thoroughly tested. I don't have a pair of appropriate AMD systems to test this series with migration (which is where this can be verified). Aravind, can you find something and see how this works? -boris > >> --- a/xen/arch/x86/hvm/hvm.c >> +++ b/xen/arch/x86/hvm/hvm.c >> @@ -388,13 +388,12 @@ void hvm_set_guest_tsc_fixed(struct vcpu *v, u64 guest_tsc, u64 at_tsc) >> tsc = hvm_get_guest_time_fixed(v, at_tsc); >> tsc = gtime_to_gtsc(v->domain, tsc); >> } >> - else if ( at_tsc ) >> - { >> - tsc = at_tsc; >> - } >> else >> { >> - tsc = rdtsc(); >> + tsc = at_tsc ? at_tsc : rdtsc(); > In cases like this please prefer the gcc extension allowing the middle > operand of the ?: to be omitted. > > Jan >