From patchwork Mon Aug 12 11:57:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 13760453 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5797FC52D7C for ; Mon, 12 Aug 2024 12:00:11 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6CFC86B0092; Mon, 12 Aug 2024 08:00:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 656A16B009A; Mon, 12 Aug 2024 08:00:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 433E16B009E; Mon, 12 Aug 2024 08:00:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 1C8A16B0092 for ; Mon, 12 Aug 2024 08:00:05 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id C8C131A1D8C for ; Mon, 12 Aug 2024 12:00:04 +0000 (UTC) X-FDA: 82443449928.13.779A63C Received: from mail-ej1-f46.google.com (mail-ej1-f46.google.com [209.85.218.46]) by imf27.hostedemail.com (Postfix) with ESMTP id E2AEC40030 for ; Mon, 12 Aug 2024 12:00:02 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="PuA/uU0n"; spf=pass (imf27.hostedemail.com: domain of ubizjak@gmail.com designates 209.85.218.46 as permitted sender) smtp.mailfrom=ubizjak@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1723463934; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=JJLe5IUAL1/xG0v/qE20AqL4y9xZWwRXykIQj0IeARs=; b=OPiXDN5pFWqwd9NkEaz+KuFxV3AUOyki7eCSUSOaMduXXKNc3TDT9Knme0JWPeeQNxAo0+ Eqo2RkMwHRRnRONuEetYbmbQcXtqj9ZsWOgEyUx2IrkNY6dqDoripW7BaqCDMOFCKteeFe C0s8K4OVo7U2PRBF1LScABVJ+jqqfbI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1723463934; a=rsa-sha256; cv=none; b=Te6UlLD+4FXR6MMd6lectwoF3Ym1m62GUu9eHd/J7Jr6KG+PGfWU0HlHPI04NZoRdB2zjf 5e/chyjatslqGUL70sxPEu+PfqDTW7CdbmCclZ5bfvZRAZRnyazmUJcceu840XhJx6ngmU dwMlb5M4FcU5FDL5ll3A32emfbYXUfU= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b="PuA/uU0n"; spf=pass (imf27.hostedemail.com: domain of ubizjak@gmail.com designates 209.85.218.46 as permitted sender) smtp.mailfrom=ubizjak@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-ej1-f46.google.com with SMTP id a640c23a62f3a-a7ab63a388bso139964666b.1 for ; Mon, 12 Aug 2024 05:00:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723464001; x=1724068801; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=JJLe5IUAL1/xG0v/qE20AqL4y9xZWwRXykIQj0IeARs=; b=PuA/uU0nzKHyPYZLI7v7KLmqKPhW68bWQScsHwIFYvCruYt1RnhkC8pJv3aVHbXus5 X3CNxMLNAbvbTyeVjBolJMdHKA2gcmo7DClccudJOdE222phlpwg/wvjhX3wZlNxS0NY rAxytcN+gaXWjoEpANURUeVch5KKS+XRMFtnWikPti97GXRP79ov/nb4zWLquGUMcZ// gXP0vThpYhC+WOLJtUytKj7q86PRVl26M5k6wCVqnoi1TYzpI2TjACanq0FBP90Rdxzn +44cvz3a27HBqVSfzdvENtQGYKj+JX/JNJ2vZByUpnxg2Fr8HihoZysqZjVZVFzY+xck nJyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723464001; x=1724068801; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=JJLe5IUAL1/xG0v/qE20AqL4y9xZWwRXykIQj0IeARs=; b=kkP48wvB0Yq2QHANvy/dx4IZGYFRq61JuHfL8mjaMnUxZuUc/sDxFrsTEX6SLtq71A 4ooHdIUntTqyPMbCmqnWp78/ekJztgm9g4jzZw6hg1jWkAGTKVI6v2K/eXi4rng0TfUQ HaXnr2gypiaCSzeunbEWFxb1v8++RRleUCzwsYTf31oNHRjy4rjOhhdD27WHHnj9oUG5 Bmv9J7yUWwbyJm/Dvrl7w7lIHFqCf5e9WrQ4SRT3F3cu6LFdwEQ7dMNhyE+wGx9CdrKt msPh61XCQon9ma42YKBjhgnu6rWcBxeZ1KHCfjkygBRZ4+aW8vJj9SbBXl5Yvspa7EmI TGoA== X-Gm-Message-State: AOJu0YyeCsMrrgm7zfK7Bxq08LhGumnyw2LVmcN8Hy1/tpLIYJXEhNBF V0FlcnNbPoT7rB5N9DSUVmGODBwX2bsfjvZEOiPYG+63UdxsArZ8KQrHk+ep65s= X-Google-Smtp-Source: AGHT+IHLf0wX3sTf+xZ73mLemXQoM3mULwR0RMBbNFiKu9Xs4bJxq0l9b69j/UaSYylfIRYCAo7wzA== X-Received: by 2002:a05:6402:3552:b0:5bb:9ae0:4a49 with SMTP id 4fb4d7f45d1cf-5bd44c66a3amr11213a12.30.1723464000709; Mon, 12 Aug 2024 05:00:00 -0700 (PDT) Received: from fedora.iskraemeco.si ([193.77.86.250]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5bd1a5e04aesm2055970a12.76.2024.08.12.04.59.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Aug 2024 05:00:00 -0700 (PDT) From: Uros Bizjak To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Uros Bizjak , Dennis Zhou , Tejun Heo , Christoph Lameter , Andy Lutomirski , Ingo Molnar , Nadav Amit , Brian Gerst , Denys Vlasenko , "H. Peter Anvin" , Linus Torvalds , Peter Zijlstra , Thomas Gleixner , Borislav Petkov , Luc Van Oostenryck 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 Message-ID: <20240812115945.484051-4-ubizjak@gmail.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240812115945.484051-1-ubizjak@gmail.com> References: <20240812115945.484051-1-ubizjak@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: E2AEC40030 X-Stat-Signature: 7i5xtkeook7hnjmnu6ew1oqkk9dj5q1d X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1723464002-41746 X-HE-Meta: U2FsdGVkX1/8kmiiGKzIpx0XXiQSuavO9poWUJYlVj4oR162JK687LFAW9ovQT0wVAvhla9OtQtJeDne6+4bOevUtCkVQ/6NpOoz4z1OU4041HTJYwSUjGvLa0s+Q7zxbD4mEnJ6+okwE3vzKNM1+RJUc/LDxddKFGqlGW4uOQdBlj0Tvi/wrE5zyCoRuBB5d5j1phQsLZu2x0+uWqXVKeO5rB8eHTqiJ1tLMCQOjthUstBPDXAkCmcX3a+3NEMYt7PFgKG8mAgYB5m/DNxqgcRJb9olRXbs4wXb5w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3vTSngOt6XJJvxgK9T65JcDThEw5I+X+A1ge4caycfF7PLPWB0wSarHEaI4goyxV7ZZ+FYXoBnPK1yGdo1zei4vA+4jrVEtS3CDqoxWh+L1kNYfA9czcks7CWbJLPHt3qUHR/VHpiwNYAPFiZZgs0J0nGEUk8Pz599Mu5B4WMef8QM9K/1/FQpZopu+JIygAMDxbwavaoHPZwmySDvXd9gj8dnkVW7Cj6+CSTMIfmMdGU2sTAaW2G5XW17hLk6ZHh0+PrtNERwppnqZNGfUxs6Zkt+ETfzl7CEzRKqh2FNXH5nUo/fo996cmrT9KYUfUJjvV969eqiTZzRDR6lWAJlVkxW8fo3HBLZ5btMa45mqj0qp/WZZFTrlQkMxUUJtffVTRc0y+q8/ny4AZV5jdGEN80VBTJHzJkoLvQcAVxNBq X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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 Cc: Dennis Zhou Cc: Tejun Heo Cc: Christoph Lameter Cc: Andy Lutomirski Cc: Ingo Molnar Cc: Nadav Amit Cc: Brian Gerst Cc: Denys Vlasenko Cc: H. Peter Anvin Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Borislav Petkov Cc: Luc Van Oostenryck --- 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 #include +/* + * 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