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>, Keir Fraser <keir@xen.org>
Subject: Re: [PATCH v3 1/2] x86: simplify non‑atomic bitops
Date: Thu, 26 Mar 2015 09:54:37 +0000	[thread overview]
Message-ID: <5513D75D.3080602@citrix.com> (raw)
In-Reply-To: <5513CABE020000780006DC0B@mail.emea.novell.com>

On 26/03/15 08:00, Jan Beulich wrote:
>>>> On 25.03.15 at 18:49, <andrew.cooper3@citrix.com> wrote:
>> On 20/03/15 14:53, Jan Beulich wrote:
>>> - being non-atomic, their pointer arguments shouldn't be volatile-
>>>     qualified
>>> - their (half fake) memory operands can be a single "+m" instead of
>>>     being both an output and an input
>>>
>>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>> After further consideration, would it not be better to change the
>> non-atomic variants to being straight C.
>>
>> e.g.
>>
>> static inline void __set_bit(int nr, void *_addr)
>> {
>>       int *addr = _addr;
>>       addr[nr / sizeof(int)] |= (1U << (nr % sizeof(int)));
>> }
>>
>> This would drop the memory clobber from the asm statement and allow the
>> compiler to optimise repeated __set_bit() calls to the same word into a
>> single action.
> I wouldn't want to do this in this patch - a similar change that I
> proposed years ago for Linux (not eliminating the asm(), but
> dropping the clobbers) caused not really understood regressions and
> hence needed to be reverted.

Presumably some code was lacking barrier()s

>   We could still try whether this works in
> Xen, but in another patch. Apart from that I doubt the operation
> above would reliably get converted to BTS by the compiler
> (independent of version).

Ok - lets leave that for v2.

Both patches Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

>
>> (On a separate note, I feel that all of these operations should be
>> acting on unsigned rather than signed ints, but that applies to all of
>> these operations, not just the non-atomic ones)
> That makes zero difference for these ops - all that really matters
> is the width. In the C version above however I agree that using
> "unsigned int" would be more natural.
>
> Jan
>

  reply	other threads:[~2015-03-26 10:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-20 14:47 [PATCH v3 0/2] x86: bitops adjustments Jan Beulich
2015-03-20 14:53 ` [PATCH v3 1/2] x86: simplify non‑atomic bitops Jan Beulich
2015-03-25 17:49   ` Andrew Cooper
2015-03-26  8:00     ` Jan Beulich
2015-03-26  9:54       ` Andrew Cooper [this message]
2015-03-20 14:54 ` [PATCH v3 2/2] x86: make atomic bitops consistent with non‑atomic ones Jan Beulich

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=5513D75D.3080602@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.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.