From patchwork Mon Jan 27 16:05:09 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 13951593 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 24F01C0218C for ; Mon, 27 Jan 2025 16:07:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 92C55280115; Mon, 27 Jan 2025 11:07:32 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8B48A6B0160; Mon, 27 Jan 2025 11:07:32 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6E082280115; Mon, 27 Jan 2025 11:07:32 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 491CB6B015F for ; Mon, 27 Jan 2025 11:07:32 -0500 (EST) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 0A5FC14014F for ; Mon, 27 Jan 2025 16:07:32 +0000 (UTC) X-FDA: 83053711944.24.93A1A86 Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.49]) by imf14.hostedemail.com (Postfix) with ESMTP id 09D9C100020 for ; Mon, 27 Jan 2025 16:07:29 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=i8he+5mf; spf=pass (imf14.hostedemail.com: domain of ubizjak@gmail.com designates 209.85.218.49 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=1737994050; 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=Rs28O5wqzH0MY94jpgUf/h1gxLQ7upqlIUkB+EXa9xaZaI1vcJJGZgCM2r+nhda2UDtzCJ K5TW4QQGs4hi6ct1nrtElaFyW3j93JTu0jE0DJSHaylb4eSD8waKkoRKy8kzgWGrGc78AB ktwtpRIVy7XlVA6ke/vII8GZxt0TTuo= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=i8he+5mf; spf=pass (imf14.hostedemail.com: domain of ubizjak@gmail.com designates 209.85.218.49 as permitted sender) smtp.mailfrom=ubizjak@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1737994050; a=rsa-sha256; cv=none; b=6oqvdoIYbJrDFk3SIrcPlB3A/6UctOXrZMzaD1NBiGxBC4f8gLKjq0xWBpAAIUVFWmadDx 0jB+XWw6r80pdFC1uhelPnd+CkyTzERJ1wO1HFy28L0e3X3lWCxr+eEsPNCR8aI3nIoWKj v5yazt+dlvUljXDyGSdsIruUbFRa1RA= Received: by mail-ej1-f49.google.com with SMTP id a640c23a62f3a-ab633d9582aso823278866b.1 for ; Mon, 27 Jan 2025 08:07:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1737994048; x=1738598848; 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=i8he+5mfWgR4MNMNhz2e70GUY1QkBEAnyWScheb/EyL3/45V40SF5Zjkm2qEKsHPZu OeKDEjh/NNEgxS4wEaPLck1DPSwtC8KAqAkLfHg5XfuHsIENE6e+mKdOvJxo5rF8XZJG 9luv8FqedndOv3XAiA6om9QPIu0T3+8cwK87dr6wi+EAPMc2YBz5dhMHKiTEy/t/hG+9 zqTFAe3FMuXOgiqcT6B7r9gykvesf1qIMYtRYWUqoJQjgDNg5mPpxOPhQcCn2FCNQjg2 wQM6ccDeLelGZFQtm2R60NT5EI196CQxcPVloh+Zcq5kVH1LCPZI/DcD7/9XObJC2pTR xv3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737994048; x=1738598848; 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=PUkXOZGVI8Saa4BK1eWfcaqWqwdxbddipdf/JJOFC4UayhrwYRBK8fROAxf2iYTkAJ aZR/0cWhxMet1y606nIosC3Tfbt3jbF0lKDLrIev19yPdV1qwvx+js1dg+yvskKsXZx9 x1e+ULGTGbLoiAYWtECFyFpKX2yzhrNLGv+gzpJDVlAC7GQR6KqkEVHkHIpmlEtg/w5g kuyu6rCrgf7vmnr2clFH9t4HFP4VfUaaFnLB/Xj1/eUxPiX5YsMsGZLUUu8M+hRrPbDc y5VfgfGBiQAvZrDmKEytmyDV+4AyFRit7Smvh1HgGY4S4S05vMW6fwapT2VcLpI8Jjjo 8UqQ== X-Forwarded-Encrypted: i=1; AJvYcCVAhwzlcRNemSfcpieqPL6bGAHh0t7xJd9I6Rm8K+5bfgKP7qcj31HPXb/aT3I+5wmf+ywSXDGN1A==@kvack.org X-Gm-Message-State: AOJu0YwDzO5C/FOAamWiDnm/fDVubs9d8VQgwYKyCln0Uwbx0gI+arSv SFxEX9gLzkbGbCIvfaDlt084YQ06uX7bXKUTC5CpV/49T3OIFBAJ X-Gm-Gg: ASbGncv8NzfMsnranQfWsVMOFU3TkKNuzYaaRRXurVJyAv9wS9d9vxEMQqneW9FBUKN rkcFw3zaaFfz6/SXcxEXUIjie8+FFxkg5DC0AgNvQus5WUdgp78aUbpj3mrgvvzyiCRmEQG6L22 pby8gOmhiH2SpMfPB0cQVs9Ery8A73F+iDxa/C283hMl7awKAOObQ9Mlo0I5VnvQFZHCd6QjbzX 0KYQ5YzCZ/NGzHEMbR2zdOEwKj/QEzGf4O260HTjz0cA9ygRss9pTVmxD0bT6AumFLK+yNHcp1J f0Hdwmu9sJkPTw== X-Google-Smtp-Source: AGHT+IFAuvcto44xbfJbzToMqvasWkjx8mJOE7NNj1gZKmPQ5KI6lBKJIGSybMmZDHGSQog3h29n+w== X-Received: by 2002:a17:907:1c19:b0:aa6:acd6:b30d with SMTP id a640c23a62f3a-ab38b4c63f2mr3942830466b.48.1737994048224; Mon, 27 Jan 2025 08:07:28 -0800 (PST) Received: from localhost.localdomain ([46.248.82.114]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-ab675e8b01asm592643866b.84.2025.01.27.08.07.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jan 2025 08:07:27 -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 v4 5/6] percpu: Repurpose __percpu tag as a named address space qualifier Date: Mon, 27 Jan 2025 17:05:09 +0100 Message-ID: <20250127160709.80604-6-ubizjak@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20250127160709.80604-1-ubizjak@gmail.com> References: <20250127160709.80604-1-ubizjak@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 09D9C100020 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: xmomhmakg13e7es1ykk5k65arqmf8oak X-HE-Tag: 1737994049-25067 X-HE-Meta: U2FsdGVkX18u6meUnHmR3jJnwKCrG6UGa7BI5DT34B/XAl+6I/g2UeeHxFHYm3ax/3Y1ehQN/JW7iKQCknwkdILYi3SdAzG8pJIUSrT0MMZdPVOqF75t9qIQxnQUH8eB9IxgkBIuzgHmqYP19KEPVgFF7xTEB/6HvnwdQCe2kbkWFVq6thCt4YC9c0R/Ni+knHm8dWpM/CW/gZYKV1LD+xtrNA3dJNnQFHtUk/Jjym3yWMXzeBaNLw+X/xT+afX82ZOvn46TWjYWFEAw2w2qqex95iyxFST1T8+utG/0zMPLuYmlEO1++jL789IW96Y7XPI4nIPCe2eDDT6S12Mnmq806jHVzG+W8h+dHsHUDRbIoBOCcA4xRB/rUauQhv7M2L+ikpM8oN7QU8BRPljmugHE8mbXo7EiVGjnVhb/Bc9deIVQL/haQW/Y2Fv80ayuKK+v1MrL3Yufom/Og4we5WmiUaxfe1Eb9VA9JuwMLacMabvKqKbfuTL/+MHbqhEqHO6moRVnhCstdjO+12pOgHvBE0CkpPAaT6c1fy6X4P7NIGhtT31J66HPyB++YYPs7rIki99SfHalStccFKuA4/pKIajVzD9SbkkO61ZYEkgWTn12STazL28yYGE8CRnHs9eVLTkGAFTICORiIcUcL3JQST9nfwCSB+GINW0r7wY3Cj1M6pDxU53yNcyjmUuXNMbj6y5E+ZtaOHT3NcMcPBoWDqYkhRgpoVyJuivjD51ZIbHEeHgyEUobj+/hJGphxE97BGcwJgbq4qEhWvmA5YcyMT5A4dTF464gy3iCHGVvg4xYtryS2OxhSeuiqsK0sKTdCUNXiddtVR17GAEx1gLn/68v0hiZxilnU0QupMITcY5kI9T0gHfB4Ai7o4+CBXKrdz6SUyEc0UDVA1dnP0R22ciMUxRSWPZmzCkAFpoygJD+9uVfEvAEtOwqHqw7NE6RhUPS92yi6DHLbA+ yejvR/kq wq4ExQRYmFx9DqDUkdCWATe5r3Gdk74AGZvgudFlFM1nDV/kwGL7R4LD9y1I6DPtPtF0jW5lUxNsxMu5NB5xc15a2cCRDmsfFqBt4Su4bjZ3IoaaYhIVctRZnUtZ8DVtb7G5a4EOHJVtXYc3AHtdJPuJjx5gptqUAZY+TKCo5x0VjNNv1pnNbucSxabtsW0WXlqXEeOvihwPkqSIBBYISFb26aDT8o14tSRSEI6vwAa1R8r1rawrOa0nw7gF0wj71Ds68tgaund7FV/DPTU7xSzvSvUg5DsXx8oq7TvBof6y6Yt3g9SDMirloOaDeIDZ5TlgFJ1d7pXy8kWjodcT5V+RFIDzkLVLNNNzRK545kT7cCj3vcY/Vtlwj4a9wqhOotSZnOfFxXUkMdMocbSJg6Ut6oAZUhihi0nsJ6zknayC+lRRfhSpJy4wg68xwou0dGTzosRpQeQ/WYK5inQU+/HEU/rATob3nfcaWHWBADllHBXzfZuqEk6CFNp2rko7X8YVl/YjlPN4KtpX99Q0HCIUBJ8jByWQGZ83tj8RGMA0lfGq5cCvI4q7m9AMkbq1KLPp/si0BqabppL+PAFHe3CZXfJvi+DmutvgqH/B8rcn29LJ/A28b0rQLt4FaT8bxknfUoQjVlL+BKkyXylYMlz8+/88pIOORBD7sytVtBbb0JuXEWq2cdxTCvyBW+vOiLeZAd0Krqi96qOm6DXPkq4qVc0bGcniWWy1cuMAzVwrVPdMyOVzYYlGJP5Wg10jRi/z6 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