From: Ingo Molnar <mingo@kernel.org>
To: Dmitry Vyukov <dvyukov@google.com>
Cc: akpm@linux-foundation.org, arnd@arndb.de,
aryabinin@virtuozzo.com, Mark Rutland <mark.rutland@arm.com>,
Peter Zijlstra <peterz@infradead.org>,
Will Deacon <will.deacon@arm.com>,
linux-mm@kvack.org, x86@kernel.org, linux-kernel@vger.kernel.org,
kasan-dev@googlegroups.com
Subject: Re: [PATCH v2] x86: s/READ_ONCE_NOCHECK/READ_ONCE/ in arch_atomic[64]_read()
Date: Mon, 27 Mar 2017 08:25:54 +0200 [thread overview]
Message-ID: <20170327062554.GA10918@gmail.com> (raw)
In-Reply-To: <20170322125740.85337-1-dvyukov@google.com>
* Dmitry Vyukov <dvyukov@google.com> wrote:
> Two problems was reported with READ_ONCE_NOCHECK in arch_atomic_read:
> 1. Andrey Ryabinin reported significant binary size increase
> (+400K of text). READ_ONCE_NOCHECK is intentionally compiled to
> non-inlined function call, and I counted 640 copies of it in my vmlinux.
> 2. Arnd Bergmann reported a new splat of too large frame sizes.
>
> A single inlined KASAN check is very cheap, a non-inlined function
> call with KASAN/KCOV instrumentation can easily be more expensive.
>
> Switch to READ_ONCE() in arch_atomic[64]_read().
>
> Signed-off-by: Dmitry Vyukov <dvyukov@google.com>
> Reported-by: Arnd Bergmann <arnd@arndb.de>
> Reported-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Will Deacon <will.deacon@arm.com>
> Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: linux-mm@kvack.org
> Cc: x86@kernel.org
> Cc: linux-kernel@vger.kernel.org
> Cc: kasan-dev@googlegroups.com
> Signed-off-by: Dmitry Vyukov <dvyukov@google.com>
>
> ---
>
> Changes since v1:
> - also change arch_atomic64_read()
> ---
> arch/x86/include/asm/atomic.h | 15 ++++++---------
> arch/x86/include/asm/atomic64_64.h | 2 +-
> 2 files changed, 7 insertions(+), 10 deletions(-)
>
> diff --git a/arch/x86/include/asm/atomic.h b/arch/x86/include/asm/atomic.h
> index 0cde164f058a..46e53bbf7ce3 100644
> --- a/arch/x86/include/asm/atomic.h
> +++ b/arch/x86/include/asm/atomic.h
> @@ -24,10 +24,13 @@
> static __always_inline int arch_atomic_read(const atomic_t *v)
> {
> /*
> - * We use READ_ONCE_NOCHECK() because atomic_read() contains KASAN
> - * instrumentation. Double instrumentation is unnecessary.
> + * Note: READ_ONCE() here leads to double instrumentation as
> + * both READ_ONCE() and atomic_read() contain instrumentation.
> + * This is deliberate choice. READ_ONCE_NOCHECK() is compiled to a
> + * non-inlined function call that considerably increases binary size
> + * and stack usage under KASAN.
s/this is deliberate choice
/this is a deliberate choice
Also, the patch does not apply to the latest locking tree cleanly, due to
interacting changes.
Thanks,
Ingo
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
WARNING: multiple messages have this Message-ID (diff)
From: Ingo Molnar <mingo@kernel.org>
To: Dmitry Vyukov <dvyukov@google.com>
Cc: akpm@linux-foundation.org, arnd@arndb.de,
aryabinin@virtuozzo.com, Mark Rutland <mark.rutland@arm.com>,
Peter Zijlstra <peterz@infradead.org>,
Will Deacon <will.deacon@arm.com>,
linux-mm@kvack.org, x86@kernel.org, linux-kernel@vger.kernel.org,
kasan-dev@googlegroups.com
Subject: Re: [PATCH v2] x86: s/READ_ONCE_NOCHECK/READ_ONCE/ in arch_atomic[64]_read()
Date: Mon, 27 Mar 2017 08:25:54 +0200 [thread overview]
Message-ID: <20170327062554.GA10918@gmail.com> (raw)
In-Reply-To: <20170322125740.85337-1-dvyukov@google.com>
* Dmitry Vyukov <dvyukov@google.com> wrote:
> Two problems was reported with READ_ONCE_NOCHECK in arch_atomic_read:
> 1. Andrey Ryabinin reported significant binary size increase
> (+400K of text). READ_ONCE_NOCHECK is intentionally compiled to
> non-inlined function call, and I counted 640 copies of it in my vmlinux.
> 2. Arnd Bergmann reported a new splat of too large frame sizes.
>
> A single inlined KASAN check is very cheap, a non-inlined function
> call with KASAN/KCOV instrumentation can easily be more expensive.
>
> Switch to READ_ONCE() in arch_atomic[64]_read().
>
> Signed-off-by: Dmitry Vyukov <dvyukov@google.com>
> Reported-by: Arnd Bergmann <arnd@arndb.de>
> Reported-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Will Deacon <will.deacon@arm.com>
> Cc: Andrey Ryabinin <aryabinin@virtuozzo.com>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: linux-mm@kvack.org
> Cc: x86@kernel.org
> Cc: linux-kernel@vger.kernel.org
> Cc: kasan-dev@googlegroups.com
> Signed-off-by: Dmitry Vyukov <dvyukov@google.com>
>
> ---
>
> Changes since v1:
> - also change arch_atomic64_read()
> ---
> arch/x86/include/asm/atomic.h | 15 ++++++---------
> arch/x86/include/asm/atomic64_64.h | 2 +-
> 2 files changed, 7 insertions(+), 10 deletions(-)
>
> diff --git a/arch/x86/include/asm/atomic.h b/arch/x86/include/asm/atomic.h
> index 0cde164f058a..46e53bbf7ce3 100644
> --- a/arch/x86/include/asm/atomic.h
> +++ b/arch/x86/include/asm/atomic.h
> @@ -24,10 +24,13 @@
> static __always_inline int arch_atomic_read(const atomic_t *v)
> {
> /*
> - * We use READ_ONCE_NOCHECK() because atomic_read() contains KASAN
> - * instrumentation. Double instrumentation is unnecessary.
> + * Note: READ_ONCE() here leads to double instrumentation as
> + * both READ_ONCE() and atomic_read() contain instrumentation.
> + * This is deliberate choice. READ_ONCE_NOCHECK() is compiled to a
> + * non-inlined function call that considerably increases binary size
> + * and stack usage under KASAN.
s/this is deliberate choice
/this is a deliberate choice
Also, the patch does not apply to the latest locking tree cleanly, due to
interacting changes.
Thanks,
Ingo
next prev parent reply other threads:[~2017-03-27 6:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-22 12:57 [PATCH v2] x86: s/READ_ONCE_NOCHECK/READ_ONCE/ in arch_atomic[64]_read() Dmitry Vyukov
2017-03-22 12:57 ` Dmitry Vyukov
2017-03-22 14:13 ` Arnd Bergmann
2017-03-22 14:13 ` Arnd Bergmann
2017-03-27 6:25 ` Ingo Molnar [this message]
2017-03-27 6:25 ` Ingo Molnar
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=20170327062554.GA10918@gmail.com \
--to=mingo@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=aryabinin@virtuozzo.com \
--cc=dvyukov@google.com \
--cc=kasan-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mark.rutland@arm.com \
--cc=peterz@infradead.org \
--cc=will.deacon@arm.com \
--cc=x86@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.