From: Borislav Petkov <bp@suse•de>
To: x86-ml <x86@kernel•org>
Cc: Linus Torvalds <torvalds@linux-foundation•org>,
Guenter Roeck <linux@roeck-us•net>,
Ingo Molnar <mingo@kernel•org>,
Peter Zijlstra <peterz@infradead•org>,
"linux-next@vger•kernel.org" <linux-next@vger•kernel.org>,
"linux-kernel@vger•kernel.org" <linux-kernel@vger•kernel.org>
Subject: [PATCH] locking/rwsem: Fix comment on register clobbering
Date: Mon, 16 May 2016 11:34:28 +0200 [thread overview]
Message-ID: <20160516093428.GA26108@pd.tnic> (raw)
In-Reply-To: <20160513171915.GG17996@pd.tnic>
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 <bp@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 <bp@suse•de>
Cc: Ingo Molnar <mingo@kernel•org>
Cc: Linus Torvalds <torvalds@linux-foundation•org>
Cc: Peter Zijlstra <peterz@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)
--
prev parent reply other threads:[~2016-05-16 9:34 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-12 13:34 next: Crashes in x86 images due to 'locking/rwsem, x86: Clean up ____down_write()' Guenter Roeck
2016-05-12 13:51 ` Borislav Petkov
2016-05-12 14:46 ` Borislav Petkov
2016-05-12 17:29 ` [PATCH] x86/rwsem: Save and restore all callee-clobbered regs in 32-bit ____down_write() Borislav Petkov
2016-05-13 2:49 ` Guenter Roeck
2016-05-13 17:03 ` Linus Torvalds
2016-05-13 17:19 ` Borislav Petkov
2016-05-16 9:34 ` Borislav Petkov [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160516093428.GA26108@pd.tnic \
--to=bp@suse$(echo .)de \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=linux-next@vger$(echo .)kernel.org \
--cc=linux@roeck-us$(echo .)net \
--cc=mingo@kernel$(echo .)org \
--cc=peterz@infradead$(echo .)org \
--cc=torvalds@linux-foundation$(echo .)org \
--cc=x86@kernel$(echo .)org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox