Skip to contentSkip to conversation

Fix the x86_64 implementation of call_rwsem_wait()

PATCH In review David Howells 1 participant 2 messages May 4, 2010 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix the x86_64 implementation of call_rwsem_wait()

The x86_64 call_rwsem_wait() treats the active state counter part of the R/W semaphore state as being 16-bit when it's actually 32-bit (it's half of the 64-bit state). It should do "decl %edx" not "decw %dx".

---

 arch/x86/lib/rwsem_64.S |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/lib/rwsem_64.S +1 -1
index 15acecf..41fcf00 100644
@@ -60,7 +60,7 @@ ENTRY(call_rwsem_down_write_failed)
 	ENDPROC(call_rwsem_down_write_failed)
 
 ENTRY(call_rwsem_wake)
-	decw %dx    /* do nothing if still outstanding active readers */
+	decl %edx	/* do nothing if still outstanding active readers */
 	jnz 1f
 	save_common_regs
 	movq %rax,%rdi
#1 lore raw

[tip:x86/urgent] x86-64: Use the proper register width in call_rwsem_wait()

Commit-ID:  50db45f2f010e9251dae644c5fb86b321d9ac815
Gitweb:     http://git.kernel.org/tip/50db45f2f010e9251dae644c5fb86b321d9ac815
Author:     David Howells <[email protected]>
AuthorDate: Tue, 4 May 2010 13:42:53 +0100
Committer:  H. Peter Anvin <[email protected]>
CommitDate: Tue, 4 May 2010 10:15:54 -0700

x86-64: Use the proper register width in call_rwsem_wait()

The x86_64 call_rwsem_wait() treats the active state counter part of the R/W semaphore state as being 16-bit when it's actually 32-bit (it's half of the 64-bit state). It should do "decl %edx" not "decw %dx".

[ hpa note: decl %edx will clear the upper half of %rdx, but the value of
%rdx is dead after this point so that is OK. ]

LKML-Reference: <[email protected]>

---
 arch/x86/lib/rwsem_64.S |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
arch/x86/lib/rwsem_64.S +1 -1
index 15acecf..41fcf00 100644
@@ -60,7 +60,7 @@ ENTRY(call_rwsem_down_write_failed)
 	ENDPROC(call_rwsem_down_write_failed)
 
 ENTRY(call_rwsem_wake)
-	decw %dx    /* do nothing if still outstanding active readers */
+	decl %edx	/* do nothing if still outstanding active readers */
 	jnz 1f
 	save_common_regs
 	movq %rax,%rdi