From: Uros Bizjak <ubizjak@gmail.com>
To: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Cc: Uros Bizjak <ubizjak@gmail.com>, Dennis Zhou <dennis@kernel.org>,
Tejun Heo <tj@kernel.org>, Christoph Lameter <cl@linux.com>,
Andy Lutomirski <luto@kernel.org>, Ingo Molnar <mingo@kernel.org>,
Nadav Amit <nadav.amit@gmail.com>,
Brian Gerst <brgerst@gmail.com>,
Denys Vlasenko <dvlasenk@redhat.com>,
"H. Peter Anvin" <hpa@zytor.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>,
Borislav Petkov <bp@alien8.de>,
Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Subject: [RFC PATCH v2 3/4] percpu: Repurpose __percpu tag as a named address space qualifier
Date: Mon, 12 Aug 2024 13:57:37 +0200 [thread overview]
Message-ID: <20240812115945.484051-4-ubizjak@gmail.com> (raw)
In-Reply-To: <20240812115945.484051-1-ubizjak@gmail.com>
The patch introduces per_cpu_qual define and repurposes __percpu
tag as a named address space qualifier using the new define.
Arches can now conditionally define __per_cpu_qual as their
named address space qualifier for percpu variables.
Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Cc: Dennis Zhou <dennis@kernel.org>
Cc: Tejun Heo <tj@kernel.org>
Cc: Christoph Lameter <cl@linux.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Nadav Amit <nadav.amit@gmail.com>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
---
include/asm-generic/percpu.h | 15 +++++++++++++++
include/linux/compiler_types.h | 2 +-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/include/asm-generic/percpu.h b/include/asm-generic/percpu.h
index c091e09046c5..5f85d7ba8e2d 100644
--- a/include/asm-generic/percpu.h
+++ b/include/asm-generic/percpu.h
@@ -6,6 +6,21 @@
#include <linux/threads.h>
#include <linux/percpu-defs.h>
+/*
+ * per_cpu_qual is the qualifier for the percpu named address space.
+ *
+ * Most arches use generic named address space for percpu variables but
+ * some arches define percpu variables in different named address space
+ * (on the x86 arch, percpu variables may be declared as being relative
+ * to the %fs or %gs segments using __seg_fs or __seg_gs named address
+ * space qualifiers).
+ */
+#ifdef __per_cpu_qual
+#define per_cpu_qual __per_cpu_qual
+#else
+#define per_cpu_qual /* nothing */
+#endif
+
#ifdef CONFIG_SMP
/*
diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h
index f14c275950b5..4c5917b97bc3 100644
--- a/include/linux/compiler_types.h
+++ b/include/linux/compiler_types.h
@@ -57,7 +57,7 @@ static inline void __chk_io_ptr(const volatile void __iomem *ptr) { }
# define __user BTF_TYPE_TAG(user)
# endif
# define __iomem
-# define __percpu BTF_TYPE_TAG(percpu)
+# define __percpu per_cpu_qual BTF_TYPE_TAG(percpu)
# define __rcu BTF_TYPE_TAG(rcu)
# define __chk_user_ptr(x) (void)0
--
2.46.0
next prev parent reply other threads:[~2024-08-12 12:00 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-12 11:57 [RFC PATCH v2 0/4] Enable strict percpu address space checks Uros Bizjak
2024-08-12 11:57 ` [RFC PATCH v2 1/4] percpu: Define pcpu_typeof() Uros Bizjak
2024-08-12 11:57 ` [RFC PATCH v2 2/4] percpu: Assorted fixes found by strict percpu address space checks Uros Bizjak
2024-08-12 19:09 ` Nadav Amit
2024-08-12 20:36 ` Uros Bizjak
2024-08-12 11:57 ` Uros Bizjak [this message]
2024-08-12 19:12 ` [RFC PATCH v2 3/4] percpu: Repurpose __percpu tag as a named address space qualifier Nadav Amit
2024-08-12 20:01 ` Uros Bizjak
2024-08-12 11:57 ` [RFC PATCH v2 4/4] percpu/x86: Enable strict percpu checks via named AS qualifiers Uros Bizjak
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=20240812115945.484051-4-ubizjak@gmail.com \
--to=ubizjak@gmail.com \
--cc=bp@alien8.de \
--cc=brgerst@gmail.com \
--cc=cl@linux.com \
--cc=dennis@kernel.org \
--cc=dvlasenk@redhat.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=luc.vanoostenryck@gmail.com \
--cc=luto@kernel.org \
--cc=mingo@kernel.org \
--cc=nadav.amit@gmail.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=tj@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