linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] Fix atomic64 return value conventions (v2)
@ 2010-03-01 18:55 Luca Barbieri
  2010-03-01 18:55 ` [PATCH 1/5] lib: fix atomic64_add_unless test Luca Barbieri
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: Luca Barbieri @ 2010-03-01 18:55 UTC (permalink / raw)
  To: hpa; +Cc: mingo, a.p.zijlstra, paulus, linux-kernel, Luca Barbieri

Changes in v2:
- Resent patches with more verbose descriptions

This patchset fixes the return value conventions in the atomic64 test,
generic implementation and the x86-32 implementation in x86/tip/atomic.

Luca Barbieri (5):
  lib: fix atomic64_add_unless test
  x86-32: fix atomic64_add_unless return value convention
  lib: fix atomic64_add_unless return value convention
  lib: fix atomic64_inc_not_zero test
  x86-32: fix atomic64_inc_not_zero return value convention

 arch/x86/lib/atomic64_386_32.S |    7 +++----
 arch/x86/lib/atomic64_cx8_32.S |    7 +++----
 lib/atomic64.c                 |    4 ++--
 lib/atomic64_test.c            |   10 +++++-----
 4 files changed, 13 insertions(+), 15 deletions(-)


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/5] lib: fix atomic64_add_unless test
  2010-03-01 18:55 [PATCH 0/5] Fix atomic64 return value conventions (v2) Luca Barbieri
@ 2010-03-01 18:55 ` Luca Barbieri
  2010-03-01 19:58   ` [tip:x86/atomic] lib: Fix " tip-bot for Luca Barbieri
  2010-03-01 18:55 ` [PATCH 2/5] x86-32: fix atomic64_add_unless return value convention Luca Barbieri
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 11+ messages in thread
From: Luca Barbieri @ 2010-03-01 18:55 UTC (permalink / raw)
  To: hpa; +Cc: mingo, a.p.zijlstra, paulus, linux-kernel, Luca Barbieri

atomic64_add_unless must return 1 if it perfomed the add and 0 otherwise.
The test assumed the opposite convention.

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] 11+ messages in thread

* [PATCH 2/5] x86-32: fix atomic64_add_unless return value convention
  2010-03-01 18:55 [PATCH 0/5] Fix atomic64 return value conventions (v2) Luca Barbieri
  2010-03-01 18:55 ` [PATCH 1/5] lib: fix atomic64_add_unless test Luca Barbieri
@ 2010-03-01 18:55 ` Luca Barbieri
  2010-03-01 19:58   ` [tip:x86/atomic] x86-32: Fix " tip-bot for Luca Barbieri
  2010-03-01 18:55 ` [PATCH 3/5] lib: fix " Luca Barbieri
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 11+ messages in thread
From: Luca Barbieri @ 2010-03-01 18:55 UTC (permalink / raw)
  To: hpa; +Cc: mingo, a.p.zijlstra, paulus, linux-kernel, Luca Barbieri

atomic64_add_unless must return 1 if it perfomed the add and 0 otherwise.
The implementation did the opposite thing.

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] 11+ messages in thread

* [PATCH 3/5] lib: fix atomic64_add_unless return value convention
  2010-03-01 18:55 [PATCH 0/5] Fix atomic64 return value conventions (v2) Luca Barbieri
  2010-03-01 18:55 ` [PATCH 1/5] lib: fix atomic64_add_unless test Luca Barbieri
  2010-03-01 18:55 ` [PATCH 2/5] x86-32: fix atomic64_add_unless return value convention Luca Barbieri
@ 2010-03-01 18:55 ` Luca Barbieri
  2010-03-01 19:58   ` [tip:x86/atomic] lib: Fix " tip-bot for Luca Barbieri
  2010-03-01 18:55 ` [PATCH 4/5] lib: fix atomic64_inc_not_zero test Luca Barbieri
  2010-03-01 18:55 ` [PATCH 5/5] x86-32: fix atomic64_inc_not_zero return value convention Luca Barbieri
  4 siblings, 1 reply; 11+ messages in thread
From: Luca Barbieri @ 2010-03-01 18:55 UTC (permalink / raw)
  To: hpa; +Cc: mingo, a.p.zijlstra, paulus, linux-kernel, Luca Barbieri

atomic64_add_unless must return 1 if it perfomed the add and 0 otherwise.
The generic implementation did the opposite thing.

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] 11+ messages in thread

* [PATCH 4/5] lib: fix atomic64_inc_not_zero test
  2010-03-01 18:55 [PATCH 0/5] Fix atomic64 return value conventions (v2) Luca Barbieri
                   ` (2 preceding siblings ...)
  2010-03-01 18:55 ` [PATCH 3/5] lib: fix " Luca Barbieri
@ 2010-03-01 18:55 ` Luca Barbieri
  2010-03-01 19:58   ` [tip:x86/atomic] lib: Fix " tip-bot for Luca Barbieri
  2010-03-01 18:55 ` [PATCH 5/5] x86-32: fix atomic64_inc_not_zero return value convention Luca Barbieri
  4 siblings, 1 reply; 11+ messages in thread
From: Luca Barbieri @ 2010-03-01 18:55 UTC (permalink / raw)
  To: hpa; +Cc: mingo, a.p.zijlstra, paulus, linux-kernel, Luca Barbieri

atomic64_inc_not_zero must return 1 if it perfomed the add and 0 otherwise.
The test assumed the opposite convention.

Signed-off-by: Luca Barbieri <luca@luca-barbieri.com>
---
 lib/atomic64_test.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/atomic64_test.c b/lib/atomic64_test.c
index ee8e6de..f7bb706 100644
--- a/lib/atomic64_test.c
+++ b/lib/atomic64_test.c
@@ -130,16 +130,16 @@ static __init int test_atomic64(void)
 #endif
 
 	INIT(onestwos);
-	BUG_ON(atomic64_inc_not_zero(&v));
+	BUG_ON(!atomic64_inc_not_zero(&v));
 	r += one;
 	BUG_ON(v.counter != r);
 
 	INIT(0);
-	BUG_ON(!atomic64_inc_not_zero(&v));
+	BUG_ON(atomic64_inc_not_zero(&v));
 	BUG_ON(v.counter != r);
 
 	INIT(-one);
-	BUG_ON(atomic64_inc_not_zero(&v));
+	BUG_ON(!atomic64_inc_not_zero(&v));
 	r += one;
 	BUG_ON(v.counter != r);
 
-- 
1.6.6.1.476.g01ddb


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 5/5] x86-32: fix atomic64_inc_not_zero return value convention
  2010-03-01 18:55 [PATCH 0/5] Fix atomic64 return value conventions (v2) Luca Barbieri
                   ` (3 preceding siblings ...)
  2010-03-01 18:55 ` [PATCH 4/5] lib: fix atomic64_inc_not_zero test Luca Barbieri
@ 2010-03-01 18:55 ` Luca Barbieri
  2010-03-01 19:59   ` [tip:x86/atomic] x86-32: Fix " tip-bot for Luca Barbieri
  4 siblings, 1 reply; 11+ messages in thread
From: Luca Barbieri @ 2010-03-01 18:55 UTC (permalink / raw)
  To: hpa; +Cc: mingo, a.p.zijlstra, paulus, linux-kernel, Luca Barbieri

atomic64_inc_not_zero must return 1 if it perfomed the add and 0 otherwise.
It was doing the opposite thing.

Signed-off-by: Luca Barbieri <luca@luca-barbieri.com>
---
 arch/x86/lib/atomic64_386_32.S |    3 +--
 arch/x86/lib/atomic64_cx8_32.S |    3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/x86/lib/atomic64_386_32.S b/arch/x86/lib/atomic64_386_32.S
index a2f847c..4a5979a 100644
--- a/arch/x86/lib/atomic64_386_32.S
+++ b/arch/x86/lib/atomic64_386_32.S
@@ -153,13 +153,12 @@ BEGIN inc_not_zero %esi
 	adcl $0, %edx
 	movl %eax,  ($v)
 	movl %edx, 4($v)
-	xorl %eax, %eax
+	movl $1, %eax
 2:
 RETURN
 3:
 	testl %edx, %edx
 	jne 1b
-	movl $1, %eax
 	jmp 2b
 END_
 
diff --git a/arch/x86/lib/atomic64_cx8_32.S b/arch/x86/lib/atomic64_cx8_32.S
index d0e37b1..71e080d 100644
--- a/arch/x86/lib/atomic64_cx8_32.S
+++ b/arch/x86/lib/atomic64_cx8_32.S
@@ -212,14 +212,13 @@ ENTRY(atomic64_inc_not_zero_cx8)
 	cmpxchg8b (%esi)
 	jne 1b
 
-	xorl %eax, %eax
+	movl $1, %eax
 3:
 	RESTORE ebx
 	ret
 4:
 	testl %edx, %edx
 	jne 2b
-	movl $1, %eax
 	jmp 3b
 	CFI_ENDPROC
 ENDPROC(atomic64_inc_not_zero_cx8)
-- 
1.6.6.1.476.g01ddb


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [tip:x86/atomic] lib: Fix atomic64_add_unless test
  2010-03-01 18:55 ` [PATCH 1/5] lib: fix atomic64_add_unless test Luca Barbieri
@ 2010-03-01 19:58   ` tip-bot for Luca Barbieri
  0 siblings, 0 replies; 11+ messages in thread
From: tip-bot for Luca Barbieri @ 2010-03-01 19:58 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, luca, tglx

Commit-ID:  9efbcd590243045111670c171a951923b877b57d
Gitweb:     http://git.kernel.org/tip/9efbcd590243045111670c171a951923b877b57d
Author:     Luca Barbieri <luca@luca-barbieri.com>
AuthorDate: Mon, 1 Mar 2010 19:55:45 +0100
Committer:  H. Peter Anvin <hpa@zytor.com>
CommitDate: Mon, 1 Mar 2010 11:38:46 -0800

lib: Fix atomic64_add_unless test

atomic64_add_unless must return 1 if it perfomed the add and 0 otherwise.
The test assumed the opposite convention.

Reported-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Luca Barbieri <luca@luca-barbieri.com>
LKML-Reference: <1267469749-11878-2-git-send-email-luca@luca-barbieri.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.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);
 

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [tip:x86/atomic] x86-32: Fix atomic64_add_unless return value convention
  2010-03-01 18:55 ` [PATCH 2/5] x86-32: fix atomic64_add_unless return value convention Luca Barbieri
@ 2010-03-01 19:58   ` tip-bot for Luca Barbieri
  0 siblings, 0 replies; 11+ messages in thread
From: tip-bot for Luca Barbieri @ 2010-03-01 19:58 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, luca, tglx

Commit-ID:  6e6104fe085026e6ef82cc5cc303d6c8ceb7e411
Gitweb:     http://git.kernel.org/tip/6e6104fe085026e6ef82cc5cc303d6c8ceb7e411
Author:     Luca Barbieri <luca@luca-barbieri.com>
AuthorDate: Mon, 1 Mar 2010 19:55:46 +0100
Committer:  H. Peter Anvin <hpa@zytor.com>
CommitDate: Mon, 1 Mar 2010 11:38:46 -0800

x86-32: Fix atomic64_add_unless return value convention

atomic64_add_unless must return 1 if it perfomed the add and 0 otherwise.
The implementation did the opposite thing.

Reported-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Luca Barbieri <luca@luca-barbieri.com>
LKML-Reference: <1267469749-11878-3-git-send-email-luca@luca-barbieri.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.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)

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [tip:x86/atomic] lib: Fix atomic64_add_unless return value convention
  2010-03-01 18:55 ` [PATCH 3/5] lib: fix " Luca Barbieri
@ 2010-03-01 19:58   ` tip-bot for Luca Barbieri
  0 siblings, 0 replies; 11+ messages in thread
From: tip-bot for Luca Barbieri @ 2010-03-01 19:58 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, paulus, hpa, mingo, luca, tglx

Commit-ID:  97577896f6b9c056fa0a5e9f6a608110cb3dcd33
Gitweb:     http://git.kernel.org/tip/97577896f6b9c056fa0a5e9f6a608110cb3dcd33
Author:     Luca Barbieri <luca@luca-barbieri.com>
AuthorDate: Mon, 1 Mar 2010 19:55:47 +0100
Committer:  H. Peter Anvin <hpa@zytor.com>
CommitDate: Mon, 1 Mar 2010 11:38:46 -0800

lib: Fix atomic64_add_unless return value convention

atomic64_add_unless must return 1 if it perfomed the add and 0 otherwise.
The generic implementation did the opposite thing.

Reported-by: H. Peter Anvin <hpa@zytor.com>
Confirmed-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Luca Barbieri <luca@luca-barbieri.com>
LKML-Reference: <1267469749-11878-4-git-send-email-luca@luca-barbieri.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.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;

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [tip:x86/atomic] lib: Fix atomic64_inc_not_zero test
  2010-03-01 18:55 ` [PATCH 4/5] lib: fix atomic64_inc_not_zero test Luca Barbieri
@ 2010-03-01 19:58   ` tip-bot for Luca Barbieri
  0 siblings, 0 replies; 11+ messages in thread
From: tip-bot for Luca Barbieri @ 2010-03-01 19:58 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, luca, tglx

Commit-ID:  25a304f277ad70166eeae25a4958d2049005c33a
Gitweb:     http://git.kernel.org/tip/25a304f277ad70166eeae25a4958d2049005c33a
Author:     Luca Barbieri <luca@luca-barbieri.com>
AuthorDate: Mon, 1 Mar 2010 19:55:48 +0100
Committer:  H. Peter Anvin <hpa@zytor.com>
CommitDate: Mon, 1 Mar 2010 11:39:02 -0800

lib: Fix atomic64_inc_not_zero test

atomic64_inc_not_zero must return 1 if it perfomed the add and 0 otherwise.
The test assumed the opposite convention.

Signed-off-by: Luca Barbieri <luca@luca-barbieri.com>
LKML-Reference: <1267469749-11878-5-git-send-email-luca@luca-barbieri.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 lib/atomic64_test.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/atomic64_test.c b/lib/atomic64_test.c
index ee8e6de..f7bb706 100644
--- a/lib/atomic64_test.c
+++ b/lib/atomic64_test.c
@@ -130,16 +130,16 @@ static __init int test_atomic64(void)
 #endif
 
 	INIT(onestwos);
-	BUG_ON(atomic64_inc_not_zero(&v));
+	BUG_ON(!atomic64_inc_not_zero(&v));
 	r += one;
 	BUG_ON(v.counter != r);
 
 	INIT(0);
-	BUG_ON(!atomic64_inc_not_zero(&v));
+	BUG_ON(atomic64_inc_not_zero(&v));
 	BUG_ON(v.counter != r);
 
 	INIT(-one);
-	BUG_ON(atomic64_inc_not_zero(&v));
+	BUG_ON(!atomic64_inc_not_zero(&v));
 	r += one;
 	BUG_ON(v.counter != r);
 

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [tip:x86/atomic] x86-32: Fix atomic64_inc_not_zero return value convention
  2010-03-01 18:55 ` [PATCH 5/5] x86-32: fix atomic64_inc_not_zero return value convention Luca Barbieri
@ 2010-03-01 19:59   ` tip-bot for Luca Barbieri
  0 siblings, 0 replies; 11+ messages in thread
From: tip-bot for Luca Barbieri @ 2010-03-01 19:59 UTC (permalink / raw)
  To: linux-tip-commits; +Cc: linux-kernel, hpa, mingo, luca, tglx

Commit-ID:  f3e83131469e29032a700217aa394996107b8fc5
Gitweb:     http://git.kernel.org/tip/f3e83131469e29032a700217aa394996107b8fc5
Author:     Luca Barbieri <luca@luca-barbieri.com>
AuthorDate: Mon, 1 Mar 2010 19:55:49 +0100
Committer:  H. Peter Anvin <hpa@zytor.com>
CommitDate: Mon, 1 Mar 2010 11:39:03 -0800

x86-32: Fix atomic64_inc_not_zero return value convention

atomic64_inc_not_zero must return 1 if it perfomed the add and 0 otherwise.
It was doing the opposite thing.

Signed-off-by: Luca Barbieri <luca@luca-barbieri.com>
LKML-Reference: <1267469749-11878-6-git-send-email-luca@luca-barbieri.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
---
 arch/x86/lib/atomic64_386_32.S |    3 +--
 arch/x86/lib/atomic64_cx8_32.S |    3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/x86/lib/atomic64_386_32.S b/arch/x86/lib/atomic64_386_32.S
index a2f847c..4a5979a 100644
--- a/arch/x86/lib/atomic64_386_32.S
+++ b/arch/x86/lib/atomic64_386_32.S
@@ -153,13 +153,12 @@ BEGIN inc_not_zero %esi
 	adcl $0, %edx
 	movl %eax,  ($v)
 	movl %edx, 4($v)
-	xorl %eax, %eax
+	movl $1, %eax
 2:
 RETURN
 3:
 	testl %edx, %edx
 	jne 1b
-	movl $1, %eax
 	jmp 2b
 END_
 
diff --git a/arch/x86/lib/atomic64_cx8_32.S b/arch/x86/lib/atomic64_cx8_32.S
index d0e37b1..71e080d 100644
--- a/arch/x86/lib/atomic64_cx8_32.S
+++ b/arch/x86/lib/atomic64_cx8_32.S
@@ -212,14 +212,13 @@ ENTRY(atomic64_inc_not_zero_cx8)
 	cmpxchg8b (%esi)
 	jne 1b
 
-	xorl %eax, %eax
+	movl $1, %eax
 3:
 	RESTORE ebx
 	ret
 4:
 	testl %edx, %edx
 	jne 2b
-	movl $1, %eax
 	jmp 3b
 	CFI_ENDPROC
 ENDPROC(atomic64_inc_not_zero_cx8)

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2010-03-01 19:59 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-01 18:55 [PATCH 0/5] Fix atomic64 return value conventions (v2) Luca Barbieri
2010-03-01 18:55 ` [PATCH 1/5] lib: fix atomic64_add_unless test Luca Barbieri
2010-03-01 19:58   ` [tip:x86/atomic] lib: Fix " tip-bot for Luca Barbieri
2010-03-01 18:55 ` [PATCH 2/5] x86-32: fix atomic64_add_unless return value convention Luca Barbieri
2010-03-01 19:58   ` [tip:x86/atomic] x86-32: Fix " tip-bot for Luca Barbieri
2010-03-01 18:55 ` [PATCH 3/5] lib: fix " Luca Barbieri
2010-03-01 19:58   ` [tip:x86/atomic] lib: Fix " tip-bot for Luca Barbieri
2010-03-01 18:55 ` [PATCH 4/5] lib: fix atomic64_inc_not_zero test Luca Barbieri
2010-03-01 19:58   ` [tip:x86/atomic] lib: Fix " tip-bot for Luca Barbieri
2010-03-01 18:55 ` [PATCH 5/5] x86-32: fix atomic64_inc_not_zero return value convention Luca Barbieri
2010-03-01 19:59   ` [tip:x86/atomic] x86-32: Fix " tip-bot for 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).