Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1604819
| From | Mark Rutland <mark.rutland@arm.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 2/3] asm-generic, x86: wrap atomic operations |
| Date | 2017-03-20 18:20 +0100 |
| Message-ID | <tn98l-7Ut-9@gated-at.bofh.it> (permalink) |
| References | <tl0iR-4M7-3@gated-at.bofh.it> <tl0iS-4M7-9@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Hi,
On Tue, Mar 14, 2017 at 08:24:13PM +0100, Dmitry Vyukov wrote:
> /**
> - * atomic_read - read atomic variable
> + * arch_atomic_read - read atomic variable
> * @v: pointer of type atomic_t
> *
> * Atomically reads the value of @v.
> */
> -static __always_inline int atomic_read(const atomic_t *v)
> +static __always_inline int arch_atomic_read(const atomic_t *v)
> {
> - return READ_ONCE((v)->counter);
> + /*
> + * We use READ_ONCE_NOCHECK() because atomic_read() contains KASAN
> + * instrumentation. Double instrumentation is unnecessary.
> + */
> + return READ_ONCE_NOCHECK((v)->counter);
> }
Just to check, we do this to avoid duplicate reports, right?
If so, double instrumentation isn't solely "unnecessary"; it has a
functional difference, and we should explicitly describe that in the
comment.
... or are duplicate reports supressed somehow?
[...]
> +static __always_inline void arch_atomic_set(atomic_t *v, int i)
> {
> + /*
> + * We could use WRITE_ONCE_NOCHECK() if it exists, similar to
> + * READ_ONCE_NOCHECK() in arch_atomic_read(). But there is no such
> + * thing at the moment, and introducing it for this case does not
> + * worth it.
> + */
> WRITE_ONCE(v->counter, i);
> }
If we are trying to avoid duplicate reports, we should do the same here.
[...]
> +static __always_inline short int atomic_inc_short(short int *v)
> +{
> + return arch_atomic_inc_short(v);
> +}
This is x86-specific, and AFAICT, not used anywhere.
Given that it is arch-specific, I don't think it should be instrumented
here. If it isn't used, we could get rid of it entirely...
Thanks,
Mark.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/3] x86, kasan: add KASAN checks to atomic operations Dmitry Vyukov <dvyukov@google.com> - 2017-03-14 20:30 +0100
Re: [PATCH 2/3] asm-generic, x86: wrap atomic operations Mark Rutland <mark.rutland@arm.com> - 2017-03-20 18:20 +0100
Re: [PATCH 2/3] asm-generic, x86: wrap atomic operations Mark Rutland <mark.rutland@arm.com> - 2017-03-21 11:50 +0100
Re: [PATCH 2/3] asm-generic, x86: wrap atomic operations Dmitry Vyukov <dvyukov@google.com> - 2017-03-21 19:10 +0100
Re: [PATCH 2/3] asm-generic, x86: wrap atomic operations Arnd Bergmann <arnd@arndb.de> - 2017-03-21 22:30 +0100
Re: [PATCH 2/3] asm-generic, x86: wrap atomic operations Dmitry Vyukov <dvyukov@google.com> - 2017-03-22 11:50 +0100
Re: [PATCH 2/3] asm-generic, x86: wrap atomic operations Arnd Bergmann <arnd@arndb.de> - 2017-03-22 12:40 +0100
Re: [PATCH 2/3] asm-generic, x86: wrap atomic operations Dmitry Vyukov <dvyukov@google.com> - 2017-03-22 13:30 +0100
Re: [PATCH 2/3] asm-generic, x86: wrap atomic operations Arnd Bergmann <arnd@arndb.de> - 2017-03-22 13:50 +0100
Re: [PATCH 2/3] asm-generic, x86: wrap atomic operations Ingo Molnar <mingo@kernel.org> - 2017-03-24 08:00 +0100
Re: [PATCH 2/3] asm-generic, x86: wrap atomic operations Dmitry Vyukov <dvyukov@google.com> - 2017-03-24 08:20 +0100
Re: [PATCH 2/3] asm-generic, x86: wrap atomic operations Dmitry Vyukov <dvyukov@google.com> - 2017-03-24 09:50 +0100
Re: [PATCH 2/3] asm-generic, x86: wrap atomic operations Ingo Molnar <mingo@kernel.org> - 2017-03-24 12:00 +0100
Re: [PATCH 2/3] asm-generic, x86: wrap atomic operations Dmitry Vyukov <dvyukov@google.com> - 2017-03-24 13:50 +0100
csiph-web