* [PATCH 0/3] Fix atomic64_add_unless return value convention
@ 2010-03-01 17:14 Luca Barbieri
2010-03-01 17:14 ` [PATCH 1/3] lib: fix atomic64_add_unless test Luca Barbieri
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Luca Barbieri @ 2010-03-01 17:14 UTC (permalink / raw)
To: hpa; +Cc: mingo, a.p.zijlstra, paulus, linux-kernel, Luca Barbieri
Return values 0 and 1 were swapped both in the generic implementation and
my x86-32 one.
The x86-32 and atomic64_test.c patches should probably be squashed in the
appropriate commits in tip/x86/atomic
Luca Barbieri (3):
lib: fix atomic64_add_unless test
x86: fix atomic64_add_unless return value convention
lib: fix atomic64_add_unless return value convention
arch/x86/lib/atomic64_386_32.S | 4 ++--
arch/x86/lib/atomic64_cx8_32.S | 4 ++--
lib/atomic64.c | 4 ++--
lib/atomic64_test.c | 4 ++--
4 files changed, 8 insertions(+), 8 deletions(-)
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/3] lib: fix atomic64_add_unless test
2010-03-01 17:14 [PATCH 0/3] Fix atomic64_add_unless return value convention Luca Barbieri
@ 2010-03-01 17:14 ` Luca Barbieri
2010-03-01 17:14 ` [PATCH 2/3] x86: fix atomic64_add_unless return value convention Luca Barbieri
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Luca Barbieri @ 2010-03-01 17:14 UTC (permalink / raw)
To: hpa; +Cc: mingo, a.p.zijlstra, paulus, linux-kernel, Luca Barbieri
Was buggy as it replicated the bug in lib/atomic64.c
Reported-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Luca Barbieri <luca@luca-barbieri.com>
---
lib/atomic64_test.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/atomic64_test.c b/lib/atomic64_test.c
index 58efdab..ee8e6de 100644
--- a/lib/atomic64_test.c
+++ b/lib/atomic64_test.c
@@ -104,11 +104,11 @@ static __init int test_atomic64(void)
BUG_ON(v.counter != r);
INIT(v0);
- BUG_ON(!atomic64_add_unless(&v, one, v0));
+ BUG_ON(atomic64_add_unless(&v, one, v0));
BUG_ON(v.counter != r);
INIT(v0);
- BUG_ON(atomic64_add_unless(&v, one, v1));
+ BUG_ON(!atomic64_add_unless(&v, one, v1));
r += one;
BUG_ON(v.counter != r);
--
1.6.6.1.476.g01ddb
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/3] x86: fix atomic64_add_unless return value convention
2010-03-01 17:14 [PATCH 0/3] Fix atomic64_add_unless return value convention Luca Barbieri
2010-03-01 17:14 ` [PATCH 1/3] lib: fix atomic64_add_unless test Luca Barbieri
@ 2010-03-01 17:14 ` Luca Barbieri
2010-03-01 17:15 ` [PATCH 3/3] lib: " Luca Barbieri
2010-03-01 18:25 ` [PATCH 0/3] Fix " H. Peter Anvin
3 siblings, 0 replies; 7+ messages in thread
From: Luca Barbieri @ 2010-03-01 17:14 UTC (permalink / raw)
To: hpa; +Cc: mingo, a.p.zijlstra, paulus, linux-kernel, Luca Barbieri
Reported-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Luca Barbieri <luca@luca-barbieri.com>
---
arch/x86/lib/atomic64_386_32.S | 4 ++--
arch/x86/lib/atomic64_cx8_32.S | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/arch/x86/lib/atomic64_386_32.S b/arch/x86/lib/atomic64_386_32.S
index 5db07fe..a2f847c 100644
--- a/arch/x86/lib/atomic64_386_32.S
+++ b/arch/x86/lib/atomic64_386_32.S
@@ -133,13 +133,13 @@ BEGIN add_unless %ecx
1:
movl %eax, ($v)
movl %edx, 4($v)
- xorl %eax, %eax
+ movl $1, %eax
2:
RETURN
3:
cmpl %edx, %edi
jne 1b
- movl $1, %eax
+ xorl %eax, %eax
jmp 2b
END_
diff --git a/arch/x86/lib/atomic64_cx8_32.S b/arch/x86/lib/atomic64_cx8_32.S
index e49c4eb..d0e37b1 100644
--- a/arch/x86/lib/atomic64_cx8_32.S
+++ b/arch/x86/lib/atomic64_cx8_32.S
@@ -180,7 +180,7 @@ ENTRY(atomic64_add_unless_cx8)
cmpxchg8b (%ebp)
jne 1b
- xorl %eax, %eax
+ movl $1, %eax
3:
addl $8, %esp
CFI_ADJUST_CFA_OFFSET -8
@@ -190,7 +190,7 @@ ENTRY(atomic64_add_unless_cx8)
4:
cmpl %edx, 4(%esp)
jne 2b
- movl $1, %eax
+ xorl %eax, %eax
jmp 3b
CFI_ENDPROC
ENDPROC(atomic64_add_unless_cx8)
--
1.6.6.1.476.g01ddb
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/3] lib: fix atomic64_add_unless return value convention
2010-03-01 17:14 [PATCH 0/3] Fix atomic64_add_unless return value convention Luca Barbieri
2010-03-01 17:14 ` [PATCH 1/3] lib: fix atomic64_add_unless test Luca Barbieri
2010-03-01 17:14 ` [PATCH 2/3] x86: fix atomic64_add_unless return value convention Luca Barbieri
@ 2010-03-01 17:15 ` Luca Barbieri
2010-03-01 21:26 ` Paul Mackerras
2010-03-01 18:25 ` [PATCH 0/3] Fix " H. Peter Anvin
3 siblings, 1 reply; 7+ messages in thread
From: Luca Barbieri @ 2010-03-01 17:15 UTC (permalink / raw)
To: hpa; +Cc: mingo, a.p.zijlstra, paulus, linux-kernel, Luca Barbieri
The 0 and 1 return values were incorrectly swapped.
Reported-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Luca Barbieri <luca@luca-barbieri.com>
---
lib/atomic64.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/atomic64.c b/lib/atomic64.c
index 8bee16e..a21c12b 100644
--- a/lib/atomic64.c
+++ b/lib/atomic64.c
@@ -162,12 +162,12 @@ int atomic64_add_unless(atomic64_t *v, long long a, long long u)
{
unsigned long flags;
spinlock_t *lock = lock_addr(v);
- int ret = 1;
+ int ret = 0;
spin_lock_irqsave(lock, flags);
if (v->counter != u) {
v->counter += a;
- ret = 0;
+ ret = 1;
}
spin_unlock_irqrestore(lock, flags);
return ret;
--
1.6.6.1.476.g01ddb
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 0/3] Fix atomic64_add_unless return value convention
2010-03-01 17:14 [PATCH 0/3] Fix atomic64_add_unless return value convention Luca Barbieri
` (2 preceding siblings ...)
2010-03-01 17:15 ` [PATCH 3/3] lib: " Luca Barbieri
@ 2010-03-01 18:25 ` H. Peter Anvin
2010-03-01 18:57 ` Luca Barbieri
3 siblings, 1 reply; 7+ messages in thread
From: H. Peter Anvin @ 2010-03-01 18:25 UTC (permalink / raw)
To: Luca Barbieri; +Cc: mingo, a.p.zijlstra, paulus, linux-kernel
On 03/01/2010 09:14 AM, Luca Barbieri wrote:
> Return values 0 and 1 were swapped both in the generic implementation and
> my x86-32 one.
>
> The x86-32 and atomic64_test.c patches should probably be squashed in the
> appropriate commits in tip/x86/atomic
We tend to be very reluctant to do that.
Anyway, please resend your patches with actual patch descriptions
(commit messages).
-hpa
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 0/3] Fix atomic64_add_unless return value convention
2010-03-01 18:25 ` [PATCH 0/3] Fix " H. Peter Anvin
@ 2010-03-01 18:57 ` Luca Barbieri
0 siblings, 0 replies; 7+ messages in thread
From: Luca Barbieri @ 2010-03-01 18:57 UTC (permalink / raw)
To: H. Peter Anvin; +Cc: mingo, a.p.zijlstra, paulus, linux-kernel
>> The x86-32 and atomic64_test.c patches should probably be squashed in the
>> appropriate commits in tip/x86/atomic
>
> We tend to be very reluctant to do that.
OK: I suggested that to avoid introducing broken commits that could
cause annoyance in bisections.
> Anyway, please resend your patches with actual patch descriptions
> (commit messages).
Resent with more verbose descriptions.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 3/3] lib: fix atomic64_add_unless return value convention
2010-03-01 17:15 ` [PATCH 3/3] lib: " Luca Barbieri
@ 2010-03-01 21:26 ` Paul Mackerras
0 siblings, 0 replies; 7+ messages in thread
From: Paul Mackerras @ 2010-03-01 21:26 UTC (permalink / raw)
To: Luca Barbieri; +Cc: hpa, mingo, a.p.zijlstra, linux-kernel
On Mon, Mar 01, 2010 at 06:15:00PM +0100, Luca Barbieri wrote:
> The 0 and 1 return values were incorrectly swapped.
>
> Reported-by: H. Peter Anvin <hpa@zytor.com>
> Signed-off-by: Luca Barbieri <luca@luca-barbieri.com>
Acked-by: Paul Mackerras <paulus@samba.org>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2010-03-01 21:26 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-01 17:14 [PATCH 0/3] Fix atomic64_add_unless return value convention Luca Barbieri
2010-03-01 17:14 ` [PATCH 1/3] lib: fix atomic64_add_unless test Luca Barbieri
2010-03-01 17:14 ` [PATCH 2/3] x86: fix atomic64_add_unless return value convention Luca Barbieri
2010-03-01 17:15 ` [PATCH 3/3] lib: " Luca Barbieri
2010-03-01 21:26 ` Paul Mackerras
2010-03-01 18:25 ` [PATCH 0/3] Fix " H. Peter Anvin
2010-03-01 18:57 ` Luca Barbieri
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).