From patchwork Sun Dec 8 20:45:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 13898665 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 5443BE77180 for ; Sun, 8 Dec 2024 20:47:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 00DC46B0391; Sun, 8 Dec 2024 15:47:35 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id EAE2B6B0393; Sun, 8 Dec 2024 15:47:34 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D002B6B0394; Sun, 8 Dec 2024 15:47:34 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id A69396B0391 for ; Sun, 8 Dec 2024 15:47:34 -0500 (EST) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id EAB2CA075F for ; Sun, 8 Dec 2024 20:47:33 +0000 (UTC) X-FDA: 82872977124.15.45422C0 Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) by imf27.hostedemail.com (Postfix) with ESMTP id F011C40002 for ; Sun, 8 Dec 2024 20:47:08 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=WOnnO6J2; spf=pass (imf27.hostedemail.com: domain of ubizjak@gmail.com designates 209.85.221.44 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=1733690831; 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=FQICK2kFPsfEELpT4bODj3LxfYome5g697HLvcS8DLE=; b=OZIqg4q07ByJfzsRAQRtNYzS6oyC+rl7FEs6rac2/RqtbJrfQr50AF5rYHJYnW1pRsLfvD zHNjhNYRI8PhR9hHU+J/1p9MyQwVVnx48Xqlc/UKQqt8ergTNQNiVaTm9TFhi7gm+rDV61 4FOTjDDAMF6kIqTFkMRsnNsA/EwAOPI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1733690831; a=rsa-sha256; cv=none; b=0QG/P38yJKfS34kpaF5zzgULdGt0kEsQCx6uO5ltyeS0KmhpD6m4U0Yi8HzUfnD/4hEjLC 9qqwLeQkItrylEhJrZ+j/Pc32qygSByKHFJq9B7Hmj+Aagxqa7I4qGvwebRimbnAUv23/a TjR5qxh2Egdg6j3C5Ko1tR6Avg/mEZY= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=WOnnO6J2; spf=pass (imf27.hostedemail.com: domain of ubizjak@gmail.com designates 209.85.221.44 as permitted sender) smtp.mailfrom=ubizjak@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-wr1-f44.google.com with SMTP id ffacd0b85a97d-385e3621518so2685200f8f.1 for ; Sun, 08 Dec 2024 12:47:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733690850; x=1734295650; 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=FQICK2kFPsfEELpT4bODj3LxfYome5g697HLvcS8DLE=; b=WOnnO6J2K8oyBjkDuTWha/l25q0dKEZ0KEsLJ77FWuhEh1IrnXYZsxF0hs31oka3s3 m0GW9YpaX4gGM0DOmDZbU4khpkiYxAl5wk4dNOG9LPAJRJ/z1XzG5YCfMNJe41XYv8sr qCgFoH6VeLhvCVjvzB77b9WkvwmOMLSrnY65nxK8GG3WgcPSJyfAETjb+LHb6djAXYOt tnN4lfKp0np7A98HM8ZWxkppsUtApNhF55AnLX3ywCvXzPioFnmpGaQx84XZJ/1pQNno iY16LQudhGNtm7eFPSo1iwXNkKJf+7kOU54H3R2PZ70djPYvu5ks4l9Jzn5IJGiJm+G2 Zofg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733690850; x=1734295650; 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=FQICK2kFPsfEELpT4bODj3LxfYome5g697HLvcS8DLE=; b=lpxZkN6qtU/LqcgjrU7vkgJF3K/eY5zW7PK7Ftpb51VDpNmbWZ60jOIkm74sqPTE+/ 89poDalB54aKObj14bZREBFsXI+wacCEgD6CHLaWBOS8Eb7Cci80S1r+4Dpd+SEToxV6 QrAwvaOWF3YhqtWXdiHmcNZxGwoVeLffudpVuO9ZZarGm0f5ZtEZ0kAFlpl0lsQr0dr3 Vtz6od4P/Lnx9P1uKl5YI2p1uWgWLfCnB+zkC7f8TeZWcI67Z6X4sIMZ9BZ2Xn865w5i hTYRqccI/5V6gTtmaiOZjoohMfCNwek/clYMC3SCCH9IueozGeB/ThG5srgPmr8Aabw+ htOw== X-Forwarded-Encrypted: i=1; AJvYcCW0vRrMRUEvLrs/DjaKkr+0LmIEcNNx2UtFRvC3WJuZFtmr5iDGNtaiizU62lpLM5WYOxAhGMgCMw==@kvack.org X-Gm-Message-State: AOJu0Yy9aSHqRE1IhENZExdIzZGkSDK6CWFsdG0s5mnlaBCQVwA6aaXU mdakUJSDiU5sQuV//SDydTdJtFja1oxHUBXv/QLT3GLl2cgLuQWR X-Gm-Gg: ASbGncu19vdXGJuvCLdsW6ShNkkj7Kejh/4kanXz1nUntAtTKkJMGjZdKvjTymlfSQW 2f5GOKUicZqm66B1+SqyyX1Fh5JtVPjWpAXAb7bAahgY81K1Ca/8TVScoJj5Yoofat+cFd+B4+x MUmOj6Aie/6KTRlfZPMHOLK0XwaHSjCMkSDFCFy8kSYo7j9mvRGbBrJAUD9hR/l8DIAld+32J2A Jran8JWVM+UGnHAy/D61U25bhud2ykwe5g4b/xKI4ceJ2h0nyjYBqEJfa8= X-Google-Smtp-Source: AGHT+IEgK+5BlWjK5hYmyAc92iK0vY/52y9egBCaI4T3OGpocF9n9vCZzb2/329/9E4vHrdt2CJvTg== X-Received: by 2002:a5d:5f8f:0:b0:385:f092:e16 with SMTP id ffacd0b85a97d-3862b3e3ae1mr6811496f8f.55.1733690850465; Sun, 08 Dec 2024 12:47:30 -0800 (PST) Received: from localhost.localdomain ([46.248.82.114]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3861f59cc6fsm10874975f8f.34.2024.12.08.12.47.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Dec 2024 12:47:29 -0800 (PST) From: Uros Bizjak To: x86@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-bcachefs@vger.kernel.org, linux-arch@vger.kernel.org, netdev@vger.kernel.org Cc: Uros Bizjak , Nadav Amit , Arnd Bergmann , Thomas Gleixner , Dennis Zhou , Tejun Heo , Christoph Lameter , Linus Torvalds , Andy Lutomirski , Ingo Molnar , Brian Gerst , "H. Peter Anvin" , Peter Zijlstra Subject: [PATCH v3 5/6] percpu: Repurpose __percpu tag as a named address space qualifier Date: Sun, 8 Dec 2024 21:45:20 +0100 Message-ID: <20241208204708.3742696-6-ubizjak@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20241208204708.3742696-1-ubizjak@gmail.com> References: <20241208204708.3742696-1-ubizjak@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: F011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6p 2xW30E31 AshxClT43CVbVUFXk8ZKp9LaPg2OCZ1A8XUIXy07GMZjJmCGvUu0f9i2RjoNDJb4RIq2skNa3VfntjJrh0DMACOnyYkGyN2EOC2n+/OsQBHrDmea/i0H9t8fHBUI5qU92QuqbdlP5V0hQ9BZj6coUX9ma0Xs51Dpf+ML/uKfU9LQW8rArMqHZgzl05rbBQEKyCPOmRt50WewOsE0Jl6RYp1xDLRbEr1nMGIdT6B3eHUSBz4uswluodZNfS9Gtb/5Rx81wumkn4oUZiwUfB5lqGByRtv3euE5959/l7+vCkELDhFe6EFrQaBftpxAmYRapz9X7OKglJXA8rjbfKSrREnBIh/she0kBfpEPxAarDbnFBDdxrdllu3Za9qGUun4oIWGngYhj6VWMR7WRdvdUSIgLCB/zmL+ehzzBC6qKIGOeBCrduTB8phyGmVh1yGGcOgjRy3J+BkjLXZqKJOyH+HSUYw+6x8LGOp9WIRbGhjjIc5WQ0lcND2jAEVI0EBMP2hDY10OXBvHfhLuRN9+ekyckvp18fgDDfN/n9ibTLV5vmT7CwvwICBXE9POp8+g/mWHnGP5oqvoALpV2vAJFGtr2+Nw2y9d2DV4P+0Zo/CzwWLg5WnTQHMmL2mnMp2ONM3iIE7xUWtfF9gWFeCDBLZIvtzo8rgpHLXYYusKksM0VMLBg5FZcV0o7NNX+bxTmpvSf/zhd4Ky9AUVNMjNX1+hAs0QBoepS7+vx4PGiEWxVj/S7vB4wg3S3Vi3d3kys04tO 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 __percpu_qual define and repurposes __percpu tag as a named address space qualifier using the new define. Arches can now conditionally define __percpu_qual as their named address space qualifier for percpu variables. Signed-off-by: Uros Bizjak Acked-by: Nadav Amit Cc: Arnd Bergmann Cc: Thomas Gleixner Cc: Dennis Zhou Cc: Tejun Heo Cc: Christoph Lameter Cc: Linus Torvalds Cc: Andy Lutomirski Cc: Ingo Molnar Cc: Brian Gerst Cc: "H. Peter Anvin" Cc: Peter Zijlstra --- v3: - Rename __per_cpu_qual to __percpu_qual. --- include/asm-generic/percpu.h | 13 +++++++++++++ include/linux/compiler_types.h | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/include/asm-generic/percpu.h b/include/asm-generic/percpu.h index 50597b975a49..02aeca21479a 100644 --- a/include/asm-generic/percpu.h +++ b/include/asm-generic/percpu.h @@ -6,6 +6,19 @@ #include #include +/* + * __percpu_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 variable may be declared as being relative + * to the %fs or %gs segments using __seg_fs or __seg_gs named address + * space qualifier). + */ +#ifndef __percpu_qual +# define __percpu_qual +#endif + #ifdef CONFIG_SMP /* diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h index 981cc3d7e3aa..5d6544545658 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 __percpu_qual BTF_TYPE_TAG(percpu) # define __rcu BTF_TYPE_TAG(rcu) # define __chk_user_ptr(x) (void)0