All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: xen-devel <xen-devel@lists.xenproject.org>,
	Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	Keir Fraser <keir@xen.org>
Subject: Re: [PATCH v2] x86: reduce redundancy in tsc_[gs]et_info()
Date: Tue, 6 May 2014 15:04:42 +0100	[thread overview]
Message-ID: <5368EBFA.8000402@citrix.com> (raw)
In-Reply-To: <53690625020000780000F719@mail.emea.novell.com>

On 06/05/14 14:56, Jan Beulich wrote:
>>>> On 06.05.14 at 15:49, <andrew.cooper3@citrix.com> 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
>

      reply	other threads:[~2014-05-06 14:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-06 13:29 [PATCH v2] x86: reduce redundancy in tsc_[gs]et_info() Jan Beulich
2014-05-06 13:49 ` Andrew Cooper
2014-05-06 13:56   ` Jan Beulich
2014-05-06 14:04     ` Andrew Cooper [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5368EBFA.8000402@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=keir@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.