All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ian Campbell <ian.campbell@citrix.com>
To: David Vrabel <david.vrabel@citrix.com>
Cc: xen-devel@lists.xenproject.org, Keir Fraser <keir@xen.org>,
	Tim Deegan <tim@xen.org>, Jan Beulich <jbeulich@suse.com>,
	Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: Re: [PATCHv2 3/6] xen: generic xadd() for ticket locks
Date: Tue, 14 Apr 2015 14:17:08 +0100	[thread overview]
Message-ID: <1429017428.15516.49.camel@citrix.com> (raw)
In-Reply-To: <1428675597-28465-4-git-send-email-david.vrabel@citrix.com>

On Fri, 2015-04-10 at 15:19 +0100, David Vrabel wrote:
> This is only temporary until arm/arm64 provides an xadd()
> implementation.

I'll assume that you aren't planning on doing this and add it to my own
TODO list. Although, I'm more than willing to be preempted by another
ARM dev...

> 
> Signed-off-by: David Vrabel <david.vrabel@citrix.com>
> ---
>  xen/common/spinlock.c |   21 +++++++++++++++++++++
>  1 file changed, 21 insertions(+)
> 
> diff --git a/xen/common/spinlock.c b/xen/common/spinlock.c
> index 5fd8b1c..0c4289c 100644
> --- a/xen/common/spinlock.c
> +++ b/xen/common/spinlock.c
> @@ -10,6 +10,27 @@
>  #include <asm/processor.h>
>  #include <asm/atomic.h>
>  
> +#ifndef xadd
> +
> +static u32 generic_xaddl(volatile u32 *ptr, u32 v)
> +{
> +    u32 old, new, prev;
> +
> +    old = read_atomic(ptr);
> +    for(;;) {
> +        new = old + v;
> +        prev = cmpxchg(ptr, old, new);
> +        if (prev == old)
> +            break;
> +        old = prev;
> +    }
> +    return old;
> +}
> +
> +#define xadd(ptr, v) generic_xaddl((ptr), (v))
> +
> +#endif
> +
>  #ifndef NDEBUG
>  
>  static atomic_t spin_debug __read_mostly = ATOMIC_INIT(0);

  reply	other threads:[~2015-04-14 13:17 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-10 14:19 [PATCHv2 0/6] Use ticket locks for spinlocks David Vrabel
2015-04-10 14:19 ` [PATCHv2 1/6] x86/hvm: don't include asm/spinlock.h David Vrabel
2015-04-10 15:24   ` Andrew Cooper
2015-04-13 13:13     ` David Vrabel
2015-04-13 13:15       ` Andrew Cooper
2015-04-16 11:09   ` Tim Deegan
2015-04-10 14:19 ` [PATCHv2 2/6] x86/mtrr: include asm/atomic.h David Vrabel
2015-04-10 15:25   ` Andrew Cooper
2015-04-16 11:10   ` Tim Deegan
2015-04-10 14:19 ` [PATCHv2 3/6] xen: generic xadd() for ticket locks David Vrabel
2015-04-14 13:17   ` Ian Campbell [this message]
2015-04-14 16:37     ` David Vrabel
2015-04-15  8:34       ` Ian Campbell
2015-04-16 11:13   ` Tim Deegan
2015-04-16 15:28   ` Jan Beulich
2015-04-17 12:32     ` Ian Campbell
2015-04-17 12:33       ` Ian Campbell
2015-04-17 12:34       ` David Vrabel
2015-04-17 13:09         ` Ian Campbell
2015-04-17 13:13           ` David Vrabel
2015-04-10 14:19 ` [PATCHv2 4/6] x86: provide xadd() David Vrabel
2015-04-16 11:25   ` Tim Deegan
2015-04-16 11:38     ` David Vrabel
2015-04-16 11:41       ` Tim Deegan
2015-04-16 11:49     ` Jan Beulich
2015-04-16 12:49       ` Tim Deegan
2015-04-16 12:55         ` Ian Campbell
2015-04-16 13:19           ` Jan Beulich
2015-04-16 14:07             ` Ian Campbell
2015-04-16 14:09               ` Ian Campbell
2015-04-16 12:00     ` Ian Campbell
2015-04-10 14:19 ` [PATCHv2 5/6] xen: use ticket locks for spin locks David Vrabel
2015-04-10 15:29   ` Andrew Cooper
2015-04-10 16:44   ` Boris Ostrovsky
2015-04-10 17:29     ` David Vrabel
2015-04-10 17:58       ` Boris Ostrovsky
2015-04-16 12:03   ` Tim Deegan
2015-04-16 12:46     ` David Vrabel
2015-04-16 12:50       ` Tim Deegan
2015-04-16 13:32     ` Jan Beulich
2015-04-21  9:59     ` David Vrabel
2015-04-10 14:19 ` [PATCHv2 6/6] x86, arm: remove asm/spinlock.h from all architectures David Vrabel
2015-04-16 12:51   ` Tim Deegan
2015-04-16 15:29   ` 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=1429017428.15516.49.camel@citrix.com \
    --to=ian.campbell@citrix.com \
    --cc=david.vrabel@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=keir@xen.org \
    --cc=stefano.stabellini@eu.citrix.com \
    --cc=tim@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.