Commit-ID:  4544ba8c6b1743499cabb682897a469911845f15
Gitweb:     http://git.kernel.org/tip/4544ba8c6b1743499cabb682897a469911845f15
Author:     Borislav Petkov <b...@suse.de>
AuthorDate: Mon, 16 May 2016 11:34:28 +0200
Committer:  Ingo Molnar <mi...@kernel.org>
CommitDate: Mon, 16 May 2016 12:35:40 +0200

locking/rwsem: Fix comment on register clobbering

Document explicitly that %edx can get clobbered on the slow path, on
32-bit kernels. Something I learned the hard way. :-\

Suggested-by: Linus Torvalds <torva...@linux-foundation.org>
Signed-off-by: Borislav Petkov <b...@suse.de>
Cc: Alexander Shishkin <alexander.shish...@linux.intel.com>
Cc: Andy Lutomirski <l...@amacapital.net>
Cc: Arnaldo Carvalho de Melo <a...@redhat.com>
Cc: Borislav Petkov <b...@alien8.de>
Cc: Brian Gerst <brge...@gmail.com>
Cc: Denys Vlasenko <dvlas...@redhat.com>
Cc: Guenter Roeck <li...@roeck-us.net>
Cc: H. Peter Anvin <h...@zytor.com>
Cc: Jiri Olsa <jo...@redhat.com>
Cc: Peter Zijlstra <pet...@infradead.org>
Cc: Stephane Eranian <eran...@google.com>
Cc: Thomas Gleixner <t...@linutronix.de>
Cc: Vince Weaver <vincent.wea...@maine.edu>
Cc: linux-n...@vger.kernel.org
Link: http://lkml.kernel.org/r/20160516093428.ga26...@pd.tnic
Signed-off-by: Ingo Molnar <mi...@kernel.org>
---
 arch/x86/lib/rwsem.S | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/x86/lib/rwsem.S b/arch/x86/lib/rwsem.S
index a37462a..bf2c607 100644
--- a/arch/x86/lib/rwsem.S
+++ b/arch/x86/lib/rwsem.S
@@ -29,8 +29,10 @@
  * there is contention on the semaphore.
  *
  * %eax contains the semaphore pointer on entry. Save the C-clobbered
- * registers (%eax, %edx and %ecx) except %eax whish is either a return
- * value or just clobbered..
+ * registers (%eax, %edx and %ecx) except %eax which is either a return
+ * value or just gets clobbered. Same is true for %edx so make sure GCC
+ * reloads it after the slow path, by making it hold a temporary, for
+ * example see ____down_write().
  */
 
 #define save_common_regs \

Reply via email to