On Fri, May 13, 2016 at 07:19:15PM +0200, Borislav Petkov wrote: > The only thing that needs to be corrected then is the misleading comment > above the 32-bit version "... Save the C-clobbered registers (%eax, %edx > and %ecx) .." - the 64-bit version comment is correct AFAICT.
--- From: Borislav Petkov <b...@suse.de> Date: Mon, 16 May 2016 11:29:22 +0200 Subject: [PATCH] locking/rwsem: Fix comment on register clobbering Document explicitly that %edx can get clobbered on the slow path, on 32-bit. Something I learned the hard way. :-\ Signed-off-by: Borislav Petkov <b...@suse.de> Cc: Ingo Molnar <mi...@kernel.org> Cc: Linus Torvalds <torva...@linux-foundation.org> Cc: Peter Zijlstra <pet...@infradead.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 a37462a23546..bb49caa4dd4c 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 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 \ -- 2.7.3 SUSE Linux GmbH, GF: Felix Imendörffer, Jane Smithard, Graham Norton, HRB 21284 (AG Nürnberg) --