From: Mark Rutland <mark.rutland@arm.com>
To: linux-kernel@vger.kernel.org, will.deacon@arm.com,
peterz@infradead.org, boqun.feng@gmail.com
Cc: Mark Rutland <mark.rutland@arm.com>,
Dmitry Vyukov <dvyukov@google.com>,
"H . Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@redhat.com>,
Thomas Gleixner <tglx@linutronix.de>
Subject: [PATCHv2 02/11] atomics/x86: reduce arch_cmpxchg64*() instrumentation
Date: Mon, 25 Jun 2018 11:59:43 +0100 [thread overview]
Message-ID: <20180625105952.3756-3-mark.rutland@arm.com> (raw)
In-Reply-To: <20180625105952.3756-1-mark.rutland@arm.com>
Currently x86's arch_cmpxchg64() and arch_cmpxchg64_local() are
instrumented twice, as they call into instrumented atomics rather than
their arch_ equivalents.
A call to cmpxchg64() results in:
cmpxchg64()
kasan_check_write()
arch_cmpxchg64()
cmpxchg()
kasan_check_write()
arch_cmpxchg()
Let's fix this up and call the arch_ equivalents, resulting in:
cmpxchg64()
kasan_check_write()
arch_cmpxchg64()
arch_cmpxchg()
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Cc: Boqun Feng <boqun.feng@gmail.com>
Cc: Dmitry Vyukov <dvyukov@google.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Will Deacon <will.deacon@arm.com>
---
arch/x86/include/asm/cmpxchg_64.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/x86/include/asm/cmpxchg_64.h b/arch/x86/include/asm/cmpxchg_64.h
index bfca3b346c74..072e5459fe2f 100644
--- a/arch/x86/include/asm/cmpxchg_64.h
+++ b/arch/x86/include/asm/cmpxchg_64.h
@@ -10,13 +10,13 @@ static inline void set_64bit(volatile u64 *ptr, u64 val)
#define arch_cmpxchg64(ptr, o, n) \
({ \
BUILD_BUG_ON(sizeof(*(ptr)) != 8); \
- cmpxchg((ptr), (o), (n)); \
+ arch_cmpxchg((ptr), (o), (n)); \
})
#define arch_cmpxchg64_local(ptr, o, n) \
({ \
BUILD_BUG_ON(sizeof(*(ptr)) != 8); \
- cmpxchg_local((ptr), (o), (n)); \
+ arch_cmpxchg_local((ptr), (o), (n)); \
})
#define system_has_cmpxchg_double() boot_cpu_has(X86_FEATURE_CX16)
--
2.11.0
next prev parent reply other threads:[~2018-06-25 11:02 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-25 10:59 [PATCHv2 00/11] atomics: generate atomic headers / instrument arm64 Mark Rutland
2018-06-25 10:59 ` [PATCHv2 01/11] atomic/tty: Fix up atomic abuse in ldsem Mark Rutland
2018-06-26 18:53 ` Andy Shevchenko
2018-06-26 19:30 ` Peter Zijlstra
2018-06-27 17:33 ` Andy Shevchenko
2018-06-25 10:59 ` Mark Rutland [this message]
2018-06-25 10:59 ` [PATCHv2 03/11] atomics: simplify cmpxchg() instrumentation Mark Rutland
2018-06-25 11:38 ` Andrea Parri
2018-06-25 11:47 ` Dmitry Vyukov
2018-06-25 11:48 ` Mark Rutland
2018-06-25 10:59 ` [PATCHv2 04/11] atomics/treewide: instrument xchg() Mark Rutland
2018-06-25 10:59 ` [PATCHv2 05/11] atomics: instrument cmpxchg_double*() Mark Rutland
2018-06-25 10:59 ` [PATCHv2 06/11] atomics/treewide: rework ordering barriers Mark Rutland
2018-06-25 15:44 ` Mark Rutland
2018-07-04 15:06 ` Will Deacon
2018-07-04 15:56 ` Mark Rutland
2018-07-04 17:50 ` Will Deacon
2018-07-05 10:12 ` Mark Rutland
2018-07-05 16:25 ` Will Deacon
2018-06-25 10:59 ` [PATCHv2 07/11] atomics: add common header generation files Mark Rutland
2018-06-28 10:58 ` Mark Rutland
2018-06-28 11:46 ` Peter Zijlstra
2018-06-25 10:59 ` [PATCHv2 08/11] atomics: switch to generated fallbacks Mark Rutland
2018-07-04 15:28 ` Will Deacon
2018-07-04 16:01 ` Mark Rutland
2018-07-04 17:44 ` Will Deacon
2018-07-05 11:52 ` Mark Rutland
2018-06-25 10:59 ` [PATCHv2 09/11] atomics: switch to generated atomic-long Mark Rutland
2018-06-25 10:59 ` [PATCHv2 10/11] atomics: switch to generated instrumentation Mark Rutland
2018-06-25 10:59 ` [PATCHv2 11/11] arm64: use instrumented atomics Mark Rutland
2018-07-04 15:24 ` Will Deacon
2018-07-04 16:37 ` Mark Rutland
2018-07-04 17:41 ` Will Deacon
2018-07-05 9:58 ` Mark Rutland
2018-06-25 15:22 ` [PATCHv2 00/11] atomics: generate atomic headers / instrument arm64 Peter Zijlstra
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=20180625105952.3756-3-mark.rutland@arm.com \
--to=mark.rutland@arm.com \
--cc=boqun.feng@gmail.com \
--cc=dvyukov@google.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=will.deacon@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
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
all inboxes | Powered by JetHome®