[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cebda65a-1bdc-8b44-22e7-12fc1c45fa99@virtuozzo.com>
Date: Wed, 28 Jun 2017 17:00:15 +0300
From: Andrey Ryabinin <aryabinin@...tuozzo.com>
To: Thomas Gleixner <tglx@...utronix.de>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>
Cc: Ingo Molnar <mingo@...nel.org>, Dmitry Vyukov <dvyukov@...gle.com>,
Mark Rutland <mark.rutland@....com>,
Peter Zijlstra <peterz@...radead.org>,
Will Deacon <will.deacon@....com>,
"H. Peter Anvin" <hpa@...or.com>,
kasan-dev <kasan-dev@...glegroups.com>,
"x86@...nel.org" <x86@...nel.org>,
LKML <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
"linux-mm@...ck.org" <linux-mm@...ck.org>,
Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [PATCH] locking/atomics: don't alias ____ptr
On 06/28/2017 04:20 PM, Thomas Gleixner wrote:
> On Wed, 28 Jun 2017, Sebastian Andrzej Siewior wrote:
>> On 2017-06-28 14:15:18 [+0300], Andrey Ryabinin wrote:
>>> The main problem here is that arch_cmpxchg64_local() calls cmpxhg_local() instead of using arch_cmpxchg_local().
>>>
>>> So, the patch bellow should fix the problem, also this will fix double instrumentation of cmpcxchg64[_local]().
>>> But I haven't tested this patch yet.
>>
>> tested, works. Next step?
>
> Check all other implementations in every architecture whether there is a
> similar problem .....
>
This and similar problems could have been caught by -Wshadow warning:
In file included from ../arch/x86/include/asm/atomic.h:282:0,
from ../include/linux/atomic.h:4,
from ../include/linux/jump_label.h:183,
from ../arch/x86/include/asm/string_64.h:5,
from ../arch/x86/include/asm/string.h:4,
from ../include/linux/string.h:18,
from ../include/linux/bitmap.h:8,
from ../drivers/iommu/intel-iommu.c:24:
../include/asm-generic/atomic-instrumented.h:376:18: warning: declaration of ‘____ptr’ shadows a previous local [-Wshadow]
__typeof__(ptr) ____ptr = (ptr); \
^
../arch/x86/include/asm/cmpxchg_64.h:18:2: note: in expansion of macro ‘cmpxchg_local’
cmpxchg_local((ptr), (o), (n)); \
^
../include/asm-generic/atomic-instrumented.h:392:2: note: in expansion of macro ‘arch_cmpxchg64_local’
arch_cmpxchg64_local(____ptr, (old), (new)); \
^
../drivers/iommu/intel-iommu.c:2290:9: note: in expansion of macro ‘cmpxchg64_local’
tmp = cmpxchg64_local(&pte->val, 0ULL, pteval);
^
../include/asm-generic/atomic-instrumented.h:390:18: note: shadowed declaration is here
__typeof__(ptr) ____ptr = (ptr); \
^
../drivers/iommu/intel-iommu.c:2290:9: note: in expansion of macro ‘cmpxchg64_local’
tmp = cmpxchg64_local(&pte->val, 0ULL, pteval);
^
But for some reason we use -Wshadow only on W=2 level.
Powered by blists - more mailing lists