All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Cliff Wickman <cpw@sgi.com>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH 1/1] SGI UV: TLB shootdown using broadcast assist unit
Date: Wed, 04 Jun 2008 14:44:59 +0100	[thread overview]
Message-ID: <48469C5B.4070307@goop.org> (raw)
In-Reply-To: <E1K3fF0-00056O-HE@eag09.americas.sgi.com>

Cliff Wickman wrote:
> Signed-off-by: Cliff Wickman <cpw@sgi.com>
> ---
>  arch/x86/kernel/Makefile    |    2 
>  arch/x86/kernel/entry_64.S  |    4 
>  arch/x86/kernel/tlb_64.c    |    5 
>  arch/x86/kernel/tlb_uv.c    |  785 ++++++++++++++++++++++++++++++++++++++++++++
>  include/asm-x86/atomic_64.h |   30 +
>   

The atomic_64.h changes should be a separate patch.

> Index: 080602.ingo/include/asm-x86/atomic_64.h
> ===================================================================
> --- 080602.ingo.orig/include/asm-x86/atomic_64.h
> +++ 080602.ingo/include/asm-x86/atomic_64.h
> @@ -425,6 +425,36 @@ static inline int atomic64_add_unless(at
>  	return c != (u);
>  }
>  
> +/**
> + * atomic_inc_short - increment of a short integer
> + * @v: pointer to type int
> + *
> + * Atomically adds 1 to @v
> + * Returns the new value of @u
> + */
> +static inline short int atomic_inc_short(short int *v)
> +{
> +	asm volatile("movw $1, %%cx; lock; xaddw %%cx, %0\n"
> +		: "+m" (*v) : : "cx");
> +		/* clobbers counter register cx */
> +	return *v;
> +}
>   
Why?  Why not just:

	asm("lock add $1, %0" : "+m" (*v));

Does xaddw buy anything here?

> +
> +/**
> + * atomic_or_long - OR of two long integers
> + * @v1: pointer to type unsigned long
> + * @v2: pointer to type unsigned long
> + *
> + * Atomically ORs @v1 and @v2
> + * Returns the result of the OR
> + */
> +static inline void atomic_or_long(unsigned long *v1, unsigned long v2)
> +{
> +	asm volatile("movq %1, %%rax; lock; orq %%rax, %0\n"
> +		: "+m" (*v1) : "g" (v2): "rax");
> +		/* clobbers accumulator register ax */
>   

How about:

	asm("lock or %1, %0" : "+m" (*v1), "r" (v2));

No need to force %rax, is there?


    J

WARNING: multiple messages have this Message-ID (diff)
From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Cliff Wickman <cpw@sgi.com>
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH 1/1] SGI UV: TLB shootdown using broadcast assist unit
Date: Wed, 04 Jun 2008 14:44:59 +0100	[thread overview]
Message-ID: <48469C5B.4070307@goop.org> (raw)
In-Reply-To: <E1K3fF0-00056O-HE@eag09.americas.sgi.com>

Cliff Wickman wrote:
> Signed-off-by: Cliff Wickman <cpw@sgi.com>
> ---
>  arch/x86/kernel/Makefile    |    2 
>  arch/x86/kernel/entry_64.S  |    4 
>  arch/x86/kernel/tlb_64.c    |    5 
>  arch/x86/kernel/tlb_uv.c    |  785 ++++++++++++++++++++++++++++++++++++++++++++
>  include/asm-x86/atomic_64.h |   30 +
>   

The atomic_64.h changes should be a separate patch.

> Index: 080602.ingo/include/asm-x86/atomic_64.h
> ===================================================================
> --- 080602.ingo.orig/include/asm-x86/atomic_64.h
> +++ 080602.ingo/include/asm-x86/atomic_64.h
> @@ -425,6 +425,36 @@ static inline int atomic64_add_unless(at
>  	return c != (u);
>  }
>  
> +/**
> + * atomic_inc_short - increment of a short integer
> + * @v: pointer to type int
> + *
> + * Atomically adds 1 to @v
> + * Returns the new value of @u
> + */
> +static inline short int atomic_inc_short(short int *v)
> +{
> +	asm volatile("movw $1, %%cx; lock; xaddw %%cx, %0\n"
> +		: "+m" (*v) : : "cx");
> +		/* clobbers counter register cx */
> +	return *v;
> +}
>   
Why?  Why not just:

	asm("lock add $1, %0" : "+m" (*v));

Does xaddw buy anything here?

> +
> +/**
> + * atomic_or_long - OR of two long integers
> + * @v1: pointer to type unsigned long
> + * @v2: pointer to type unsigned long
> + *
> + * Atomically ORs @v1 and @v2
> + * Returns the result of the OR
> + */
> +static inline void atomic_or_long(unsigned long *v1, unsigned long v2)
> +{
> +	asm volatile("movq %1, %%rax; lock; orq %%rax, %0\n"
> +		: "+m" (*v1) : "g" (v2): "rax");
> +		/* clobbers accumulator register ax */
>   

How about:

	asm("lock or %1, %0" : "+m" (*v1), "r" (v2));

No need to force %rax, is there?


    J

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2008-06-04 13:45 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-03 22:44 [PATCH 1/1] SGI UV: TLB shootdown using broadcast assist unit Cliff Wickman
2008-06-03 22:44 ` Cliff Wickman
2008-06-04 13:44 ` Jeremy Fitzhardinge [this message]
2008-06-04 13:44   ` Jeremy Fitzhardinge
  -- strict thread matches above, loose matches on Subject: below --
2008-06-04 20:33 Cliff Wickman
2008-06-04 20:33 ` Cliff Wickman
2008-06-09 15:58 ` Ingo Molnar
2008-06-02 13:56 Cliff Wickman
2008-06-02 13:56 ` Cliff Wickman
2008-06-02 15:01 ` Ingo Molnar
2008-06-02 15:01   ` Ingo Molnar
2008-06-02 15:04   ` Ingo Molnar
2008-06-02 15:04     ` Ingo Molnar
2008-06-03 22:44   ` Cliff Wickman
2008-06-03 22:44     ` Cliff Wickman

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=48469C5B.4070307@goop.org \
    --to=jeremy@goop.org \
    --cc=cpw@sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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.