public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arun Sharma <asharma@fb.com>
To: Mike Frysinger <vapier.adi@gmail.com>
Cc: linux-kernel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Eric Dumazet <eric.dumazet@gmail.com>,
	Ingo Molnar <mingo@elte.hu>, David Miller <davem@davemloft.net>
Subject: Re: [PATCH] atomic: cleanup asm-generic atomic*.h inclusion
Date: Fri, 17 Jun 2011 10:49:53 -0700	[thread overview]
Message-ID: <4DFB93C1.9000901@fb.com> (raw)
In-Reply-To: <BANLkTindmEA7NsaRjuukh1-oRCtVWpeuCA@mail.gmail.com>

On 6/17/11 10:28 AM, Mike Frysinger wrote:
> On Fri, Jun 17, 2011 at 13:11, Arun Sharma wrote:
>> On 6/16/11 11:36 PM, Mike Frysinger wrote:
>>> i'm not sure this doesnt break things.  what tree exactly should i
>>> apply this patch to to verify things ?
>>
>> I tested 3.0-rc2 + patch 1 + patch 2 + this patch.
>
> not sure what those patches are, so i picked at random:
> Subject: [PATCH 2/3] atomic: move atomic_add_unless to generic code
> Date: Tue,  7 Jun 2011 17:07:18 -0700
> Message-Id:<1307491639-9864-2-git-send-email-asharma@fb.com>
>
> Subject: [PATCH 1/3] atomic: use<linux/atomic.h>
> Date:	Mon,  6 Jun 2011 10:27:29 -0700
> Message-Id:<1307381251-15729-1-git-send-email-asharma@fb.com>

Yes - these are the right patches.

>
> but even after just these two, things fail because
> include/asm-generic/atomic.h provides atomic_add_unless() already.
> i'm guessing your patch 2/3 should have fixed that somehow since it
> adds the func to linux/atomic.h.

Thanks for catching this. I missed it because I tested only on i386 and 
x86_64. Looks like only 4 archs are affected:

$ grep -r asm-generic.atomic.h *
blackfin/include/asm/atomic.h:# include <asm-generic/atomic.h>
microblaze/include/asm/atomic.h:#include <asm-generic/atomic.h>
mn10300/include/asm/atomic.h:#include <asm-generic/atomic.h>
score/include/asm/atomic.h:#include <asm-generic/atomic.h>

I believe the correct fix is:

--- a/include/asm-generic/atomic.h
+++ b/include/asm-generic/atomic.h
@@ -129,17 +129,6 @@ static inline void atomic_dec(atomic_t *v)

  #define cmpxchg64_local(ptr, o, n) __cmpxchg64_local_generic((ptr), 
(o), (n))

-static inline int atomic_add_unless(atomic_t *v, int a, int u)
-{
-  int c, old;
-  c = atomic_read(v);
-  while (c != u && (old = atomic_cmpxchg(v, c, c + a)) != c)
-    c = old;
-  return c != u;
-}
-
-#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
-
  static inline void atomic_clear_mask(unsigned long mask, unsigned long 
*addr)
  {
         unsigned long flags;

Could you help test this? I'll resend the patch series once I get 
confirmation.

  -Arun

  reply	other threads:[~2011-06-17 17:49 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-06 17:27 [PATCH 1/3] atomic: use <linux/atomic.h> Arun Sharma
2011-06-06 17:27 ` [PATCH 2/3] atomic: move atomic_add_unless to generic code Arun Sharma
2011-06-06 20:56   ` Eric Dumazet
2011-06-06 17:27 ` [PATCH 3/3] atomic: generalize atomic_add_unless_return Arun Sharma
2011-06-06 20:58   ` Eric Dumazet
2011-06-09 18:01     ` Eric Dumazet
2011-06-06 20:55 ` [PATCH 1/3] atomic: use <linux/atomic.h> Eric Dumazet
2011-06-06 21:06   ` Arun Sharma
2011-06-15 23:31 ` Andrew Morton
2011-06-16  0:57   ` Arun Sharma
2011-06-16  1:29   ` [PATCH] atomic: cleanup asm-generic atomic*.h inclusion Arun Sharma
2011-06-17  6:36     ` Mike Frysinger
2011-06-17 17:11       ` Arun Sharma
2011-06-17 17:28         ` Mike Frysinger
2011-06-17 17:49           ` Arun Sharma [this message]
2011-06-17 18:06             ` Mike Frysinger
2011-06-17 18:42               ` Arun Sharma
2011-06-17 19:07                 ` Mike Frysinger
2011-06-17 20:05                   ` Arun Sharma

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=4DFB93C1.9000901@fb.com \
    --to=asharma@fb.com \
    --cc=akpm@linux-foundation.org \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=vapier.adi@gmail.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox