From patchwork Tue Nov 26 17:21:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 13886256 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 D9D4AD65532 for ; Tue, 26 Nov 2024 17:23:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4820F6B0092; Tue, 26 Nov 2024 12:23:59 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 40A896B008C; Tue, 26 Nov 2024 12:23:59 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 283176B0092; Tue, 26 Nov 2024 12:23:59 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 053746B0088 for ; Tue, 26 Nov 2024 12:23:58 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 3FD03AE6F3 for ; Tue, 26 Nov 2024 17:23:58 +0000 (UTC) X-FDA: 82828918746.08.84739AE Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) by imf03.hostedemail.com (Postfix) with ESMTP id 25D432000F for ; Tue, 26 Nov 2024 17:23:53 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=YC40IouI; spf=pass (imf03.hostedemail.com: domain of ubizjak@gmail.com designates 209.85.167.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=1732641831; 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=n5NofcZHiN/mPTufbVMAYbTQYvMqATiuy7cs+7+mqOw=; b=FfUh779c9bF71xhpoRHFzpCFpwWxNH/zNRwovMXso/EBWqA1dWJ7hhv8N6ywBSIoS+7ZWC BlnYqH7s91wi7T9QIU1mCFtV2thR6LRtc1QbBMj5nBQ0AHn1Q2vUH/PmBAfIxpNSis6ymk 83JgKa3NiU7NqYzcjBv3GbQwehOBLtg= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=YC40IouI; spf=pass (imf03.hostedemail.com: domain of ubizjak@gmail.com designates 209.85.167.44 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=1732641831; a=rsa-sha256; cv=none; b=ifPkSZbr7ZwjjwT0QRi6J2+KjAoEAp4AbsTCX0Md39qpxGwvjtggzZ2ocTbQiUAhd4Y3fL LaJFTNczUKRRGmplGnIeuXEnvTkAAKgyRP3wAkm0HS70tppOXZpcyuws4PkcnyQQcXtF2B uHg5GwdY5F2y6gdzF7wZlISmEHruyC8= Received: by mail-lf1-f44.google.com with SMTP id 2adb3069b0e04-53de79c2be4so2146075e87.2 for ; Tue, 26 Nov 2024 09:23:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732641834; x=1733246634; 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=n5NofcZHiN/mPTufbVMAYbTQYvMqATiuy7cs+7+mqOw=; b=YC40IouIPj/EQH11jPkaJ6GcIdHvAn4+qujoFjohA/KWdUr2lmOCN7jx7XB9FTzHzu +tsYqSJp6Q+gUxG1sP4VGqhDCFzh3npwXP0pHLJ60VWe/lCEqyaW0D43N0K0MfB64oZ+ aG2LKSITiXpxY/P8QgdnO/EkLrgJZnHUBRtfLqZarArep0Oc+kP1Np3y4ZFowdHzQ2rl gZGCcaXFod1bgI2jJqMFjNRVlienMBf23FUhzAHWMijdhCF10/ghTrFgzza4d1dLATm+ m6ATaVj0h8+I0bZJ5LViA3nkxVBPOhvfBO2Kd6uOoiZJQ6Ti41vf3/RJAOozJPxd5D8g sCJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732641834; x=1733246634; 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=n5NofcZHiN/mPTufbVMAYbTQYvMqATiuy7cs+7+mqOw=; b=K0efsRLmFKFnC5hfCYPZIfOv+YBMw0LMaCFpeNigZ0yvMqHA/Xr5DAfUJBMEvNMr2f mwhUHTJo+8o3b8Y7b79X/EtxW+uTuCFcMtEbbV1cDGDe6hbDYbdIdzaKQKye88vyvBOV hNQ+RVtK+NP2lQ2etf6JxLaR6cJD39LtAjvMtP0ictWoXFQ3x/0831Szmh/iselsljoP kVw8QGntSHVIFeMSU5PlqEnFSpH1nZnDF2I6YtvbEzDQ2Ke0LswEW3keLU7z4OsYD5jl 14Y3jAKRAhmJkLxp7Db5OUf7x1hqDCpzza+xxUAzQDlW47sXNlt0vAOSezPSE1RukadU +h5Q== X-Forwarded-Encrypted: i=1; AJvYcCXu58cLkl6rNXhS7LTQFx+xaNfy3pQYskDbWTKxsP7dTb2rb4+lLX1FXg0Z1+4VH+XySDtjENZoDw==@kvack.org X-Gm-Message-State: AOJu0YzRz6T5Ew6atTaoP+IT9uu92SUHZ+DC92y41z+wQjVvc/sQbYRr VVvWR+ExdmSJ4Rm0N6lx17M1CWnljHCIgVIrEtLLcyux3Y+iEmPP X-Gm-Gg: ASbGncuXE5E3Xkm6R88ofzkTq5YYNVaMS9o5sewi88f3It5trN/Gihx7QBRh/uNj81K z/ci8PMp+ZmrC/c2SQ2ESPFz52wAegm86/DhKk0xB3vKAgfqu9vhu9Fs9wL7pHmo8tNQj6a54N7 KN2uYQsmAdOnD5cAGlDSXrsDD+jtwZ1uZ3IM7pfsdKihnBIuVH3idFG+cXIyO1SVjadLA0qH0pa ycpLP/HTq9yRiPBJBWsU0fAWvXA1cX6L4cEjdFUK2vRea3YpEidx8TAKdk= X-Google-Smtp-Source: AGHT+IFIkpku7uKl9KKAwOvhvPeOWflgDevT092ovp6tlkSzp8pl+CUkXBrRACuxkb0yqjHw9Xdg0g== X-Received: by 2002:a05:6512:3ba2:b0:53d:a012:efe3 with SMTP id 2adb3069b0e04-53dd35a4ccemr9018215e87.11.1732641834066; Tue, 26 Nov 2024 09:23:54 -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.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Nov 2024 09:23:53 -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 , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Dennis Zhou , Tejun Heo , Christoph Lameter , Linus Torvalds , Andy Lutomirski , Luc Van Oostenryck , Nadav Amit , Brian Gerst , Peter Zijlstra Subject: [PATCH 1/6] x86/kgdb: Use IS_ERR_PCPU() macro Date: Tue, 26 Nov 2024 18:21:18 +0100 Message-ID: <20241126172332.112212-2-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-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 25D432000F X-Stat-Signature: bnohcnmsomx3a5s65m3bxx5imnx95kn4 X-Rspam-User: X-HE-Tag: 1732641833-871111 X-HE-Meta: U2FsdGVkX19ldoF5wTvXdbVR3pVVgwEM8/FzZu4KualRXWBpjVfTnB9AOdwiq5X2HQVy/potYqMdXqARsuKLUiF7KS+Cyw8wySE6TAELbso6GU+N1AOKSpA+IeKpCnKGZwF3yISxa9nTtT2dzm4LkWJULnLfdnS8AB+SIsOQF0nK21Re6VaPeoRTc2Lm7EodNC9reNmnbD8yomG+VzpDsaRyJH4o3MDNP2uHGjoe4BJBINMlughfgvkvvukOGhCpdCQxXffn+SVrT1D6IF4NXM1y+/xOb7v/wQQS719Us23M2rixffVKu8Rtf/5BFnYKuMfSaHMe5biOETNhZ/9+4KCH57j639ZnV82QVrzXCC+V7KFoH0pwjYWVLN/b3EPLY1McXe6FoScQDQTvyQypUgq0hDkbpblAu/CvtV7k9jLxgV2bavNTBjQJsXCdb0rAcvw8wU4NqD1d//Yym9Zv5n/K3sOFXL/LOasLPx1dlcjxJFVEtFVHoZFvovjjJuUiNS53OPGDGFLJgFXLV9aGP91hWlnK83bJdVww/whJeliBuJ2ZDlhgOcw71+0r3IdYZ8WoupeOgjuPBw9JFTJhqi3c1d1qGwpVodV/rLSpPLKZ/MbenaI35+UgnM0syCns4m6vgEbchsbyzQlAjhhp7ybpBA+Xd4K3OcJrhzCle3xd3sRE606BD1H7Fzm963j/ws0B6yvGtUOHHPH4hHRrnC+IVlQn/KtpVjqS6bY+7rIaD463MIkk+NEZghGXte8lKr3oSxxQLEKNt+tEP/JdD0takatm0pVCMNyoNcjNGiGMV8KJ6/DshZsnkM4NBFBbAErHG9CE6+IN7FCvN32quDU8gWP6j/LZspAWBE51ljk8AH/Y5R8SsuvJ+cqHmWPDD6tpTjh07H63E9Bcf5PYrEdrFyfmTpOByeIlQi6YvgKxh//jMAXEyr6HKSOCERxiUlQTLZf7M63e7b9pAjM x4HGxkvQ vrk3fziGKBKjeLvcdb5e5FytLdrGYfPK4JPUAFhMDYZxBfl6PvYx8lHBJkkjLb4+0sZXIE3vQ3syKGj70vG3T4wfZaFljKNkuuunSGz//BYp1GunRxTydyS/jpYx3s5hFJUVH/CFUGpYLLzR8jJ6akdyvrOVbfR2Y9g/9AATGuJ9PS3wJT87/NCsv+118j+AHVj9zu+CTMi7l7sJIadRJaxfBdu72SHykOTAvEKYelIks5okvORG/tD75iMCnWgcEiIbciQisu8tnFHndoQEsrUB89UsQfMsntjKIv3jjy5CXXo6pOuUPQJPllWWV9br8dX7S9eazCmy5nvklvHPCWI4Cq7nMyy7AERh0EupRe32T2EX83UA6Ew52xSj7Cm9WMC9DFty9mbWA8f/ckLnTevhZYVsiWzgt9ztiAw9Yrwum6HGHWgJMx9kNc2oAUaQYub6KV0sdiMymyqDvywO03TCpEt+txf4AkBE8Pn7b1tw7EjjAydo5nYZuxTQKOG9z+dPChKim9On7z12UpkCF7+uT7/sBM9sGZ5kEexgUJx/n/+cMHnW8FVrPhbj/KAWnsObutnTU3C7iUNi33oJmDyPPQgk6YwdESCKXnCoMKyX20jeeKrNFxgSpZBzA3vHWRUdho8D0WjhxPPRdyRn/GfWSoFa5IEcRaGOtNFYAfdn8FxHTO8uaUicJjruKrcQFGFKxx3LTFczWh19qs/fIeS/6c9QPmoSOig2SfEFtdT9jBQDtY22YeAX2JuQyN5m8HhtfTyNKC6k7VBKH2FHrxfT/GA== 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: Use IS_ERR_PCPU() when checking the error pointer in the percpu address space. This macro adds intermediate cast to unsigned long when switching named address spaces. The patch will avoid future build errors due to pointer address space mismatch with enabled strict percpu address space checks. Signed-off-by: Uros Bizjak Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: "H. Peter Anvin" Cc: Dennis Zhou Cc: Tejun Heo Cc: Christoph Lameter Cc: Linus Torvalds Cc: Andy Lutomirski Cc: Luc Van Oostenryck Cc: Nadav Amit Cc: Brian Gerst Cc: Peter Zijlstra --- arch/x86/kernel/kgdb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/kgdb.c b/arch/x86/kernel/kgdb.c index 9c9faa1634fb..102641fd2172 100644 --- a/arch/x86/kernel/kgdb.c +++ b/arch/x86/kernel/kgdb.c @@ -655,7 +655,7 @@ void kgdb_arch_late(void) if (breakinfo[i].pev) continue; breakinfo[i].pev = register_wide_hw_breakpoint(&attr, NULL, NULL); - if (IS_ERR((void * __force)breakinfo[i].pev)) { + if (IS_ERR_PCPU(breakinfo[i].pev)) { printk(KERN_ERR "kgdb: Could not allocate hw" "breakpoints\nDisabling the kernel debugger\n"); breakinfo[i].pev = NULL; From patchwork Tue Nov 26 17:21:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 13886257 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 83969D6552F for ; Tue, 26 Nov 2024 17:24:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9DB456B0088; Tue, 26 Nov 2024 12:23:59 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9880B6B0093; Tue, 26 Nov 2024 12:23:59 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 801346B0095; Tue, 26 Nov 2024 12:23:59 -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 604A56B0088 for ; Tue, 26 Nov 2024 12:23:59 -0500 (EST) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 065E941438 for ; Tue, 26 Nov 2024 17:23:59 +0000 (UTC) X-FDA: 82828918914.14.92B116B Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48]) by imf04.hostedemail.com (Postfix) with ESMTP id 2C2014001D for ; Tue, 26 Nov 2024 17:23:50 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=evRvvzKW; spf=pass (imf04.hostedemail.com: domain of ubizjak@gmail.com designates 209.85.218.48 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=1732641835; 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=scK7sUlNwfpZu+VLLnedXLuF+xaa2OfJ8eCpocRXk/o=; b=XQhSa/txnJUWOZnyf0naepeufnigt9mfR1qbMCkrQ8MrH5EGWJptFU9y5WiHHAoOCbrfM3 wsv15bM2uxiEPdnxmM5Pm1z/i7GpfHX62id8q2Twq2RoKYqMMXJlLW3XEky/+7EaiU4TwK LYcxcdc9wd5zvDv/KM9QH+q04lxXkAU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1732641835; a=rsa-sha256; cv=none; b=hy4D1w5Ca5QYH6NUfCKlBWyAAXWrOAXtHAPYH7klqOzJws6j8T9u99A0NpLbl3lp0uBHS0 c8O+jEgBHPDpxLMtXK8k843PGyq3hRKVzFry7JamPAm+YhxIu14+gxpu4NvUjV9nl4xr37 Y5BUXeMuYQ+YT3LIKKmwGE4JMQ7T63w= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=evRvvzKW; spf=pass (imf04.hostedemail.com: domain of ubizjak@gmail.com designates 209.85.218.48 as permitted sender) smtp.mailfrom=ubizjak@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-ej1-f48.google.com with SMTP id a640c23a62f3a-aa543c4db92so424189966b.0 for ; Tue, 26 Nov 2024 09:23:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732641835; x=1733246635; 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=scK7sUlNwfpZu+VLLnedXLuF+xaa2OfJ8eCpocRXk/o=; b=evRvvzKWl31QuZBdsWt97TLEUl3a79VPy1obkNl2HkyKtIAfRA0/EyLWf9oyAPYp9M ZKyP1clswoqNNFWGp/NIOXzuEcFX4mm0sSMCm/NH22oQD9E8yeljmWwa7r87mVRGDFo1 +cVdMWYSqyYBRyeMSH7DIf1A5vGuvj8EV6xfdaBruDqyMMnmIpah0+8WRDoCXwD68VKr W0NXxRi4Ddi+8814SBg+1SLYT+kbbQC4EFT1/MNhmL/dxsF/k+CqEeTjwNOvET+iIorF mqGYWVGasrMQkGSEghlhr7fl58eLmJahdqiLDVpS18gqclxbG/sM73niDbLOT8W51jvW DFyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732641835; x=1733246635; 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=scK7sUlNwfpZu+VLLnedXLuF+xaa2OfJ8eCpocRXk/o=; b=OV3H2bIW/1u5shStSPw0sO4IybMsAJ6Ajm+IsmJPzMwBx8/VlDwsQ7JEyKBLyNzFot 7chxJxdrGHbPlGmoVdkzDHDwUcgz52eNHcAIIhQQUkLsjB8siwEHFjzBKdh9/Pp+bng7 QEhmMfpbEQG+csipCOZxanjFjuHiOVwAJfPqOAg2HkSmlvdiPUYe9d4JNxDGbqD6ny85 ZNySHVQzaQZM1ieu8PRGFNks2iCAEBFAEjcC7ONjoVrRyqUUMZHqukN7LUYYikxXYz6F MKRzYWDLy7OTJze4rRWkFtWYDffu2BatT0neWWKA/HJ8dCpgnxgVx6oLSX+QE4g1yDZT JVVg== X-Forwarded-Encrypted: i=1; AJvYcCXZQYXQbwur5+QoZLBsecQx/3SS0rDA2OTzAEkGUH4v6Ncqgviz25zNKY9io088dnxSnlWoGo8Tvg==@kvack.org X-Gm-Message-State: AOJu0YznV+L02UlAds57eI5fQN/nbrDXkKjM5vDed9rw/a2GPWawHRZU adj+FvUz2RGXaomoN0mlnEYi5zVcH0Oe4bbzV231iDhZ7/lIPRXq X-Gm-Gg: ASbGncsucd0wQV8YZ/C7MuNTluVHBIrsS/u+Co4e24z6Bf7ih5NK+VoRfU8SvXqepsx xUV8LgmyKlYfw6NjP8Hh2SYa14z6Ka7/8PfK3wyRv+7AaTN4k8SNloyrizd9KYKsfrhFZM7eEzD 82GtGSJGyO/ZrOQ+OQdn52Ufy664fquHBuGo9CdZD9VGBD9wRT4RvviWOmUTC7p4u1XAe6Cpnc3 7Rs9x/jjHwt0Y0cee44FvbvfNitLKl7Cl2Xl+N9LdsxOtptUquNs+3SP2U= X-Google-Smtp-Source: AGHT+IFUI0YUp1+RBJSqcGYBOc1FhgIJEm5xni8unk9E56g4XY//7qbTg95Zcg5DcOFquH1FM+TtEQ== X-Received: by 2002:a17:906:1daa:b0:aa5:3748:2ee3 with SMTP id a640c23a62f3a-aa537483463mr1076090466b.50.1732641835429; Tue, 26 Nov 2024 09:23:55 -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.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Nov 2024 09:23:55 -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 , Luc Van Oostenryck , Thomas Gleixner , Dennis Zhou , Tejun Heo , Christoph Lameter , Linus Torvalds , Andy Lutomirski , Ingo Molnar , Nadav Amit , Brian Gerst , Denys Vlasenko , "H. Peter Anvin" Subject: [PATCH 2/6] compiler.h: Introduce TYPEOF_UNQUAL() macro Date: Tue, 26 Nov 2024 18:21:19 +0100 Message-ID: <20241126172332.112212-3-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-Rspamd-Server: rspam10 X-Stat-Signature: xraqx8xqnp3ni73hduo9p3ohnsf5f6a8 X-Rspamd-Queue-Id: 2C2014001D X-Rspam-User: X-HE-Tag: 1732641830-625046 X-HE-Meta: U2FsdGVkX18PtEVZjVTeYIZvDfc8Q+jv5pvBBShn3pk+z0u5LkFGlGnIRABagCBDRnv58bvm6zSG27PHub13uKVTMpO5gLqiRstkX4tpmeuDWnjqeXWbHqq7VnIujpaGODdF0bErZVQ7sr1G6FRy1LcFA0DcUbyOyl9L+Y6DWk1XABAMMJ9c83uBK3BrigINWLNOmxudKjUrjdQcd9iUG9ElSr+V6LrhCWGZJlTCUaPOXGlLfeRL7OCxQrKFCunQAWGB9ahOg6wAquFmFFrVW/gGT2CB11gCtxnGXc7a4LRu9y7BGT9kcocGn6ymXdp5kEiXJbtXQzxDR3mRwscLMgm1tBfV1lMQMH5cPnDCYysZSR/bEYEVZ4nlXR7xCACZg6TzKgS+Q1KD42fhSFovLfyV8kRb0UrTOJdcdCnjnqyeR3uEXMH/0a5p2OXbwQ8FLdQPXCjHTAcIp/V+UqU6FafOB3hYhwgN+KvCrbR4KYEQqRIE3nlwA0A/Zairx2R7ENt+uZmjOR54kXt8inBUiyDPJmN9GMFnbTaW5xnpj3Uw19ZwbarVw+l3kz38+3WoIjRHtB57R8nLrw/QqBSPUK0WPKFTLMjxrfg5EDOEyN9f6KTSxgVWwcchTeBeSK8akkI3MVb67ksAoWy0anLxdreYUStM7dPbHk/RP2jzTlaKpcVkCCowqf2iWkNXFoklgf1e7DDLO2Sa+0DJvXCHxePg78dwVZ7BL0Ml+dFewpOzHdKPeLBMKtVtUzs6doQ9KcH0hkRLUJCiNM7FZAgSuFjg0YIImqKOUfdP3nAIvcMF17SljLw52D7HwrGqFluTlQL4+9LJhUvxeXv4j3RuuQfg3BLvAv2GHaHtj4+FlD8R9zvF22EkjXVvbQkp27oYvwClNCaL9zSGCmy6QNnREqy9XB/E91up24w4damn4xZ157l2DhJxdh11h7gf5kFe6wLyrm6sHYvaR3J4WBM h26t4eUJ FEa+jnjRgfZgIEnJpMj+mAoPTTtmlpb3msI1Tmmb0evZpQlSFUfpxqdW+fdqGdAkwwuRDQBX64rke41AYRbixFVkxk1VyjPam6tHUkbiZKHPeeuBoNmhquCRLkZx+h1uDJz9XTmW/0Q3rfmkGj7m2dqkptqbfhm+Ul7cJrT1ZPsOQQIOMZDXmwM7O0r2omv6zfZPGIfKsGAdbWhWkQE98YLMkyy22PBhdGGDkdfeCMfTJfUfvqMcduIK3OiXPzw63kiKDreOYvd7fPap0d50lYvcEPq+QBoj18IYgz6HPpkDWjLqxpITtGDvcmA/oZrAXgOQv8LktERHRXd5wo4AiOTminrr8Xm/Ki06eOUGDuT2F0n+8Xc5/LSwb72Wnr7Ya3s8WbFqOZUgc8l2gIZUwevRDsPqkjZtoOAIfgAZ5L/36h6a4IJvu+WDxhnx1RoHzn953dTHXiHyqLyUWkvnVJzqvicxuKbe30hVIc3TFguNDD0BpwC8Eo/qWdlMrGjYHQHpI4J4FsCUbMcjPwbczJ92H4+M2DNqtBM70MfK+N41WEIRhe3DaCFxoGWaoZaGfO2Vh5fE2ihqvvumhODoNy1ELZnRqyyBml7Nxiq1BvQDgGDJcPrThepLRIM9JzwOiOIai7+HozDxDynXXyQDnE3NSshV7e5K4vhIrx/o9tn9wFctZ44FhyhWmDIfRaaA5jnQEUr40LB5BEPZ5hWaSzzh7PrVhbnXS0Ew1kTrlziYolWfpidLTZ93EudqsfZH+M0UcNQpaiA6KPeloGK3WbooyqA== 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: Define TYPEOF_UNQUAL() to use __typeof_unqual__() as typeof operator when available, to return unqualified type of the expression. Current version of sparse doesn't know anything about __typeof_unqual__() operator. Avoid the usage of __typeof_unqual__() when sparse checking is active to prevent sparse errors with unknowing keyword. Signed-off-by: Uros Bizjak Cc: Luc Van Oostenryck Cc: Thomas Gleixner Cc: Dennis Zhou Cc: Tejun Heo Cc: Christoph Lameter Cc: Linus Torvalds Cc: Andy Lutomirski Cc: Ingo Molnar Cc: Nadav Amit Cc: Brian Gerst Cc: Denys Vlasenko Cc: "H. Peter Anvin" Cc: Peter Zijlstra #endif /* __LINUX_COMPILER_H */ diff --git a/init/Kconfig b/init/Kconfig index a20e6efd3f0f..c1f9eb3d5f2e 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -894,6 +894,9 @@ config ARCH_WANT_BATCHED_UNMAP_TLB_FLUSH config CC_HAS_INT128 def_bool !$(cc-option,$(m64-flag) -D__SIZEOF_INT128__=0) && 64BIT +config CC_HAS_TYPEOF_UNQUAL + def_bool $(success,echo 'int foo (int a) { __typeof_unqual__(a) b = a; return b; }' | $(CC) -x c - -S -o /dev/null) + config CC_IMPLICIT_FALLTHROUGH string default "-Wimplicit-fallthrough=5" if CC_IS_GCC && $(cc-option,-Wimplicit-fallthrough=5) From patchwork Tue Nov 26 17:21:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 13886258 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 49326D6552F for ; Tue, 26 Nov 2024 17:24:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F12986B0093; Tue, 26 Nov 2024 12:24:01 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DF6566B0095; Tue, 26 Nov 2024 12:24:01 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BD61F6B0096; Tue, 26 Nov 2024 12:24:01 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 8C2746B0093 for ; Tue, 26 Nov 2024 12:24:01 -0500 (EST) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 389C91C6F5E for ; Tue, 26 Nov 2024 17:24:01 +0000 (UTC) X-FDA: 82828919040.28.D5ABEAD Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) by imf16.hostedemail.com (Postfix) with ESMTP id 5FEE718000D for ; Tue, 26 Nov 2024 17:23:54 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=aFVGSn11; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf16.hostedemail.com: domain of ubizjak@gmail.com designates 209.85.167.47 as permitted sender) smtp.mailfrom=ubizjak@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1732641837; a=rsa-sha256; cv=none; b=TRA3DeMnP+Rfj+ZO5e1zghgDFrTVVsA2QntkfjqqkU5HCdauGqnqNNceSWoMI9ehnEtQ++ TQ0EakVHTjlK007dko4CHo0HOgas7TwwzcozOO2lC+7J5ijLwU8fDmSWTS63w3jy7I0hAO Kb8ofp9MMj1QQxhIfAalwYMmcvQIi6Y= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=aFVGSn11; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf16.hostedemail.com: domain of ubizjak@gmail.com designates 209.85.167.47 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=1732641837; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=kox9z7JfiY9O2bkBijsUQnV/alELjzcn+LlxGXFiSRo=; b=L7s+8zNCppfUiNCJ51j36Wssxc4onNuzbxR7AqxPtl2nuvhJlK6P7AclSxZ8Ws2DNRHH8e +Fx+P86a94TPpubZldin0XFsQMye5GORZp4f1GNyXnaONqhjYrMdSmiY6t+L/ScG2o/YTs NIAxP2c1KyRwVieLaZoFqMSwNLT6c2k= Received: by mail-lf1-f47.google.com with SMTP id 2adb3069b0e04-53ddb99e9dcso3530609e87.3 for ; Tue, 26 Nov 2024 09:23:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732641837; x=1733246637; 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=kox9z7JfiY9O2bkBijsUQnV/alELjzcn+LlxGXFiSRo=; b=aFVGSn119nzfatinopPb+lrxAseHABuERdkHWeISHzztR1gO3N5DP7y2ENIazbsNeE fpsQ51kpKi/2XMiBXBzFZni/ivMaDEgGamUhettQK2jHY5b/1DM7/7vDnNw6V0jD+kKK UIlX9D4qKoaieQ8QzghM8CaE8HEe6j30jF/TD6C93bwPdIp9aPtaWAiTet71KX6HZQrT x6SjSUUYKjEaL4du4FPPQ0SZEu92WFMFFZ/eF9NhJpcI+T89cQp2jRZjL4zrp47GnlJv WSNDjTc/ivKJ4c/7an773jSti5whK6ynz9n2dMCjPq4cItOLEAgJA/Rc+ycC6q1XotyE MdyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732641837; x=1733246637; 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=kox9z7JfiY9O2bkBijsUQnV/alELjzcn+LlxGXFiSRo=; b=gjG2WW3Q8SJlZ0dHEJECLHiGuxT1HuY38XpeqNbMICl+vYxlxBS1Pk7fo7jkU7zfO5 YceQfw4MycXiZPGkZWBf42F/lWppfqevsR3YEIEf1UaxPkmTqEuhYkvF97TM606Xo2B+ xritEzmdx04CBjDAQgb5Lsxk7ERL+nT1+y2A91tW6+f7AbMzMDhWf5hNtq7jgbtoeogJ jz4tEpSE9At5hk0FA7oVdZkegS9dT2DepEWDZghKKX/jQV/xtw0L6klgoE4rsnv+gbsS DhB2/7VtV0q9PcHWMSjD6tJ3zB+Ae+lOZE0QViAeg00rv6DQP7PXAJ9WYBtQmK2MJh/v ddgA== X-Forwarded-Encrypted: i=1; AJvYcCXbBMTRSj2M3ohollwGsAR5d3byy6r/Pn71NZyohIfvThPAq33ud1dJbznXTDEf/QiBv4VJio8rQw==@kvack.org X-Gm-Message-State: AOJu0YyQCZCqoqh59J3NvYZsvBDkmo8HycdC6Dw74mM90dSa4KWRP+Ob aFFJxUJNulAIYlRfrBMUeJwxCPXmlvJ8lnMsbK0yQAKzEsgWQ7M9 X-Gm-Gg: ASbGncsLTxGgwSwNOJWqhR/d6edEQKZZ1Dc/hR4g6eBUTTYzRqHlhHncWl88LUdAZbN C/Cjf78GpU1OYLoGtPacA9N//rqdp1PSXmfrtuyh9YnD8N+9OwCy1AshsqdeMJNoGAMCXq48dz7 6Skkmetpsfz8+AOTwXHEWg7p9c9pHJV6mY/aLaWDUBwa0hveLUqZHauw0zPKoIyqTy7maGky300 MCYTeNmxGebxghSC6A8nSM39b82S3WGZLESiDDWCz9coACizKGX0+NHoCs= X-Google-Smtp-Source: AGHT+IFafhTeOcM4tAMdv0K7GsnHQKDv0NLujRtaLdpUu+P/n+6xxinduNCThfHYJZO8CNUezGgibw== X-Received: by 2002:a05:6512:3d88:b0:53d:ecf2:332c with SMTP id 2adb3069b0e04-53decf233a6mr1552836e87.19.1732641837149; Tue, 26 Nov 2024 09:23:57 -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.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Nov 2024 09:23:56 -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 , Dennis Zhou , Tejun Heo , Christoph Lameter , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Kent Overstreet , Arnd Bergmann , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Peter Zijlstra , Will Deacon , Waiman Long , Boqun Feng , Linus Torvalds , Luc Van Oostenryck , Nadav Amit , Brian Gerst Subject: [PATCH 3/6] percpu: Use TYPEOF_UNQUAL() in variable declarations Date: Tue, 26 Nov 2024 18:21:20 +0100 Message-ID: <20241126172332.112212-4-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-Queue-Id: 5FEE718000D X-Rspamd-Server: rspam01 X-Stat-Signature: n1dg4wpzjmw81aeyfrio47k7ktjfdr4i X-HE-Tag: 1732641834-176715 X-HE-Meta: U2FsdGVkX19kZgnN1zmTbP10zaFQB261aPRJr+vP576TE7aLQancMNZUtCt8nF0CEEie9Opzbc8hX4yL3roi8Qljtvmgc9OLPf2CGHr/l+YO3lHs8OKE6Dq5pbzRhMGf369H+mACssx8rC5SEPnetmgVzsWjh0AlUjzdNTON/yTKOaNGAhMB5HQ6P2jeWmT5bOB8Q7dNmL7R0pqbk64NK20h3frE4+F3XDONhwk4olCd3GyEvNR+1yJgt9pO7Bm2riH2Iwo7PRhjDPpjO24ml8N1XcABlvBh6oBqMHXme1f1zdrEvwhPlgPjL2PfWI4dSZNV+Ed9uglPRtPM2XJisYcsMKJVTF9ka2sbwTFlb/JACQ2JTjHHrIbjmToj0xD0auaEzG8keFUTZQ4kWhgA3gZx9gV9cU4yPFh9ChXdfke13NgZxKYYndSG/82V8XJKWp3Ct8RG0F8cogDbH+Jl79YqRW0kS/h24meGCYspVjdgMsWwkN9BfCo9ygs5g6p5LVjigadj1V3OaG9uPUTbTRDJJ/tBUh+0uIn9gLopYfUW29TD5cYXPiqCpBzEXU77XMHTWKM7cifyIDhoFTEWyLkoXqxYOn0xrRXNbqCGgGtlm7qzFkK1AVLaDzHiO/HGgXUbAfadsFHSfEWELwTDBHxxdz+I13ZmoqdBUD0ROGJ4UMUHZmXQkR5o6vKMGxSm0Hv+RdU6f4tE18MObj4S2ERjLzaksk1TJXzTyvwqWjf6SS9EzHaciLINmCAjpOxYCO27dr7USJsTluH7S8f+32txe43W3FDFk0X4N1xv6EcVTphJ0hCDXOGA7V2PaBgFBq6A5r3mWmQHGVAzNl8QodKAPnAzR+an4gpPsYEiguXOfZnd3/RE8i2N4LDWi38v/Y1Qnk2yRsi52dFiCj/rghk1ijw6qxwRffteZqefWdlV5pqwyn5cbby0Zes++noRRgjTiRiadIVtP3UJuWI KAA3OhwD Lc+tv3GjrFbuFb0jqTvx4zM4NR6ReXQqcrlQbXNiGOlZzEsb3G6KpbUkLLpGbF3QTbTruyOvYOWeY4tn+LLVhfToUbJXAuwJzv9LpM5bFtVjgcdHeguvEIUP1NTbrn0d4QBoeD8B/A5PA/c432V46ifSBM/mFR6knQGGU7115lsD6lXfKoEVyDpT6pxW/C/VfQJHYbifcK+tgAfEkldpsL6IGBrmL5gWRGejXpKCNbFqjFhiwkEl3KACt8yahXnbMjBYpi7JJqHe2JkNGCUVzGmj2Ot6a/yc2nly5Kvy6sSsa2GjDH2mIE/ibjUfIC+sR/SJ+ehWbfzWO/6lCg73+KlsNj2bNFKggSZAaGTXnNbhuqrp40G7WWtk4IkbDSGY58PMNrAE2zFqI3xIM08VmgiLzA1XZ4+CST+ApS4AtDr1td2xfNRaK0iRCl35KaEtaG7InYqAC3XWxcaoyiRO2egQwgJxuQpIaMeT45aOCulq5tTq4IbOXzgnyGWkHqWeH7j3E0TPWAV6fEjDVHEwOJtsTKP22jFWQci5ACbfvNNvSpQcxxnhT72NN3OrlIgiZh/4Gr9Am7dVLqlEGAPGNh3lKlUrgkTg/wFNhH5NwKk61OqagAn0am59OEAOY4l6XzAXvxKJet7kbQq2W6J9EK5qrPuRn84SHDDQJW/GNQtwCplJWyAJ1fZXWPOPNoPGbdyqZgoAyVm4ui0B0vVZh2OQRU5rVcuL0iYL2Ffz6BJJ4rPmtQ7mK/48Xqlu1kV8laX+peF5R2/BifCO8pOyNLG5AOchc+GBWDPj5JfjXL4a1MAonhWUiKNnvx1BoaHztiSzGEXySHqBc6wrZVytqAqREDtt1wjkQisM0ef/UDgR7YHG23TXUf5MPndMBxVzNo1nozVRznVcpuQBXttCzCCDFyWM1wbiyzRxH 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: Use TYPEOF_UNQUAL() to declare variables as a corresponding type without named address space qualifier to avoid "‘__seg_gs’ specified for auto variable ‘var’" errors. Signed-off-by: Uros Bizjak Cc: Dennis Zhou Cc: Tejun Heo Cc: Christoph Lameter Cc: Andy Lutomirski Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: "H. Peter Anvin" Cc: Kent Overstreet Cc: Arnd Bergmann Cc: "David S. Miller" Cc: Eric Dumazet Cc: Jakub Kicinski Cc: Paolo Abeni Cc: Peter Zijlstra Cc: Will Deacon Cc: Waiman Long Cc: Boqun Feng Cc: Linus Torvalds Cc: Luc Van Oostenryck Cc: Nadav Amit Cc: Brian Gerst --- arch/x86/include/asm/percpu.h | 10 +++++----- fs/bcachefs/util.h | 2 +- include/asm-generic/percpu.h | 26 +++++++++++++------------- include/linux/part_stat.h | 2 +- include/linux/percpu-defs.h | 4 ++-- include/net/snmp.h | 5 ++--- kernel/locking/percpu-rwsem.c | 2 +- net/mpls/internal.h | 4 ++-- 8 files changed, 27 insertions(+), 28 deletions(-) diff --git a/arch/x86/include/asm/percpu.h b/arch/x86/include/asm/percpu.h index e525cd85f999..666e4137b09f 100644 --- a/arch/x86/include/asm/percpu.h +++ b/arch/x86/include/asm/percpu.h @@ -180,7 +180,7 @@ do { \ __pcpu_type_##size pto_val__ = __pcpu_cast_##size(_val); \ \ if (0) { \ - typeof(_var) pto_tmp__; \ + TYPEOF_UNQUAL(_var) pto_tmp__; \ pto_tmp__ = (_val); \ (void)pto_tmp__; \ } \ @@ -219,7 +219,7 @@ do { \ __pcpu_type_##size pto_val__ = __pcpu_cast_##size(_val); \ \ if (0) { \ - typeof(_var) pto_tmp__; \ + TYPEOF_UNQUAL(_var) pto_tmp__; \ pto_tmp__ = (_val); \ (void)pto_tmp__; \ } \ @@ -240,7 +240,7 @@ do { \ (val) == (typeof(val))-1)) ? (int)(val) : 0; \ \ if (0) { \ - typeof(var) pao_tmp__; \ + TYPEOF_UNQUAL(var) pao_tmp__; \ pao_tmp__ = (val); \ (void)pao_tmp__; \ } \ @@ -273,7 +273,7 @@ do { \ */ #define raw_percpu_xchg_op(_var, _nval) \ ({ \ - typeof(_var) pxo_old__ = raw_cpu_read(_var); \ + TYPEOF_UNQUAL(_var) pxo_old__ = raw_cpu_read(_var); \ \ raw_cpu_write(_var, _nval); \ \ @@ -287,7 +287,7 @@ do { \ */ #define this_percpu_xchg_op(_var, _nval) \ ({ \ - typeof(_var) pxo_old__ = this_cpu_read(_var); \ + TYPEOF_UNQUAL(_var) pxo_old__ = this_cpu_read(_var); \ \ do { } while (!this_cpu_try_cmpxchg(_var, &pxo_old__, _nval)); \ \ diff --git a/fs/bcachefs/util.h b/fs/bcachefs/util.h index fb02c1c36004..415a5803b8f4 100644 --- a/fs/bcachefs/util.h +++ b/fs/bcachefs/util.h @@ -586,7 +586,7 @@ do { \ #define per_cpu_sum(_p) \ ({ \ - typeof(*_p) _ret = 0; \ + TYPEOF_UNQUAL(*_p) _ret = 0; \ \ int cpu; \ for_each_possible_cpu(cpu) \ diff --git a/include/asm-generic/percpu.h b/include/asm-generic/percpu.h index 94cbd50cc870..50597b975a49 100644 --- a/include/asm-generic/percpu.h +++ b/include/asm-generic/percpu.h @@ -74,7 +74,7 @@ do { \ #define raw_cpu_generic_add_return(pcp, val) \ ({ \ - typeof(pcp) *__p = raw_cpu_ptr(&(pcp)); \ + TYPEOF_UNQUAL(pcp) *__p = raw_cpu_ptr(&(pcp)); \ \ *__p += val; \ *__p; \ @@ -82,8 +82,8 @@ do { \ #define raw_cpu_generic_xchg(pcp, nval) \ ({ \ - typeof(pcp) *__p = raw_cpu_ptr(&(pcp)); \ - typeof(pcp) __ret; \ + TYPEOF_UNQUAL(pcp) *__p = raw_cpu_ptr(&(pcp)); \ + TYPEOF_UNQUAL(pcp) __ret; \ __ret = *__p; \ *__p = nval; \ __ret; \ @@ -91,7 +91,7 @@ do { \ #define __cpu_fallback_try_cmpxchg(pcp, ovalp, nval, _cmpxchg) \ ({ \ - typeof(pcp) __val, __old = *(ovalp); \ + TYPEOF_UNQUAL(pcp) __val, __old = *(ovalp); \ __val = _cmpxchg(pcp, __old, nval); \ if (__val != __old) \ *(ovalp) = __val; \ @@ -100,8 +100,8 @@ do { \ #define raw_cpu_generic_try_cmpxchg(pcp, ovalp, nval) \ ({ \ - typeof(pcp) *__p = raw_cpu_ptr(&(pcp)); \ - typeof(pcp) __val = *__p, ___old = *(ovalp); \ + TYPEOF_UNQUAL(pcp) *__p = raw_cpu_ptr(&(pcp)); \ + TYPEOF_UNQUAL(pcp) __val = *__p, ___old = *(ovalp); \ bool __ret; \ if (__val == ___old) { \ *__p = nval; \ @@ -115,14 +115,14 @@ do { \ #define raw_cpu_generic_cmpxchg(pcp, oval, nval) \ ({ \ - typeof(pcp) __old = (oval); \ + TYPEOF_UNQUAL(pcp) __old = (oval); \ raw_cpu_generic_try_cmpxchg(pcp, &__old, nval); \ __old; \ }) #define __this_cpu_generic_read_nopreempt(pcp) \ ({ \ - typeof(pcp) ___ret; \ + TYPEOF_UNQUAL(pcp) ___ret; \ preempt_disable_notrace(); \ ___ret = READ_ONCE(*raw_cpu_ptr(&(pcp))); \ preempt_enable_notrace(); \ @@ -131,7 +131,7 @@ do { \ #define __this_cpu_generic_read_noirq(pcp) \ ({ \ - typeof(pcp) ___ret; \ + TYPEOF_UNQUAL(pcp) ___ret; \ unsigned long ___flags; \ raw_local_irq_save(___flags); \ ___ret = raw_cpu_generic_read(pcp); \ @@ -141,7 +141,7 @@ do { \ #define this_cpu_generic_read(pcp) \ ({ \ - typeof(pcp) __ret; \ + TYPEOF_UNQUAL(pcp) __ret; \ if (__native_word(pcp)) \ __ret = __this_cpu_generic_read_nopreempt(pcp); \ else \ @@ -160,7 +160,7 @@ do { \ #define this_cpu_generic_add_return(pcp, val) \ ({ \ - typeof(pcp) __ret; \ + TYPEOF_UNQUAL(pcp) __ret; \ unsigned long __flags; \ raw_local_irq_save(__flags); \ __ret = raw_cpu_generic_add_return(pcp, val); \ @@ -170,7 +170,7 @@ do { \ #define this_cpu_generic_xchg(pcp, nval) \ ({ \ - typeof(pcp) __ret; \ + TYPEOF_UNQUAL(pcp) __ret; \ unsigned long __flags; \ raw_local_irq_save(__flags); \ __ret = raw_cpu_generic_xchg(pcp, nval); \ @@ -190,7 +190,7 @@ do { \ #define this_cpu_generic_cmpxchg(pcp, oval, nval) \ ({ \ - typeof(pcp) __ret; \ + TYPEOF_UNQUAL(pcp) __ret; \ unsigned long __flags; \ raw_local_irq_save(__flags); \ __ret = raw_cpu_generic_cmpxchg(pcp, oval, nval); \ diff --git a/include/linux/part_stat.h b/include/linux/part_stat.h index ac8c44dd8237..c5e9cac0575e 100644 --- a/include/linux/part_stat.h +++ b/include/linux/part_stat.h @@ -33,7 +33,7 @@ struct disk_stats { #define part_stat_read(part, field) \ ({ \ - typeof((part)->bd_stats->field) res = 0; \ + TYPEOF_UNQUAL((part)->bd_stats->field) res = 0; \ unsigned int _cpu; \ for_each_possible_cpu(_cpu) \ res += per_cpu_ptr((part)->bd_stats, _cpu)->field; \ diff --git a/include/linux/percpu-defs.h b/include/linux/percpu-defs.h index 35842d1e3879..266297b21a5d 100644 --- a/include/linux/percpu-defs.h +++ b/include/linux/percpu-defs.h @@ -320,7 +320,7 @@ static __always_inline void __this_cpu_preempt_check(const char *op) { } #define __pcpu_size_call_return(stem, variable) \ ({ \ - typeof(variable) pscr_ret__; \ + TYPEOF_UNQUAL(variable) pscr_ret__; \ __verify_pcpu_ptr(&(variable)); \ switch(sizeof(variable)) { \ case 1: pscr_ret__ = stem##1(variable); break; \ @@ -335,7 +335,7 @@ static __always_inline void __this_cpu_preempt_check(const char *op) { } #define __pcpu_size_call_return2(stem, variable, ...) \ ({ \ - typeof(variable) pscr2_ret__; \ + TYPEOF_UNQUAL(variable) pscr2_ret__; \ __verify_pcpu_ptr(&(variable)); \ switch(sizeof(variable)) { \ case 1: pscr2_ret__ = stem##1(variable, __VA_ARGS__); break; \ diff --git a/include/net/snmp.h b/include/net/snmp.h index 468a67836e2f..4cb4326dfebe 100644 --- a/include/net/snmp.h +++ b/include/net/snmp.h @@ -159,7 +159,7 @@ struct linux_tls_mib { #define __SNMP_ADD_STATS64(mib, field, addend) \ do { \ - __typeof__(*mib) *ptr = raw_cpu_ptr(mib); \ + TYPEOF_UNQUAL(*mib) *ptr = raw_cpu_ptr(mib); \ u64_stats_update_begin(&ptr->syncp); \ ptr->mibs[field] += addend; \ u64_stats_update_end(&ptr->syncp); \ @@ -176,8 +176,7 @@ struct linux_tls_mib { #define SNMP_INC_STATS64(mib, field) SNMP_ADD_STATS64(mib, field, 1) #define __SNMP_UPD_PO_STATS64(mib, basefield, addend) \ do { \ - __typeof__(*mib) *ptr; \ - ptr = raw_cpu_ptr((mib)); \ + TYPEOF_UNQUAL(*mib) *ptr = raw_cpu_ptr(mib); \ u64_stats_update_begin(&ptr->syncp); \ ptr->mibs[basefield##PKTS]++; \ ptr->mibs[basefield##OCTETS] += addend; \ diff --git a/kernel/locking/percpu-rwsem.c b/kernel/locking/percpu-rwsem.c index 6083883c4fe0..d6964fc29f51 100644 --- a/kernel/locking/percpu-rwsem.c +++ b/kernel/locking/percpu-rwsem.c @@ -184,7 +184,7 @@ EXPORT_SYMBOL_GPL(__percpu_down_read); #define per_cpu_sum(var) \ ({ \ - typeof(var) __sum = 0; \ + TYPEOF_UNQUAL(var) __sum = 0; \ int cpu; \ compiletime_assert_atomic_type(__sum); \ for_each_possible_cpu(cpu) \ diff --git a/net/mpls/internal.h b/net/mpls/internal.h index b9f492ddf93b..83c629529b57 100644 --- a/net/mpls/internal.h +++ b/net/mpls/internal.h @@ -33,7 +33,7 @@ struct mpls_dev { #define MPLS_INC_STATS_LEN(mdev, len, pkts_field, bytes_field) \ do { \ - __typeof__(*(mdev)->stats) *ptr = \ + TYPEOF_UNQUAL(*(mdev)->stats) *ptr = \ raw_cpu_ptr((mdev)->stats); \ local_bh_disable(); \ u64_stats_update_begin(&ptr->syncp); \ @@ -45,7 +45,7 @@ struct mpls_dev { #define MPLS_INC_STATS(mdev, field) \ do { \ - __typeof__(*(mdev)->stats) *ptr = \ + TYPEOF_UNQUAL(*(mdev)->stats) *ptr = \ raw_cpu_ptr((mdev)->stats); \ local_bh_disable(); \ u64_stats_update_begin(&ptr->syncp); \ From patchwork Tue Nov 26 17:21:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 13886259 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 4CB29D65532 for ; Tue, 26 Nov 2024 17:24:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D32FA6B0095; Tue, 26 Nov 2024 12:24:02 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CBD9B6B0096; Tue, 26 Nov 2024 12:24:02 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9FDAE6B0098; Tue, 26 Nov 2024 12:24:02 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 7BE1C6B0095 for ; Tue, 26 Nov 2024 12:24:02 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 3A4EE40EF7 for ; Tue, 26 Nov 2024 17:24:02 +0000 (UTC) X-FDA: 82828919082.02.8EC9FF1 Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41]) by imf24.hostedemail.com (Postfix) with ESMTP id BB6FB18000F for ; Tue, 26 Nov 2024 17:23:59 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=PKMtsBqv; spf=pass (imf24.hostedemail.com: domain of ubizjak@gmail.com designates 209.85.218.41 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=1732641837; 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=e67gnDX037AzEtGr2TTuiC3i0rrMYCYbsdiQSpuFMPc=; b=8bGA6rxBvFD9gKs+hJ4uJ7iDSVUxN6tZEbwm0pCKLI4qj18nk8eNAcfi/yMblQdIgjngYG s2UgsgBLDPX3LvkUyTK+7qay8ejK69m/OExbrthbXlAVrPCNzrFXrKkEXKoCgjci8nUUHW ySeaWvRzKHqsBub1fENWQ6I3jRlvtZ0= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1732641837; a=rsa-sha256; cv=none; b=HTP853F6ojhiD5MsbUSc7L1Vlw3kcYDoULrSEb/kCcf5XmLAdo2sqTf/VkK2jg4E0Mmxzr sI9gn4WdfCg50n2s/NNcaR3oJE7kQP18YMnqUiqddwF04f7mJYhYkerGfTMCxwI20fsAjG 6RHEYrqKZuprDmoSKzOMG2AYPYBajRE= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=PKMtsBqv; spf=pass (imf24.hostedemail.com: domain of ubizjak@gmail.com designates 209.85.218.41 as permitted sender) smtp.mailfrom=ubizjak@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-ej1-f41.google.com with SMTP id a640c23a62f3a-aa54adcb894so334374466b.0 for ; Tue, 26 Nov 2024 09:23:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732641839; x=1733246639; 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=e67gnDX037AzEtGr2TTuiC3i0rrMYCYbsdiQSpuFMPc=; b=PKMtsBqvp40BV9KuoTedCIvQWRLd/LptD4fZg4MXt6tJVjgqLdli0e9K4ALFwCplTQ +GjCwnfhTRPUVls/RIvgZryQ8HOgpfMMH7RXESR3iov9qwxDqGpWtXI9zz1FUlczTfPl RRRx4czGJQL/Ikbon0YQdesGm6wpcKNvRciE0JQtFFSJDUMfpEO4bHXL3nYsW/WvyLTn Yc30OSeSKrNiPUuNLJUW95tQKOsJ3zVHxoaYKe7fynhCgmnqpSXghhK2ig9f61iwJns2 icmELcbq66hLIkDaC/Y7cz8xOkLrIP7sQKSqVh1CXlpJUD+bThBl/uNmC+egACyHCUh9 V26g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732641839; x=1733246639; 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=e67gnDX037AzEtGr2TTuiC3i0rrMYCYbsdiQSpuFMPc=; b=vrB0uIUSlvzPI8s4/kEbdvg1oKc4SRgObBzETMQJnISQ7bPs4gi6NH7kzqUGnAjLaJ WsACZcNCfMDPZS5Fbp66UzI7FBaDnHIUsFcMXiSXlEb8XSMHTai3vVjqt2BQaehf2Oow xcaDO2CNt98nVC4U/+yAFZ1Au3k4w4hIqJWTPd1bbE0LIJhXXbgssOixSspk9LjKFdxI GAugICTVRL1JQLejsDeXUEeDIZT6e0nJrclW7fCUo6Jjjalqn9WwP4Q45jZtPpNn+aUZ 61oXMOK+pvlqN412/rh6wITfu0qepN1E+HrVVtDrSX46954JYRpg9rcOkAMWX/JwjLys PPgg== X-Forwarded-Encrypted: i=1; AJvYcCXB6VVp4w+sOF9U1XuB3ccgwaSjgXlFNDwjTHuyBQ2eLnxPWwrEll39lWlRmOAksCkyTFTUow24Kw==@kvack.org X-Gm-Message-State: AOJu0YzJbmEkLOk6tYSSATgWXIrA3rmd9otj77omDVZCqbdVRt32Z29k sebUyHS6itMr9g3F/zEQentHAkDw5tmb2E0JtBIrjjFNLus2yxGb X-Gm-Gg: ASbGncswgQce4mSz/efHB75C4AeG2B2udZu73Aqdq5Xmrbj/ktG5+YjRssn13qXIgnF h6iQo/lkOgELJjHWjjyLV7puBb2RlAOCku2Z79hq+xIE6G1s0o9NdITJYiUstvVYyRyRfWnHyOU kbyvSikMP9xChM6l0KYmnmAXChehq06NUmFk20W9ynnZGDzRBB2zDoGOZkHJmARRnrUe8UP9HGP PmP7kxmLPLfBjlhHX1GXcF4QpCAyBG/jY7iFS/z4GtFl5Vc7ETpYhCJYFg= X-Google-Smtp-Source: AGHT+IGSX3RDD4Mjs5KZqKxckix0gq8OkR9npjFRRCctDVzzyNWShDqRqCQCbZlVg9RCDHh4i4SbvQ== X-Received: by 2002:a17:906:1baa:b0:aa5:274b:60e9 with SMTP id a640c23a62f3a-aa5274b69ecmr1175231566b.33.1732641838563; Tue, 26 Nov 2024 09:23:58 -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.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Nov 2024 09:23:58 -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 , Dennis Zhou , Tejun Heo , Christoph Lameter , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Linus Torvalds , Andy Lutomirski , Luc Van Oostenryck , Nadav Amit , Brian Gerst , Peter Zijlstra Subject: [PATCH 4/6] percpu: Use TYPEOF_UNQUAL() in *_cpu_ptr() accessors Date: Tue, 26 Nov 2024 18:21:21 +0100 Message-ID: <20241126172332.112212-5-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-Stat-Signature: huei8dq55mubptr3n397zxer5ze4uc11 X-Rspam-User: X-Rspamd-Queue-Id: BB6FB18000F X-Rspamd-Server: rspam02 X-HE-Tag: 1732641839-557824 X-HE-Meta: U2FsdGVkX1/lBmF48oLnlQKzTsG6ENVhfptNohl9A9DxlhMOcgdu4ZnJdeI9NMTKNlAIFo9mjt4Szv2SWmXDPhTjzRJ8LHJ9HnDzV7aveHf+d8u0/Egu3eTmx1M7BL0bzv6cMQeTTt9TUzAcB54/Fl/4qHVk1eEFjdj4nweUGj+v/n5O5l2FOZjJr14GIYtNJjmCF1pvz0vUDLn8Lnzr25ED9KZOBwhh/iLZXjDhdFcSaivZNNXP6+cney6s/TQwFg8V8iJ1T4+fwAXf48aMESxcqDakoHGrNl+89PospYIkoxOzblnm+mX8FE2KODh8JecHAoPcEzjNU3pe4U5S10X9JtGpElboGEZ4qtQSgOJ2YOxbYPfCbBfcB6xrZ3Q9oiSimeFUoXsKPTtuAor5DT7jESuq8H5CtL2AvfNw16wGpzklPWeEtuxYG6TtNykbtpAPl9RJbG5TzafQfkgNsO75WBI/uPjSJ/uIO9oWwri4vhTyQqJXjS47EWOl5qPKZDm+LxDDno8SWVgxS+OJdooeLPMsVMXDnGdWEnNyGEYr0/ymFJuxLJ3K57NW6JkskYJPtT+Zm6rIYlBVsNbvzfh4o6TKtfPq4EadW6PK9abrRElb6Jad2YHeupq21j5aAPyQUa6pN0Ucrmhhvh4BSHUN/AvaWkWVuu2YIy4u5XkNDifHbL+rRhJBsyxDpkTF7BZAa5AIs3vW1POCtQL8olSLfRDbE5ui4LulW2Af0UGYrEFCe+TMOjy6CT+YdtoAYTm5v4Tf68HkpZK+A0CVECVur32yzf8pdoTQRC8CHoY9IIY5HoUSV9nW0E4ktdYB3z0O+Z6PDeCMTOEoghV5+GaMi3f7ntE7eq1JLDqKO2RlwOzsB09uB5gp2fLPl7H7Sp/yAhhkFnmTboEW3KT+e+ja+LTedLyaS49/s+6f5E/ZsQW8/+JBa1h+MzOvG0tZ+HkrXwq46F7gzV2iESq SfNkLUvi rTvKtssb2y9EE/JmYAPwgOYK2DdlNMFVzWlwBiQKxv1KJAkErwxKzs4p64HA66xBEO3mErVnrwCKJgjom5L6XUK5gg20BLdhY0OfY5tbIl3qT6+qRQ23W2aJSxahhnrc1lHbE08XwWDoFKwYuJ43b/mP9nHFHXVy5O0j+utVr1+yzTdkTeiW0315TXqkouM7vPWQga/TpckHjvLhhYtS3Fxt5mxNyKRzRdq7e+K1VAt4GgJZyUhXime6U0mcTU15onAR+9SMFJSE2Z/C/rfs8YS4aWj1w1M5sGv0onZw69cVWiLXNQpxZd3JVISmKyDdEBheAZGHicIwB10YO+mxpbaVNKkTc+QBcf446zKh5E3kG/cN9qfsaLsZgCDPbfymNb8TNngG1XuHPJlAuYn7vadbxw79gPXqyIbESOkQ3DljuS0ZXhiPawDBfwM6JCxSZW3ejbJ/qHpdvRQtxrVJ3WwYhp23QDYfPc4mIbO428z5JdzHa9NcbViOBIc8l/Fw0RTv+FtO15FXe3lrBAiLYVYfX5IBJ8ZOu2UoIV49sJ9Ka7cc6GE1YqE+86aLTI/XeqCFabMlCN7haEp7p/2WRYGiiocXCkjkpxAlzi/rUVrRz7kSRp0hMSFbFdETheLVuq5IdwHOFUbpDqCkn2EvLEwpHV4zFpoZIzwJUWxcHrvS4EV3SK4h8x+reBX/RdgIXqFLy1rAWSQAhZYIGZSupQVXycJpJ1iVy93FR2H9QmBf6g5ESGXlIyVt/XQMgSO8e/PYlUCRaKFvTONs7bT8Zwrn2Kw== 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: Use TYPEOF_UNQUAL() macro to declare the return type of *_cpu_ptr() accessors in the generic named address space to avoid access to data from pointer to non-enclosed address space type of errors. Signed-off-by: Uros Bizjak Cc: Dennis Zhou Cc: Tejun Heo Cc: Christoph Lameter Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: "H. Peter Anvin" Cc: Linus Torvalds Cc: Andy Lutomirski Cc: Luc Van Oostenryck Cc: Nadav Amit Cc: Brian Gerst Cc: Peter Zijlstra --- arch/x86/include/asm/percpu.h | 8 ++++++-- include/linux/percpu-defs.h | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/arch/x86/include/asm/percpu.h b/arch/x86/include/asm/percpu.h index 666e4137b09f..27f668660abe 100644 --- a/arch/x86/include/asm/percpu.h +++ b/arch/x86/include/asm/percpu.h @@ -73,10 +73,14 @@ unsigned long tcp_ptr__ = raw_cpu_read_long(this_cpu_off); \ \ tcp_ptr__ += (__force unsigned long)(_ptr); \ - (typeof(*(_ptr)) __kernel __force *)tcp_ptr__; \ + (TYPEOF_UNQUAL(*(_ptr)) __force __kernel *)tcp_ptr__; \ }) #else -#define arch_raw_cpu_ptr(_ptr) ({ BUILD_BUG(); (typeof(_ptr))0; }) +#define arch_raw_cpu_ptr(_ptr) \ +({ \ + BUILD_BUG(); \ + (TYPEOF_UNQUAL(*(_ptr)) __force __kernel *)0; \ +}) #endif #define PER_CPU_VAR(var) %__percpu_seg:(var)__percpu_rel diff --git a/include/linux/percpu-defs.h b/include/linux/percpu-defs.h index 266297b21a5d..2921ea97d242 100644 --- a/include/linux/percpu-defs.h +++ b/include/linux/percpu-defs.h @@ -223,7 +223,7 @@ do { \ #define PERCPU_PTR(__p) \ ({ \ unsigned long __pcpu_ptr = (__force unsigned long)(__p); \ - (typeof(*(__p)) __force __kernel *)(__pcpu_ptr); \ + (TYPEOF_UNQUAL(*(__p)) __force __kernel *)(__pcpu_ptr); \ }) #ifdef CONFIG_SMP 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 From patchwork Tue Nov 26 17:21:23 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Uros Bizjak X-Patchwork-Id: 13886261 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 84830D6552F for ; Tue, 26 Nov 2024 17:24:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A9DC26B009A; Tue, 26 Nov 2024 12:24:05 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 9D6126B009B; Tue, 26 Nov 2024 12:24:05 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 833C46B009C; Tue, 26 Nov 2024 12:24:05 -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 609DF6B009A for ; Tue, 26 Nov 2024 12:24:05 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 0E80881302 for ; Tue, 26 Nov 2024 17:24:05 +0000 (UTC) X-FDA: 82828918956.09.DBC4600 Received: from mail-ej1-f41.google.com (mail-ej1-f41.google.com [209.85.218.41]) by imf25.hostedemail.com (Postfix) with ESMTP id A78BEA000D for ; Tue, 26 Nov 2024 17:23:59 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=notP5Xfy; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf25.hostedemail.com: domain of ubizjak@gmail.com designates 209.85.218.41 as permitted sender) smtp.mailfrom=ubizjak@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1732641841; a=rsa-sha256; cv=none; b=HZ6AP5gKv44WuaBlwK3VoZB14pnfK9CyddSyBsv2/pvgyYoVcVIy1il0qxmbRwPAXjwTTu mkZ2sVlf19ukKB4RU69PW0nhny4l+EK6T71uFXjFY1Wjy5nS72NnyxOHOM/k1VCqIXOkXw x//3kKwI6LrHFyDTFrgBgVB+u3O0E60= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=notP5Xfy; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf25.hostedemail.com: domain of ubizjak@gmail.com designates 209.85.218.41 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=1732641841; 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=vYQhfY8XS5QoJJ9ROocmWAxArKh2nECE5yY90QqkfaM=; b=AaBXSsXfeOD6Hip0PaFSbrFUYYAwZcgXmytSwjySyCwALndpQDeXfWGKvQuIJ4lJTas0lt zajwCbbBRIrbaL5J57Gkq+g569CjDrnCjm4KrOLVkVFLVziOkUOaGtz5j6aeTHItoIG0vZ kIkjmyhguhDezAc0efKyuccCQi1Q52Y= Received: by mail-ej1-f41.google.com with SMTP id a640c23a62f3a-aa560a65fd6so273259566b.0 for ; Tue, 26 Nov 2024 09:24:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732641841; x=1733246641; 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=vYQhfY8XS5QoJJ9ROocmWAxArKh2nECE5yY90QqkfaM=; b=notP5XfyMMztO08njxFxUOuOOUvUb7LZhUJXZYEklSS9PxDGDgLn6WdMCa6YadiOs5 wv5z8clwGYEAn77fwrSouFAjKIs578yz9psxtIQswsALE0fH3zuxTD/ixPuNhUw3Y6nh uwrmeVL2Sexy9g9lyLHns2UY5bhEZ6p/9suhztdeqoxNTmxJYmcOvzZkPme1c0uDef+z H50kGlgVcWBXFnscnX7eZOI3gHjikX8qB5wS4EHPqvD/B9spoA6QRtl+fBzbYwx9YlGv HJjowMAcIKD6K55nV8RV6tr+PrHm2SqQUCxDPfWrrbdMyUBlgv+th7WtBFeoJwnUBNJ2 xmOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732641841; x=1733246641; 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=vYQhfY8XS5QoJJ9ROocmWAxArKh2nECE5yY90QqkfaM=; b=UNiDplSpPRTPsxXmrkNh2f6Bk++n4Lr/7OZyQ8hAPcnN9leR3H2h9Hunk/1PjI0hP3 lh/8w4KwAQYr3d2EHEw9WXOaNg+WQIEiT50YwNwiedVHi3XypET6wzdfTRPp1oKXGpbq IdRqiS6qfAHgNoLyfYAj467g+fE9p6AOSQmB35SH6aDIBwJJxLpApjQJs3Q7pY2PzBGq KyOClclgV4PK5ZA2s2BHDD3j9a0DGnSVZzTBvOLbc5+5jTW1ZXEcGy3RtK2LiFSgmeCY uFIaMkLtaUjpqE20crxIP26d7EA+IMV4VyrwIznICZPC1F+CdOj6xTGx7LNvgJWgjlzW KcEg== X-Forwarded-Encrypted: i=1; AJvYcCUQr+BKY0IMJ17obkZgi6/6nkaIvEN7sdn4tvcy/Ga1jbvw3h7G8ScepzxCbsuKgCt1DQN50eETzg==@kvack.org X-Gm-Message-State: AOJu0Ywj7mFshePliJ9BECE8p+a0zFDofivMvYCAsZS/hrTxmkKRkTJn ZeGfNUdhYvh6mTBHOR8YfntPwt4brvkxGyAj54CWYJqWYr6R14Hm X-Gm-Gg: ASbGnctD6NzVl9lD4gsa8m+ZJELcFgg2SKM2UDhG0KugvPEjGQpCmlJqRQanpB3iJKG ZfW1F3l8aAsaD9bqcwVPcdKNaWygcJxWdWB/egZdqNxteUYJgAceypGjSXwdqdhj1/KbOjOdnSK /xayCPKfbL5ISid5Kw6xgxqbF+tcV5JdXGwmZmyEYJTdWyxHi9nVJfZiUyYDcNjm1WZidtvbRxM abbT2HVZHM32YQDihe/qz5m3WqEzNOwiZMjjwgMKpib8k8lmBtbzlpUgLU= X-Google-Smtp-Source: AGHT+IGyDslpGnIuA7EaGQJjOGzUF02XOkLJcH+fA/4c2TgsR6qaqxDya98ILXBrNs7h8xnzOadyXQ== X-Received: by 2002:a17:906:3d22:b0:aa5:26ac:18e2 with SMTP id a640c23a62f3a-aa57fbba709mr3970966b.23.1732641841517; Tue, 26 Nov 2024 09:24:01 -0800 (PST) Received: from localhost.localdomain ([46.248.82.114]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa534232086sm473832866b.42.2024.11.26.09.24.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Nov 2024 09:24:01 -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 , Dennis Zhou , Tejun Heo , Christoph Lameter , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Linus Torvalds , Andy Lutomirski , Luc Van Oostenryck , Nadav Amit , Brian Gerst , Peter Zijlstra Subject: [PATCH 6/6] percpu/x86: Enable strict percpu checks via named AS qualifiers Date: Tue, 26 Nov 2024 18:21:23 +0100 Message-ID: <20241126172332.112212-7-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-Queue-Id: A78BEA000D X-Rspamd-Server: rspam11 X-Stat-Signature: cow99pb6da64b4oizw8e4yu3snm9wjmm X-HE-Tag: 1732641839-925182 X-HE-Meta: U2FsdGVkX19OXEJS2rtbeFmH6YxvI1a7qfvBl9wjuuhoBEYMGP9fWD/nEogdloONIWNl+lsCByJczvjUgCn3pbAxFCNSIKCHJkH62UTu+TN04y9SSrGVr5WRV+Twyrat4Ml+GWcxQYBqDaP6+4OrR+B296BFmTnoyL1aIDGjv7VS8Sv2mecxfD3SqUHUvR4t3TiZ3yqf7j1WCbnX/iLDgcq6zzG/QM8/rC8t6xUJak3WFV1sBZHJDj65pe0w1DqLCJ1Nr2y/fMnDnwbA4zIpRFE1MRFkgN+67lAyNpSJzrK0VzXx2kSlrZbD0g8GPkh5KcmcChky83Dp+iTC+hueO5DnZ0nRmwCS7RllpAsGXTZFKt4i8t+sJfJjNysSpII3m+iWYykwRr+yWeXNgSAEVLJHAdIfNgkPhpMWvIheZk6f7uJlq2LZOHhccgcfDlNtA6lKYpxd7m/TCniRX7qK8iweaX9HU7EN7X9EVgk595Z3uodLPTwAClUDa7fd9fIxNd1uZhqyC4EgB2pxD00R/UmWn/cjXzv+Lzf+apTpLL4T3srcUOKxPa+XbZX2XnQcQaGNpo9hQXZFgWKolsSdg+BqoysNPgWnwXpLfCCNTnmp2AZNSqt/Fsw0GnwdfBGdyNl4C3FzMPMgazX+vyXJr4a6E2n/+kFJneU4YnB9+d79DvAp3R2LS6Tbi8NFQsI7c00vMn2qHu/9VpnhKOWcE8uZfYFMdLrcY83YZXAo+h+6qcyEINPeHlMtTc63cvRonjLcHCP8AQXJex9D2GA0ZNTsKQflugFUsCmF4x/lUh+2JMM3QSuyTUMbjuakBiPvXwmjkIoAyfEb7wsG/gwc0WT0lzr2IxRfmiSzV3D8FGkUR3Qska/s6aDMi41+7oJYQy8j+G9Qtz7k5SvnWb01De7+3MlMlTaMoGfU2ZirjotP61nm8VruVookMcBhhlgk4Zsm0C9qAt0tv5Q0rIS tN5BTgyV QOswDFaZKNU+gcnUq5IIbC2i9l75XGmvOC39dvKCDSeooEaGEx0k8CA0npT6bhzih3ZjO6imY7nuqwjLKU0i1PWnwVqOqtx5TStRKhDUvZxXIm2Gd54N3+mRduOVuQiOiM7oaCFuoHRIy87px8vdN2PXYEr7J5mikJesFyt7rhmZXzNZi7ja8zq2c+Dbu+XIulrz++2cZQyJK19oX/nQb+SMWdXE6GHlC0sD+JDMXqyiXPF2s7UrYSUh1T/6Zd87i1p7nMRtr3YR7FG3AyBDaqcRqgKuScjVEG2jFwXqSR95ntnbbxMW8TPjojRQtQzzRYUQU1Rwa6z5YW3XlVr24zgOgZtduP+vXgU2RSnveHpYYlu9LoPjlwN88KfDoUe/U29Eb2WwyoMxvoNuwYNlisfn8SosUkoRto0+pnN3+kvuuyrbYsxTabssfY7o5T3cn0eN01Qtny0NrzOMOSmFc2i2VARYp1U1ezgRLUwVZGegnYuAnnfQia1gbUg6svwIjV0gd7l3SK0jaBm9snPRryMUdYqIqr5mwfgQT6kcPX2xJIVBQmtqAIfxkD95UW6tgeoavKPLmwZAYo3SgBkTNrDOUA/I2V42lTlMFDyk0xe3DhHbe8f4ttVUA+THRXgG7jAHghj0wrewbVaAD5jLrObqML2NSC4bP3/J15mXOGn4kQ2Ui7rVFu7D780nnAP23SzxX901holGQYbkM4fQT9dc2yF/vp6wyjxpR 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: This patch declares percpu variables in __seg_gs/__seg_fs named AS and keeps them named AS qualified until they are dereferenced with percpu accessor. This approach enables various compiler check for cross-namespace variable assignments. Signed-off-by: Uros Bizjak Cc: Dennis Zhou Cc: Tejun Heo Cc: Christoph Lameter Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: Dave Hansen Cc: "H. Peter Anvin" Cc: Linus Torvalds Cc: Andy Lutomirski Cc: Luc Van Oostenryck Cc: Nadav Amit Cc: Brian Gerst Cc: Peter Zijlstra --- arch/x86/include/asm/percpu.h | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/arch/x86/include/asm/percpu.h b/arch/x86/include/asm/percpu.h index 27f668660abe..61b875243ea3 100644 --- a/arch/x86/include/asm/percpu.h +++ b/arch/x86/include/asm/percpu.h @@ -95,9 +95,19 @@ #endif /* CONFIG_SMP */ -#define __my_cpu_type(var) typeof(var) __percpu_seg_override -#define __my_cpu_ptr(ptr) (__my_cpu_type(*(ptr))*)(__force uintptr_t)(ptr) -#define __my_cpu_var(var) (*__my_cpu_ptr(&(var))) +#if defined(CONFIG_USE_X86_SEG_SUPPORT) && \ + defined(CONFIG_CC_HAS_TYPEOF_UNQUAL) && !defined(__CHECKER__) +# define __my_cpu_type(var) typeof(var) +# define __my_cpu_ptr(ptr) (ptr) +# define __my_cpu_var(var) (var) + +# define __per_cpu_qual __percpu_seg_override +#else +# define __my_cpu_type(var) typeof(var) __percpu_seg_override +# define __my_cpu_ptr(ptr) (__my_cpu_type(*(ptr))*)(__force uintptr_t)(ptr) +# define __my_cpu_var(var) (*__my_cpu_ptr(&(var))) +#endif + #define __percpu_arg(x) __percpu_prefix "%" #x #define __force_percpu_arg(x) __force_percpu_prefix "%" #x