From: ebiederm@xmission.com (Eric W. Biederman)
To: Fengguang Wu <fengguang.wu@intel.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>,
kernel-janitors@vger.kernel.org, Greg Ungerer <gerg@uclinux.org>,
linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org,
linux-arch@vger.kernel.org
Subject: Architectures missing atomic64_t
Date: Mon, 13 Aug 2012 19:08:47 +0000 [thread overview]
Message-ID: <877gt2y5hc.fsf_-_@xmission.com> (raw)
In-Reply-To: <20120813181343.GA2055@localhost> (Fengguang Wu's message of "Tue, 14 Aug 2012 02:13:43 +0800")
Fengguang Wu <fengguang.wu@intel.com> writes:
> On Tue, Aug 14, 2012 at 01:55:16AM +0800, Fengguang Wu wrote:
>> > >I'd suggest to fix it in m68k and make atomic64_t generally available.
>> >
>> > Fengguang in your testing on any architechtures is atomic64_t missing on anything except some m68k subarchtechtures?
>>
>> Eric, it only complaints for m68k, among the architechtures the build
>> tests covered (alpha arm avr32 blackfin cris frv h8300 i386 ia64 m32r
>> m68k mips mn10300 openrisc parisc powerpc s390 sh sparc sparc64 tile
>> um x86_64 xtensa).
>
> Sorry, I must missed something (in my system, build errors are only
> recorded on first sight)..
>
> wfg /c/linux% for arch in arch/*/; do grep -ir -q atomic64 $arch || echo $arch; done
> arch/c6x/
> arch/h8300/
> arch/mn10300/
> arch/score/
> arch/unicore32/
>
> So the above archs are likely still missing atomic64_t support.
> However it should be trivial to add support to them, by adding
> "select GENERIC_ATOMIC64" lines to them.
So I just looked a little deeper and it appears architectures that do
not support atomic64_t are broken.
The generic atomic64 support came in 2009 to support the perf subsystem
with the expectation that all architectures would implement atomic64
support.
Furthermore upon inspection of the kernel atomic64_t is used in a fair
number of places beyond the performance counters:
block/blk-cgroup.c
drivers/acpi/apei/
drivers/block/rbd.c
drivers/crypto/nx/nx.h
drivers/gpu/drm/radeon/radeon.h
drivers/infiniband/hw/ipath/
drivers/infiniband/hw/qib/
drivers/staging/octeon/
fs/xfs/
include/linux/perf_event.h
include/net/netfilter/nf_conntrack_acct.h
kernel/events/
kernel/trace/
net/mac80211/key.h
net/rds/
The block control group, infiniband, xfs, crypto, 802.11, netfilter.
Nothing quite so fundamental as fs/namespace.c but definitely in
multiplatform-code that should work, and is already broken on those
architecutres.
Looking at the implementation of atomic64_add_return in lib/atomic64.c
the code looks as efficient as these kinds of things get.
Which leads me to the conclusion that we need atomic64 support on all
architectures.
Arch folks can you please take care of your achitectures and ensure
that atomic64_t is supported?
Eric
commit 09d4e0edd4614e787393acc582ac701c6ec3565b
Author: Paul Mackerras <paulus@samba.org>
Date: Fri Jun 12 21:10:05 2009 +0000
lib: Provide generic atomic64_t implementation
Many processor architectures have no 64-bit atomic instructions, but
we need atomic64_t in order to support the perf_counter subsystem.
This adds an implementation of 64-bit atomic operations using hashed
spinlocks to provide atomicity. For each atomic operation, the address
of the atomic64_t variable is hashed to an index into an array of 16
spinlocks. That spinlock is taken (with interrupts disabled) around the
operation, which can then be coded non-atomically within the lock.
On UP, all the spinlock manipulation goes away and we simply disable
interrupts around each operation. In fact gcc eliminates the whole
atomic64_lock variable as well.
Signed-off-by: Paul Mackerras <paulus@samba.org>
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
next prev parent reply other threads:[~2012-08-13 19:08 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-12 14:50 [userns:userns-always-map-user-v45 80/99] fs/namespace.c:2290:1: error: unknown type name 'atomic64_ Fengguang Wu
2012-08-13 6:56 ` [userns:userns-always-map-user-v45 80/99] fs/namespace.c:2290:1: error: unknown type name 'atomi Eric W. Biederman
2012-08-13 13:39 ` Fengguang Wu
2012-08-13 16:13 ` Eric W. Biederman
2012-08-13 17:55 ` Fengguang Wu
2012-08-13 18:13 ` Fengguang Wu
2012-08-13 19:08 ` Eric W. Biederman [this message]
2012-08-14 14:57 ` Architectures missing atomic64_t Fengguang Wu
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=877gt2y5hc.fsf_-_@xmission.com \
--to=ebiederm@xmission.com \
--cc=fengguang.wu@intel.com \
--cc=geert@linux-m68k.org \
--cc=gerg@uclinux.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-m68k@lists.linux-m68k.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 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).