From patchwork Thu Dec 5 15:40:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 13895610 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 11F93E7716D for ; Thu, 5 Dec 2024 15:43:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DA2D86B0181; Thu, 5 Dec 2024 10:43:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D2D216B0182; Thu, 5 Dec 2024 10:43:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B5C696B0194; Thu, 5 Dec 2024 10:43:08 -0500 (EST) 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 8F7596B0181 for ; Thu, 5 Dec 2024 10:43:08 -0500 (EST) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 5160281425 for ; Thu, 5 Dec 2024 15:43:08 +0000 (UTC) X-FDA: 82861323888.28.9BBD1D3 Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) by imf02.hostedemail.com (Postfix) with ESMTP id 22E288001E for ; Thu, 5 Dec 2024 15:42:35 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=GOasxY6X; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf02.hostedemail.com: domain of ubizjak@gmail.com designates 209.85.221.42 as permitted sender) smtp.mailfrom=ubizjak@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1733413379; 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=DJNYPM738NzsA6HHUsuEIDtHtfWH4Z1j0zTSwQJI8Og=; b=qozSEuKsKqXSHLAqKpUnhyoYgQIadPy9Rflk7bNhoGhzdvG9RBADMLEKK29jmWBqTtFWoi O/KIYNnD7guQVmvDQkl8mksN82k19QrkOriuqNOWU4q6X3TyAAX55Sy8p4TJz6kmqwyZNh ZtJKU54YLOIp9yGBwTcEMVitE8tdp3g= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1733413379; a=rsa-sha256; cv=none; b=l3Z/S6+lLcoX91qHCvoKqfaNXpfpW62YzcBddwnqKvnMYHLfLVw9zHe3jyeeQmhVD9lpOL MuevrQ3MiTOlz1I69PEuAdSaOPec5+GAv+oVeSHjKtMkBKPMgnozvRGCFe7I0w+foCjxML Qu2QF3JEcUuVAjvuD8TI9oEdzpH1/TU= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=GOasxY6X; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf02.hostedemail.com: domain of ubizjak@gmail.com designates 209.85.221.42 as permitted sender) smtp.mailfrom=ubizjak@gmail.com Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-385e87b25f0so1353314f8f.0 for ; Thu, 05 Dec 2024 07:43:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1733413385; x=1734018185; 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=DJNYPM738NzsA6HHUsuEIDtHtfWH4Z1j0zTSwQJI8Og=; b=GOasxY6Xu9dc08icAKgeuHAWD6uc0f8YF1JvK3l0RfYBEi6vxPL+YEfC22uM62xdpd 3jPZU6liTny3Xk8/D8vQUyiLhWj4bAWUXYziN8sTVhrGmprHQBie5APk+2q5evgk22d4 +lczzf/vsb7cCw2CzcZRDPpb9Dh6u6KuG1QBCQqfZfMSY/eNIopi8neMraFgoWQpVokF Ya3TjPLEk7DVrccP5rURt3TLfIZP017oJQyBhwd1/lAzTqsX2e9nEcNSoeSoHwIrhh8o r8F9BH3oUrRssZ8Vo9lSrTIJSGUcpqHNFkUGMORkwcb36TeoBHDCKz6dXI7ukZm/ThR/ tokw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733413385; x=1734018185; 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=DJNYPM738NzsA6HHUsuEIDtHtfWH4Z1j0zTSwQJI8Og=; b=i3R8t0tLzKKYg/wgdBkQ0YAkaYoIDW/zN+S0jQ6faxNnYQFRMeZn7AD7zId6eGqVJh QhLiNTGU8P3SNw6Z+2aWJYp60CJ3uDU8vTDInKHF0SaGX2wEqf9Xrz6/ijULY9eh9vYB lqkHu89384a5l+b5O47TcUn1lYpYSPlGUQkMkTBOTeorgD2W43c16MkI2kYN87G3b+Hc /+L55IkWb6/4LxXVNHY6mXW2Yno+KgQthzEU2tv0XPZNosX0cvFa6k2aaPH86KthD/Z3 VVThP3OcbKji6yCtL73HIeC4SITpSn7SqCvHx+ihTNRsxXH5DOLcKWHlYJyAN0BE/5XP sjdg== X-Forwarded-Encrypted: i=1; AJvYcCVFp1QLBXqj3kObi4mtMUWgZtSert/tgjsREnmC7GCBbCjqqxDrHAlqbMwTTfiFh+6KchjFBAbpBw==@kvack.org X-Gm-Message-State: AOJu0YwfB+JY0+nZRASkonoEVrWQYBfGqPCTkOIxWZDJqDdWCYw5SJH5 YhiAj0GM6RSXRpUIR7G2Mr6mNe4MnSs5Il+dm9BeqcaK3VE/1SQd X-Gm-Gg: ASbGncs1gRAZ5a8Pn4qLKZMa0g7rk5GNKOREMyg+9ox7htccNTv7nqYN01ooEwaAsqF PvJGmyAgjFzTAYm7ndK/qjZJNLN+NbGr3g1FPckjnJufiUvwnH43eNah/pUSIYddzaIu5PRxiNG Mw/bivLNsynoSFCFcCT4wYMUI6QFJB5yaCO96vi8KseHi53onx9b3gP49vmZMjVNtD9g28ePetR 83bMgJU47EaxQjtW8YPWzrOx4DYhhDC6y0pNlF8T3oTikgmsj3zxr+iHFA= X-Google-Smtp-Source: AGHT+IGn7dKioDdwzHt7K3WXKx3wPwP6zSj6uvEE4p+BYKAxaPsN8hx7Tq/Sjh+LihcUt5zH/T9B9g== X-Received: by 2002:a05:6000:1ac7:b0:385:df84:849b with SMTP id ffacd0b85a97d-3861bb5d3d0mr2805156f8f.11.1733413384489; Thu, 05 Dec 2024 07:43:04 -0800 (PST) Received: from localhost.localdomain ([46.248.82.114]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-434da11387dsm27020185e9.30.2024.12.05.07.43.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 05 Dec 2024 07:43:04 -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 v2 5/6] percpu: Repurpose __percpu tag as a named address space qualifier Date: Thu, 5 Dec 2024 16:40:55 +0100 Message-ID: <20241205154247.43444-6-ubizjak@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20241205154247.43444-1-ubizjak@gmail.com> References: <20241205154247.43444-1-ubizjak@gmail.com> MIME-Version: 1.0 X-Stat-Signature: jz1jw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l 5DlPjAuW NWiDTahDl/dbuOyrAFCySEZ8Qc2nz9+GDnYqCrlM5pT4+vt0wURCOiMAZKuGzc6GM95HWhvdn31aCzOEZkvVBdhrdgMX72jdKerMTDawu91ynwc8K0RO0VQ1MyEpMb+ZRLQ1G6AWZlVBjS500pskmBATPY6SGMGOkrssBjlScsTiEMgA4JSedIghG+zEtD40bWInRcgsnQ4Ng0tD94TLk2D1/YVOP5481V0biZcv5ksYgzbn0fY97FOIw+haHovtm18Pq6KgpkJ6Q4XcND9BiO9fTn/9QZbt5O5sjAVdFaKTinEIsI4mMYVldDM6w6sCKY8bjKdP86NJhqXlUnmVo10HDBYYqwQonsDmKc8bSgLiJ3r4UG3bn3OdiZFsv+CG5LLoMU5aLr40EJt08xdGp0FOvleRFjAGCxjppb8fi8y3KV9ivXBIWqhoCCtskd3qGZ4sOxlns5gp/jEdYp+Ibcv/Jfc7ZQGT8TB1VEhhtUGjKoflvoxFWdLnE3gQK636duKvBXlgQOmm3g8LSdnbAHfHYAQakqcsHz9cCgiM3LBjT0FcIVaSkrqnSuoG4KOl2S4KORIrEBw0OC6FhPxURX8cuB6UcNsI7kafhQ0dmR8dH6ZQhsGfyIGGq1VzhZnz94WEEbVoZ+EeLNUwX3o1c5VdYCc8JHbiKSEoc5PNEB5AI0Lm9xp3xYJgORg1Zamrt6JthZODVmZUtwN9UtO8QLjmoImO5L+0nHA6KrSjNDi/pE2EHG9ibT8fUwmug4d432ILK 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 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 --- 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 50597b975a49..3b93b168faa1 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 variable may be declared as being relative + * to the %fs or %gs segments using __seg_fs or __seg_gs named address + * space qualifier). + */ +#ifdef __per_cpu_qual +# define per_cpu_qual __per_cpu_qual +#else +# define per_cpu_qual +#endif + #ifdef CONFIG_SMP /* diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h index 981cc3d7e3aa..877fe0c43c5d 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