linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christian Borntraeger <borntraeger@de.ibm.com>
To: Stephen Rothwell <sfr@canb.auug.org.au>,
	Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@elte.hu>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Peter Zijlstra <peterz@infradead.org>
Cc: linux-next@vger.kernel.org, linux-kernel@vger.kernel.org,
	Davidlohr Bueso <dave@stgolabs.net>
Subject: Re: linux-next: build warnings after merge of the access_once tree
Date: Thu, 26 Mar 2015 11:11:55 +0100	[thread overview]
Message-ID: <5513DB6B.7050303@de.ibm.com> (raw)
In-Reply-To: <20150326193112.2c87eb39@canb.auug.org.au>

Am 26.03.2015 um 09:31 schrieb Stephen Rothwell:
> Hi Christian,
> 
> After merging the access_once tree, today's linux-next build (arm
> multi_v7_defconfig) produced lots of this warning:
> 
> In file included from include/linux/linkage.h:4:0,
>                  from include/linux/preempt.h:9,
>                  from include/linux/spinlock.h:50,
>                  from include/linux/lockref.h:17,
>                  from lib/lockref.c:2:
> In function '__read_once_size',
>     inlined from 'lockref_get' at lib/lockref.c:50:2:
> include/linux/compiler.h:216:3: warning: call to 'data_access_exceeds_word_size' declared with attribute warning: data access exceeds word size and won't be atomic
>    data_access_exceeds_word_size();
>    ^
> 
> Introduced by commit 6becd6bd5e89 ("compiler.h: Fix word size check for
> READ/WRITE_ONCE") presumably interacting with commit 4d3199e4ca8e
> ("locking: Remove ACCESS_ONCE() usage") from the tip tree.
> 

The point of my patch was to actually re-enable the formerly broken check.
And indeed on arm 32 bit 
we read a 64bit variable (lock_count). There is no possible way of doing that
in an atomic fashion with READ_ONCE, so the warning is probably correct

code in lib/lockref.c

#define CMPXCHG_LOOP(CODE, SUCCESS) do {                                        \
        struct lockref old;                                                     \
        BUILD_BUG_ON(sizeof(old) != 8);                                         \
        old.lock_count = READ_ONCE(lockref->lock_count);                        \
        while (likely(arch_spin_value_unlocked(old.lock.rlock.raw_lock))) {     \
                struct lockref new = old, prev = old;                           \
                CODE                                                            \
                old.lock_count = cmpxchg64_relaxed(&lockref->lock_count,        \
                                                   old.lock_count,              \
                                                   new.lock_count);             \
                if (likely(old.lock_count == prev.lock_count)) {                \
                        SUCCESS;                                                \
                }                                                               \
                cpu_relax_lowlatency();                                         \
        }                                                                       \
} while (0)

  reply	other threads:[~2015-03-26 10:12 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-26  8:31 linux-next: build warnings after merge of the access_once tree Stephen Rothwell
2015-03-26 10:11 ` Christian Borntraeger [this message]
2015-03-26 10:34 ` Peter Zijlstra
2015-03-26 13:27   ` Will Deacon
2015-03-26 14:22     ` Peter Zijlstra
2015-03-26 14:41       ` Will Deacon
2015-03-26 14:51         ` Peter Zijlstra
2015-03-26 15:08           ` Will Deacon
2015-03-26 16:15       ` Linus Torvalds
2015-03-26 16:21         ` Linus Torvalds
2015-03-26 16:36           ` Peter Zijlstra
2015-03-26 16:44             ` Peter Zijlstra
2015-03-26 16:45               ` Peter Zijlstra
     [not found]             ` <CA+55aFw1WHJqSj+z-mJGY-kxrg_OsGp9jK9VBi+wB4zPgCkv_w@mail.gmail.com>
2015-03-26 17:07               ` Peter Zijlstra
2015-03-26 17:17                 ` Will Deacon
2015-03-26 17:23                 ` Christian Borntraeger
2015-03-26 19:42                   ` Christian Borntraeger
2015-03-26 16:28         ` Peter Zijlstra
     [not found]           ` <CA+55aFzUPPSHakwbp-Y-SaXB+o1=V6rOknz7L3AYNXNPU1MSfg@mail.gmail.com>
2015-03-26 17:12             ` Paul E. McKenney
2015-03-26 17:24         ` Christian Borntraeger
2015-03-26 17:52           ` Linus Torvalds
2015-03-26 18:54             ` Christian Borntraeger

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=5513DB6B.7050303@de.ibm.com \
    --to=borntraeger@de.ibm.com \
    --cc=dave@stgolabs.net \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=sfr@canb.auug.org.au \
    --cc=tglx@linutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).