From patchwork Tue Nov 26 17:21:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 13886260 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 54BC9D6552F for ; Tue, 26 Nov 2024 17:24:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 71A326B0098; Tue, 26 Nov 2024 12:24:04 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6573E6B0099; Tue, 26 Nov 2024 12:24:04 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 459EB6B009A; Tue, 26 Nov 2024 12:24:04 -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 1C7AF6B0098 for ; Tue, 26 Nov 2024 12:24:04 -0500 (EST) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id C80911C6DD0 for ; Tue, 26 Nov 2024 17:24:03 +0000 (UTC) X-FDA: 82828918956.01.7F99030 Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) by imf15.hostedemail.com (Postfix) with ESMTP id 0F70FA001B for ; Tue, 26 Nov 2024 17:23:56 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=l1GDkDf7; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf15.hostedemail.com: domain of ubizjak@gmail.com designates 209.85.208.46 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=1732641839; 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=ky+OlLkDMElBCNtIUb2edtqmSrtx7L7/4FrYNlOF0QA=; b=HiW3zE2/L31iJDXO1ISE3tcH6zQL1RoHydjkuCHrQrpqHpFXYfsDaG5PD/2XmuOsdxjM89 5QqyvhSZQ5wtIiRAdRvZB+yMUCzD8aExWPlPNCM03dVOth3xP5tHHmUV6SG9VhifU6nK/t Hgf18BkXj2c0rXlE+nQrFTnB+JC+LVA= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=l1GDkDf7; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf15.hostedemail.com: domain of ubizjak@gmail.com designates 209.85.208.46 as permitted sender) smtp.mailfrom=ubizjak@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1732641839; a=rsa-sha256; cv=none; b=M8ybQ6GqMSV2KrGY7fHnrTMZIEyKWW+ZxBkaC+sxW+jpcuDhZEfMnITtZc/EnolyMRZsk+ CdD7SzVfqI/djSWU4gj/HoZdL3lRZcdY/fSExZ0l2JMVUgqZfJ1MAF6EXIei37/klmEiXw edv2nlFpN8B/DNMB8G1tMwv2G5v4CQ8= Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-5cfcf4df87aso7509509a12.1 for ; Tue, 26 Nov 2024 09:24:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732641840; x=1733246640; 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=ky+OlLkDMElBCNtIUb2edtqmSrtx7L7/4FrYNlOF0QA=; b=l1GDkDf7XhhVn5+2AolwjS8HE8kngQm5n5lrE4DNyRxF6I0Fg7ewEJQG4paXSsQF8r gbtfqHBl6ZgfYMdEwFoES1+gA6MYsUZ7FFmyqDrfGRnDyEmzJreQbpTRDz+8AKwC4fGQ WEc43UWbfLZgp+Xzmp3jxhP697rk7LvvgWrhcxqcrOzVre6Cyi+OCkRP82+sQA9OOaFo 6WMrQn/o2ZlKltkVCXkOP7ASky4Ym9ByMuntIYCxajzY/mC/q28w93s0XbGWf1rnQV9Q A9mVCLUDvlsDvsBsomDwNm9zaRV6eBaRadArU4DM6KUqTV93JLBVHLJyrs+uUiYUW9D0 SL+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732641840; x=1733246640; 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=ky+OlLkDMElBCNtIUb2edtqmSrtx7L7/4FrYNlOF0QA=; b=xE1cCb0WQVvXCAR+4Z6qZDCKeQr/NayFBvzyzQPHuIx4CpfPOxU0ag2WhFCytjkS+d 1Z9Yyd85LPAP/Sq6PFUVVRjZiBeRpkYfcBfo8pI259OEOUlzgwABm7cWnWC/8AWivMIk m/VOygCNLEp6V/Q3xA0KPee8HXjWCbjMTTSAsfb6V5d3VtEjlXGQ65urYSLWPUlqva+z Ms7uuk7EhTEkautP0vhkONp8oFfOYT+FNpwdF1GDGB6ojyw5Vl/ElHV5z7Izdg3OW3pX WEMB11nX0ezCaxzDj4ChE6WRDCSYjR4DTaTxgoG17XM7kO/Zjj5yF56sQM+OKY1sw6Ca 5vkw== X-Forwarded-Encrypted: i=1; AJvYcCWLQ8rjf32b/ODtS9SJKSuJ/bIr/VdbqNq08JqTu2k3+qLj6tC9fL4R8gOF0wW8A9PWhr5RxVaY5g==@kvack.org X-Gm-Message-State: AOJu0Yz3z0JkQT0vCM4Vg1HCwIq1Tn+WQCIcIDU2WeHphKy2sCb9hily aMh0vCSJG7QtrUTHlKRnhKfcdmvKxfGdxj+2jCCSiHCYv0wknoV5 X-Gm-Gg: ASbGncsXTlSDxDY8v/wUDJLu65UPb2vrr+tlF4jSQCxvOdtXh1VKoxmtm2/j2X/zZAq m6BG/NC6IcDhXbnmjg8EwQzcEtcuyIHizAdj3e5x6n+iuAyipmKWrQFk8g06TauaLdRJ3eVP13C JM1nbt5EeuyG4V63iDa1tJIAUBCBomY5DjM+0Fx5qZoW/rzjtr756+4QdmM8o0EZ9FuUdEe9lMm AulxLTxS4Gu2YgBR6Kjx+yPbptq+FVQtqtT2ChEjp1gaGYU2fE7DOSpnlQ= X-Google-Smtp-Source: AGHT+IFf/RvtHifh9xfGRhKVpgriIMG2kypuYoc32969CCQP2/adNO/7HRTialB1HvpO1MqhLIyC7Q== X-Received: by 2002:a17:907:784b:b0:aa5:15ab:a5d4 with SMTP id a640c23a62f3a-aa515ababeemr1070027166b.22.1732641840123; Tue, 26 Nov 2024 09:24:00 -0800 (PST) Received: from localhost.localdomain ([46.248.82.114]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa534232086sm473832866b.42.2024.11.26.09.23.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Nov 2024 09:23:59 -0800 (PST) From: Uros Bizjak To: x86@kernel.org, linux-sparse@vger.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 , Arnd Bergmann , Thomas Gleixner , Dennis Zhou , Tejun Heo , Christoph Lameter , Linus Torvalds , Andy Lutomirski , Ingo Molnar , Luc Van Oostenryck , Nadav Amit , Brian Gerst , "H. Peter Anvin" , Peter Zijlstra Subject: [PATCH 5/6] percpu: Repurpose __percpu tag as a named address space qualifier Date: Tue, 26 Nov 2024 18:21:22 +0100 Message-ID: <20241126172332.112212-6-ubizjak@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20241126172332.112212-1-ubizjak@gmail.com> References: <20241126172332.112212-1-ubizjak@gmail.com> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 0F70FA001B X-Stat-Signature: bex7ecugd6juf3xen31ggq8n3id8j7fd X-HE-Tag: 1732641836-132567 X-HE-Meta: U2FsdGVkX19MYqwfotO+3Xb0/6Phh19KiW/52q4vOmVLhqIhZG3f2p1j5gf1Wn/CQghxx/ZiQNl2jR1TVhiF4pXao9lJs9wm1V6qettBoA62E0X4E3UQw3D2D+eh7lqF6KYuCJa3ocjLP8N573GN2AQelGgkYTvKotRhArFffPEP/2QZRM+hIJfosigV15D9fTRZAP2mgubfs6DPE/v7cHB7vzOKE1IFSOmtShuiKSPcgBIIIEqhHzZyFb/u0cXb6W8a+aNsmWL3EetHhPLkukYzQ1lKQlf0HE9HVhFTuLHm4NHq7FwCcCz5idUyaKb+4bN6ducHCuefOBAi2640sXp04Q4cL7DUFkl8V2RLoxCm+lYd8g61Qpew/dTN7Eq+5wGu74STNAhnOo8aKOvae+CIdIjwHkyFA463DAU/DtE+atk3ML1tOZnk3bOwFy39KouV85yV+he/eB91Fe9UiIYcG+6zriiVJUFe3FUHdjUc7GuAySRzPqbmXSHLsjlOuLiP02T+rPM9+NRREuyBGc43XF03bIQfovwAqPLK8pmSLKYasea3lQAgKF7uzi42tSkBn9lfEPpn/2R4WKGdPxFDSCig4OKWmkYQnFuNC+tqN4gMZD25EZyNp7a0Wn+c2smP1Dj6EfR1GjK53afbkvvYpPe4GcQ+48hLe+8UmpG5CdUXfLioBvL+xGdrwJOwJ4SM6th5C62waRRkNBUrsTCpQSvcmXxaL0dvrT4fiEj6PcLqh26rbR4jFvQWa65wqQI1MkmGQWrHpQe4qq9qoqWUbhQzxMGFTQuiWgb1yZAblw68zzuUDw1Atz50kV/WgWj9WtxT9B+btBG25OkSEXtKhhqWqX+RDfgBzIz/KzkIZL7Y83lvK3DPG0afIzibCxykZUZ038IjunNbJETjPBeQKRR6Ys1DjOfPO7xuLSBOHjxsW5X5Z3FnFdrRVPAU58L99SGGjWXRrvklJEM 3GSYcIgv sPbFWvg5SinHWw0YijH6GbJbpoZ71/rBwJ2Oao54PIHPlOQGlFqt458uJlv4fH+73kXZ0O1+wC9Vx/kn++/o8KEP4JVN2fJbI5P29xNuxGNHvx0+oPx9e+q6/TO5MjXpn7dkJwNXnx/ZuKF6qzmJ5bmpnIotHAr5R95+hRtSSa4BJPCnMlKyXSlCk27VxQujiWgdkOUjuqwEuf80+9XykmkSTB/1RRtLysQOsJcvrTovrkCWCkQvlmKu5wcTa5qsrDndvtT7fncIT9lficl5HKWnmx/gL0wSdkxJU0VA+tnSSqONyy3HW7LOWu/7kO6CJKNngH3fAkCGUA/1cwis11DG6esn37KJbndONSDTIvn5cK8xbPCZxKjLSQAxLqWdB4rcRwUrFtBIz2Yg6b198mSKFaX9jb06lMibsgLR2dj65yG3cJ82o61LWYypn0/1SrFFLIW/WlUOw0Pg76wchEgdGzs62dH880brxUF7kTpdxRXJmNN6g6Hb/UNnqdq6xPNo/ai/xT9o2yBU/RHfJOJbqsOykS44KbJkIVTs673tmYRd5C9klEg4+FzIa4oStCWTjIB1U6MdST66OqwhV4XME2q9stUcOHPvzO2FshKFOMG0ryZfikf96gTXhXMdOwY8vXspqef4dWMYUMGnQVZUdiom0Eo4QWBe16sx8kHRvr+/8W55wE79oCIxhO37Ct5VhReCo7cwwwig5tM1vVsFti4OSDvbAoi5PIxNVozNB9O2KFcFrFYRK5Y9acd3r7Ci7 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: Arnd Bergmann Cc: Thomas Gleixner Cc: Dennis Zhou Cc: Tejun Heo Cc: Christoph Lameter Cc: Linus Torvalds Cc: Andy Lutomirski Cc: Ingo Molnar Cc: Luc Van Oostenryck Cc: Nadav Amit 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