From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cooper Subject: Re: [PATCH v2] x86: reduce redundancy in tsc_[gs]et_info() Date: Tue, 6 May 2014 15:04:42 +0100 Message-ID: <5368EBFA.8000402@citrix.com> References: <5368FFD0020000780000F64D@mail.emea.novell.com> <5368E854.2050303@citrix.com> <53690625020000780000F719@mail.emea.novell.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WhfzD-0005YV-Ke for xen-devel@lists.xenproject.org; Tue, 06 May 2014 14:04:47 +0000 In-Reply-To: <53690625020000780000F719@mail.emea.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: xen-devel , Boris Ostrovsky , Keir Fraser List-Id: xen-devel@lists.xenproject.org On 06/05/14 14:56, Jan Beulich wrote: >>>> On 06.05.14 at 15:49, wrote: >> On 06/05/14 14:29, Jan Beulich wrote: >>> case TSC_MODE_PVRDTSCP: >>> - d->arch.vtsc = boot_cpu_has(X86_FEATURE_RDTSCP) && >>> - host_tsc_is_safe() ? 0 : 1; >>> + d->arch.vtsc = boot_cpu_has(X86_FEATURE_RDTSCP) && >>> + host_tsc_is_safe() ? 0 : 1; >> Can this be reduced to boot_cpu_has(X86_FEATURE_RDTSCP) && >> !host_tsc_is_safe() ? >> >> I believe this is the correct way around with the precedence between && >> and ?!, but it is far from clear. Alternatively, could some brackets be >> introduced for clarity? > No, ?: has lower precedence than all binary operators other than > assignment ones and comma. But yes, this is ugly - I'll change it to /Sigh - I specifically looked the precedence up, then mentally got it wrong given the linebreak. It really is in need of some clarification. > > d->arch.vtsc = !(boot_cpu_has(X86_FEATURE_RDTSCP) && host_tsc_is_safe()); This was going to be my suggestion given the correct precedence. ~Andrew > > or, one character shorter, > > d->arch.vtsc = !boot_cpu_has(X86_FEATURE_RDTSCP) || !host_tsc_is_safe(); > > (somehow I also managed to overlook the other double space in there). > > Jan >