From mboxrd@z Thu Jan 1 00:00:00 1970 From: Boris Ostrovsky Subject: Re: [PATCH v5 1/6] x86/hvm: Collect information of TSC scaling ratio Date: Wed, 24 Feb 2016 09:49:20 -0500 Message-ID: <56CDC2F0.3060201@oracle.com> References: <1456193104-12761-1-git-send-email-haozhong.zhang@intel.com> <1456193104-12761-2-git-send-email-haozhong.zhang@intel.com> <56CC65F4.4070803@oracle.com> <56CC764F02000078000D53C9@prv-mh.provo.novell.com> <56CC69AC.1030109@oracle.com> <56CC8ACC02000078000D5480@prv-mh.provo.novell.com> <20160224060020.GA3974@hz-desktop.sh.intel.com> <20160224134606.GA10229@hz-desktop.sh.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20160224134606.GA10229@hz-desktop.sh.intel.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 , Andrew Cooper , Jun Nakajima , Kevin Tian , xen-devel@lists.xen.org, Keir Fraser List-Id: xen-devel@lists.xenproject.org On 02/24/2016 08:46 AM, Haozhong Zhang wrote: > Sorry, forgot sending the last reply to Boris. > > On 02/24/16 14:00, Haozhong Zhang wrote: >> On 02/23/16 08:37, Jan Beulich wrote: >>>>>> On 23.02.16 at 15:16, wrote: >>>> On 02/23/2016 09:10 AM, Jan Beulich wrote: >>>>>>>> On 23.02.16 at 15:00, wrote: >>>>>> On 02/22/2016 09:04 PM, Haozhong Zhang wrote: >>>>>> >>>>>>> >>>>>>> + if ( cpu_has_tsc_ratio ) >>>>>>> + svm_function_table.tsc_scaling.ratio_frac_bits = 32; >>>>>>> + >>>>>>> >>>>>>> +#define hvm_tsc_scaling_supported \ >>>>>>> + (!!hvm_funcs.tsc_scaling.ratio_frac_bits) >>>>>>> + >>>>>> What is the difference (in usage) between cpu_has_tsc_ratio and >>>>>> hvm_tsc_scaling_supported? Isn't the first imply the second (and if yes >>>>>> then what's the reason for having the latter)? >>>>> Iiuc cpu_has_tsc_ratio is AMD/SVM specific, while >>>>> hvm_tsc_scaling_supported is meant to be vendor independent. >> Yes, it's to be vendor independent. Earlier versions of this patch >> series set a field tsc_scaling_supported in hvm_function_table if >> cpu_has_vmx_tsc_scaling or cpu_has_tsc_ratio. Jan suggested we could get >> the same information if some of other fields are initialized >> conditionally, and no extra field (tsc_scaling_supported) would be >> needed any more. >> >>>> Ah, OK. Can we then >>>> >>>> #define hvm_tsc_scaling_supported (cpu_has_vmx_tsc_scaling || >>>> cpu_has_tsc_ratio) >>> Why would we? The above is doing precisely (but implicitly) that, >>> just with only one memory access instead of two. >>> >> Boris, does the current one look fine for you, as it does the same thing >> as your suggested one? Yes, this is fine. IMO using cpu_has_* would be slightly more logical but as Jan pointed it is also potentially more costly. Reviewed-by: Boris Ostrovsky -boris