mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@libc.org>
To: musl@lists.openwall.com
Subject: Re: [PATCH 1/2] add 64bit atomics on top of 64bit ll/sc primitives
Date: Sun, 27 Mar 2016 18:27:45 -0400	[thread overview]
Message-ID: <20160327222745.GD21636@brightrain.aerifal.cx> (raw)
In-Reply-To: <1459113619-24090-2-git-send-email-koorogi@koorogi.info>

On Sun, Mar 27, 2016 at 04:20:18PM -0500, Bobby Bingham wrote:
> ---
>  src/internal/atomic.h | 28 ++++++++++++++++++++++++++++
>  1 file changed, 28 insertions(+)
> 
> diff --git a/src/internal/atomic.h b/src/internal/atomic.h
> index 6f37d25..43a8a00 100644
> --- a/src/internal/atomic.h
> +++ b/src/internal/atomic.h
> @@ -99,6 +99,34 @@ static inline void *a_cas_p(volatile void *p, void *t, void *s)
>  
>  #endif
>  
> +#ifdef a_ll_64
> +
> +#ifndef a_and_64
> +#define a_and_64 a_and_64
> +static inline void a_and_64(volatile uint64_t *p, uint64_t v)
> +{
> +	uint64_t old;
> +	a_pre_llsc();
> +	do old = a_ll_64(p);
> +	while (!a_sc_64(p, old & v));
> +	a_post_llsc();
> +}
> +#endif
> +
> +#ifndef a_or_64
> +#define a_or_64 a_or_64
> +static inline void a_or_64(volatile uint64_t *p, uint64_t v)
> +{
> +	uint64_t old;
> +	a_pre_llsc();
> +	do old = a_ll_64(p);
> +	while (!a_sc_64(p, old | v));
> +	a_post_llsc();
> +}
> +#endif

I think we can do without these. a_and_64 and a_or_64 are simply
misnamed (they're only usable as atomic bitset/bitclear, not
necessarily atomic on the whole 64-bit unit since they only operate on
one bit at a time) and I don't think there's any measurable gain to be
had by doing them with 64-bit hardware atomics. They'll probably be
dropped at some point in the future anyway; malloc is essentially the
only user.

Rich


  reply	other threads:[~2016-03-27 22:27 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-27 21:20 [RFC] powerpc64 port Bobby Bingham
2016-03-27 21:20 ` [PATCH 1/2] add 64bit atomics on top of 64bit ll/sc primitives Bobby Bingham
2016-03-27 22:27   ` Rich Felker [this message]
2016-03-27 21:20 ` [PATCH 2/2] add powerpc64 port Bobby Bingham
2016-03-27 23:37   ` Rich Felker
2016-03-28  0:32     ` Bobby Bingham
2016-03-28  2:18       ` Rich Felker
2016-03-28  3:27         ` Szabolcs Nagy
2016-04-02 17:02         ` Bobby Bingham
2016-04-03  2:09           ` Rich Felker
2016-04-03 17:10             ` Bobby Bingham
2016-04-03 17:26               ` Rich Felker
2016-04-03 17:50                 ` Bobby Bingham
2016-04-04  4:03         ` Bobby Bingham
2016-04-04 10:41           ` Szabolcs Nagy
2016-03-28 22:00     ` Patrick Oppenlander
2016-03-28 22:10       ` Rich Felker
2016-03-28 23:04         ` Patrick Oppenlander

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=20160327222745.GD21636@brightrain.aerifal.cx \
    --to=dalias@libc.org \
    --cc=musl@lists.openwall.com \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).