Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1097648pxb; Tue, 8 Feb 2022 09:11:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJy9LnYxQVAsLhEgROACOfocAZVe7wg8rSMuzwTtN9o+jrtPCZfmFqxV9ESdK/aqe+Jk4qGy X-Received: by 2002:aa7:9d02:: with SMTP id k2mr5281303pfp.68.1644340309056; Tue, 08 Feb 2022 09:11:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644340309; cv=none; d=google.com; s=arc-20160816; b=SC/hZtJKt/lDpUfDP5VxKnF5kNvYPEVO2u1Pk7j1iadvRQbPYRmfJrUg3S4girmq7P uPXU1b6FtSBz60+4iVt3lytDTabFi3F3XcjlCW/kaSkUpr+ClAu3N/LX2k7eUv/ZrHsl 3u9A9NLkrqNsVsAJwY+kIagUVs/Yr2AVBTvC5atdUQA6boJQtOWEAdtpA3SRPltz3Ple +cmOri0gT1xfg1Yw11tvKUZRee56UxQIXhcDb1SULVN+PUmV6LS8R0KJm8U/ZAbeT4Ug 5ZoQL/0yYt6Lrsp/HXBys9bW15qivpuhdO8hEewv6PItyihdOeziQbsw+eSNgF3xQSo8 N57w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=uUxrRkm5Pxwz9YvTSj144qOQmRMXo8XRT92N+FuPrgQ=; b=NNdylbbl7bu1OD78OcEbUp0sAWcmF3U7tFwnenfTiI9Lilmgq5cUglT5BVp7h7PEbm CAuuvBEIY2DfSMuOX7k7jhDKe2N+/H6HqjXQQgFXvRogCJVYrsqVpfPzLm7WQor4+9qT gkziNp355tPmvasR0XbX59OIRXxYzKKQKiUtOXrR4jgGDoCnO3Ny2xCgUmveli6Xo1/0 lmaTG1IA9Z+/OQEvytmGOXaf+9TOZLh0p7u0UpwzpEa5hmHwRCTHjWsusO0pq0HR33yv McyARWtzRz9fRyi6wkHaWgMsV69zDWH47JQwPhF/ZEq/SkqV/MsEdGI9/j3LVuiekrLb fuQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=I9fl7uBh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j20si13867766pfj.271.2022.02.08.09.11.35; Tue, 08 Feb 2022 09:11:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=I9fl7uBh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356495AbiBDIab (ORCPT + 99 others); Fri, 4 Feb 2022 03:30:31 -0500 Received: from mail.skyhub.de ([5.9.137.197]:42776 "EHLO mail.skyhub.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235995AbiBDIa1 (ORCPT ); Fri, 4 Feb 2022 03:30:27 -0500 Received: from zn.tnic (dslb-088-067-221-104.088.067.pools.vodafone-ip.de [88.67.221.104]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 971ED1EC06AC; Fri, 4 Feb 2022 09:30:26 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1643963426; h=from:from: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; bh=uUxrRkm5Pxwz9YvTSj144qOQmRMXo8XRT92N+FuPrgQ=; b=I9fl7uBhSnCB+uuUXwI9B/lfErkhzXNkW+vyVDhziUHJozeIzwjCV6K4h9TA5Tz+1hUNcf rADB6BMXu55cq7z+ECnfZGQunzy30sQXAfNxyusSRxeaGIB5XDawMRQfwdKjO17LPunkGE RHADnTQlub42GvXxYgz7oz+fBtthV8E= From: Borislav Petkov To: Tony Luck Cc: Jakub Kicinski , Linus Torvalds , Marco Elver , X86 ML , LKML Subject: [PATCH 1/3] cpumask: Add a x86-specific cpumask_clear_cpu() helper Date: Fri, 4 Feb 2022 09:30:13 +0100 Message-Id: <20220204083015.17317-2-bp@alien8.de> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20220204083015.17317-1-bp@alien8.de> References: <20220204083015.17317-1-bp@alien8.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Borislav Petkov Add a x86-specific cpumask_clear_cpu() helper which will be used in places where the explicit KASAN-instrumentation in the *_bit() helpers is unwanted. Also, always inline two more cpumask generic helpers. allyesconfig: text data bss dec hex filename 190553143 159425889 32076404 382055436 16c5b40c vmlinux.before 190551812 159424945 32076404 382053161 16c5ab29 vmlinux.after Signed-off-by: Borislav Petkov --- arch/x86/include/asm/cpumask.h | 10 ++++++++++ include/linux/cpumask.h | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/cpumask.h b/arch/x86/include/asm/cpumask.h index 3afa990d756b..c5aed9e9226c 100644 --- a/arch/x86/include/asm/cpumask.h +++ b/arch/x86/include/asm/cpumask.h @@ -20,11 +20,21 @@ static __always_inline bool arch_cpu_online(int cpu) { return arch_test_bit(cpu, cpumask_bits(cpu_online_mask)); } + +static __always_inline void arch_cpumask_clear_cpu(int cpu, struct cpumask *dstp) +{ + arch_clear_bit(cpumask_check(cpu), cpumask_bits(dstp)); +} #else static __always_inline bool arch_cpu_online(int cpu) { return cpu == 0; } + +static __always_inline void arch_cpumask_clear_cpu(int cpu, struct cpumask *dstp) +{ + return; +} #endif #define arch_cpu_is_offline(cpu) unlikely(!arch_cpu_online(cpu)) diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index 6b06c698cd2a..fe29ac7cc469 100644 --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h @@ -102,7 +102,7 @@ extern atomic_t __num_online_cpus; extern cpumask_t cpus_booted_once_mask; -static inline void cpu_max_bits_warn(unsigned int cpu, unsigned int bits) +static __always_inline void cpu_max_bits_warn(unsigned int cpu, unsigned int bits) { #ifdef CONFIG_DEBUG_PER_CPU_MAPS WARN_ON_ONCE(cpu >= bits); @@ -110,7 +110,7 @@ static inline void cpu_max_bits_warn(unsigned int cpu, unsigned int bits) } /* verify cpu argument to cpumask_* operators */ -static inline unsigned int cpumask_check(unsigned int cpu) +static __always_inline unsigned int cpumask_check(unsigned int cpu) { cpu_max_bits_warn(cpu, nr_cpumask_bits); return cpu; -- 2.29.2