From: Al Viro <viro@ZenIV.linux.org.uk>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] unbreak alpha percpu
Date: Fri, 10 Apr 2009 16:12:24 +0100 [thread overview]
Message-ID: <20090410151224.GM26366@ZenIV.linux.org.uk> (raw)
asm-generic/percpu.h is *NOT* included by every asm/percpu.h out there.
Namely, alpha can't use it since it needs the var name in
SHIFT_PERCPU_PTR - &per_cpu_var(var) won't do at all. So adding stuff
to asm-generic/percpu.h and expecting it to be picked by everything
is not going to work.
Frankly, I'd rather have SHIFT_PERCPU_PTR() calling conventions changed,
but for now the patch below will do.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
---
diff --git a/arch/alpha/include/asm/percpu.h b/arch/alpha/include/asm/percpu.h
index 3495e8e..fffec74 100644
--- a/arch/alpha/include/asm/percpu.h
+++ b/arch/alpha/include/asm/percpu.h
@@ -75,4 +75,30 @@ extern unsigned long __per_cpu_offset[NR_CPUS];
#define DECLARE_PER_CPU(type, name) extern __typeof__(type) per_cpu_var(name)
+# define percpu_read(var) \
+ ({ \
+ typeof(per_cpu_var(var)) __tmp_var__; \
+ __tmp_var__ = get_cpu_var(var); \
+ put_cpu_var(var); \
+ __tmp_var__; \
+ })
+
+#define __percpu_generic_to_op(var, val, op) \
+do { \
+ get_cpu_var(var) op val; \
+ put_cpu_var(var); \
+} while (0)
+
+# define percpu_write(var, val) __percpu_generic_to_op(var, (val), =)
+
+# define percpu_add(var, val) __percpu_generic_to_op(var, (val), +=)
+
+# define percpu_sub(var, val) __percpu_generic_to_op(var, (val), -=)
+
+# define percpu_and(var, val) __percpu_generic_to_op(var, (val), &=)
+
+# define percpu_or(var, val) __percpu_generic_to_op(var, (val), |=)
+
+# define percpu_xor(var, val) __percpu_generic_to_op(var, (val), ^=)
+
#endif /* __ALPHA_PERCPU_H */
next reply other threads:[~2009-04-10 15:12 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-10 15:12 Al Viro [this message]
2009-04-10 15:47 ` [PATCH] unbreak alpha percpu Al Viro
2009-04-10 16:21 ` Linus Torvalds
2009-04-10 16:50 ` Al Viro
2009-04-10 17:05 ` Al Viro
2009-04-10 17:14 ` Al Viro
2009-04-10 18:05 ` Ivan Kokshaysky
2009-04-10 18:20 ` Linus Torvalds
2009-04-10 18:43 ` Tejun Heo
2009-04-10 19:02 ` Tejun Heo
2009-04-10 19:34 ` Ingo Molnar
2009-04-10 19:40 ` [GIT PULL] percpu + mutex fixes Ingo Molnar
2009-04-16 10:21 ` Al Viro
2009-04-14 7:45 ` [PATCH] unbreak alpha percpu Martin Schwidefsky
2009-04-14 9:01 ` Tejun Heo
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=20090410151224.GM26366@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=torvalds@linux-foundation.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