All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>,
	xen-devel <xen-devel@lists.xenproject.org>
Cc: Keir Fraser <keir@xen.org>
Subject: Re: [PATCH v3 1/2] x86: simplify non‑atomic bitops
Date: Wed, 25 Mar 2015 17:49:39 +0000	[thread overview]
Message-ID: <5512F533.8010600@citrix.com> (raw)
In-Reply-To: <550C4279020000780006C16B@mail.emea.novell.com>

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.

~Andrew

(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)

  reply	other threads:[~2015-03-25 17:49 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 [this message]
2015-03-26  8:00     ` Jan Beulich
2015-03-26  9:54       ` Andrew Cooper
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=5512F533.8010600@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.