Received: by 2002:ab2:715a:0:b0:1fd:c064:50c with SMTP id l26csp13481lqm; Mon, 10 Jun 2024 11:05:56 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWek1DaLzlWBNfTQuKwC9SoZyhtZXSuUrYn70YD1bzU2lKJLy4w6u3wYqa0VTW1QLhbxKTW5tBjHwyjvRxoZ9zz2AMkZvioOyY+raXdYg== X-Google-Smtp-Source: AGHT+IFnZm7mY7QtQeIfGyBvSgdxEuqaN0mAurtHs7pOLQrstYzgNk17mSYKQQp1Sbzt0wu5BKRu X-Received: by 2002:a05:6a00:9297:b0:704:24fb:11b8 with SMTP id d2e1a72fcca58-70424fb15efmr7399596b3a.7.1718042756318; Mon, 10 Jun 2024 11:05:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718042756; cv=pass; d=google.com; s=arc-20160816; b=o0JIq1FHDs+z0NTWC4w0vbJVBrJF16TvpGdENCPWbKyEED4G2CECpwi2J4kxGMK7QK rEPcKsK9t3WyViDdpbM0Knt4yxZ8T8We0pP/DLUQ13n2F56RhtEEqvOYrUhqCL7+qQY9 XtP2oakibh7cdwBF36WAQhAYsIImQ/sUTfWuoDB4svQwGLekT9GrCIGlLwHPWaafKjlN G8lI24+TKsgDa2hvOtFTUdSEmavEjr8hcX1fTcSSKis4nI33k5rSUrBA6whZmx+aT83P v97osPeKG/7EoW/KAgoB6uVfdGQUsf7j2zubVy48sg8qPLOog569s/mWYBrqVcqtX7Ml 5wqg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:precedence:robot-unsubscribe:robot-id :message-id:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:in-reply-to:cc:subject:to:reply-to:sender :from:dkim-signature:dkim-signature:date; bh=NffsW6uZ57Snj3nWvpu+1CVOleFQgv1NeJ/HKebzorI=; fh=rgzFxqIsD/RjvOa/G1XDpaJO5ocvolqkb+yxWEJTqlY=; b=sZPJHxYhm8+HWKoJVeZjfRU/9IX+8HxLkK4HAOPPkHBL5JMyD9vcZ30wb917db1I/d AY4yL1Au1J/br2W1gdWwKziF+X/z9QcVPBD/pa9V+rgZala0doxV3EzACvDEnFbIbn1Z ddGVPrd/bGUDQBt/vzMlkZd5jqcG+czOVsms152RHxWWAlWCD7tWKO1LUSROkx7JHYVa M6eEcDGXI6TONAcQT5yY4pBJjp600IALpdRP8MNomI/+L8FirwW0GMR43SeLHabV/2OG Oe2imZOJJdurW6L4JcMm/OFvIAjRm/pTxCmiCutZ7VgxnZRf/P5mAtvtv1/KY3KOfrtZ Fq7g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=ERsMF2mz; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=bJeUToxX; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-208660-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208660-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id d2e1a72fcca58-7059830f876si1903882b3a.219.2024.06.10.11.05.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 11:05:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-208660-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=ERsMF2mz; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=bJeUToxX; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-208660-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208660-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 7230BB20D04 for ; Mon, 10 Jun 2024 17:36:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8CAA314C581; Mon, 10 Jun 2024 17:35:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="ERsMF2mz"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="bJeUToxX" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A46EB145352; Mon, 10 Jun 2024 17:35:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718040951; cv=none; b=BLXSkj2oFZX2t5dBzBH9zHM4ITAHFekArqULgu1I0p5vfy4++zwlmOxFUZo0H8l0rBOcia22sTOVk2K8qzIbIHELmivjnGW39d4kFNhTPWL1D96Mb8ihRxwDsTIKEu0++MJHDrm2l9jEgMfpeysxXFDyVNbTHWYdfu12Wey8JWk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718040951; c=relaxed/simple; bh=gEG+O/kRTGA0aqpC27gaYWrZS67zXd5MN0Rohk5FXDM=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=VsVYhcQ0PpX8ODwq+e+KdHDd0aO2eWAiapYgXbcWAYNLbDI7kHsaVmCpNrO6ef1/t2Jmvw4vKGnWTc20e+oy7G22+fqPb/RMk/L49wGuDaGCgyNdhXLn879dtIEuro3eLfcVpg4AQdYwDdGlPe5WB65Ka939eV+Dk+/BGCrN6jM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=ERsMF2mz; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=bJeUToxX; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Date: Mon, 10 Jun 2024 17:35:46 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1718040946; h=from:from:sender:sender:reply-to: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; bh=NffsW6uZ57Snj3nWvpu+1CVOleFQgv1NeJ/HKebzorI=; b=ERsMF2mz/lluYDVRJHVIwJk8ciqS/rkHMJOUzN5gFWkEL2NqYWb3CrpBmEKbOKmtkUSn7Q kERsDI4smW0H5BYjwVmyv45/rWJx4JDzFmPQ7FOAnKIMjxF2S9YG4S3Gs4scRZn7KzfzjS ugNB7bJZgwlRdlVUOEXXx55IYEgTgDcC33GAAJbt+TfhH/XQimVkiHpHuXUuPNReCZMr5Y Zo7ehdJURWz3TNhCN0Px7p0LXYcCU1scd1wlAznBXN4dR2yIRBRZK4Xq0TOc4Jlshqj50q dJvW6m9NZs/BRS3vbZQESqR/vW/5S77Nr/lUNAhKZYNdkwqYSHdsNKzqkIYUUA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1718040946; h=from:from:sender:sender:reply-to: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; bh=NffsW6uZ57Snj3nWvpu+1CVOleFQgv1NeJ/HKebzorI=; b=bJeUToxXjsKqkooVL/vZcw4rQ566YQ9bse9Lm4VfEOxDd4iUNDKRgNPwoFcG+QWOBGXbTn LCGFKOC9C3P54sBw== From: "tip-bot2 for Tony Luck" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/cache] cpu: Move CPU hotplug function declarations into their own header Cc: Tony Luck , "Borislav Petkov (AMD)" , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20240610003927.341707-2-tony.luck@intel.com> References: <20240610003927.341707-2-tony.luck@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <171804094660.10875.17112044985703584861.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit The following commit has been merged into the x86/cache branch of tip: Commit-ID: 195fb517ee25bfefde9c74ecd86348eccbd6d2e4 Gitweb: https://git.kernel.org/tip/195fb517ee25bfefde9c74ecd86348eccbd6d2e4 Author: Tony Luck AuthorDate: Sun, 09 Jun 2024 17:39:24 -07:00 Committer: Borislav Petkov (AMD) CommitterDate: Mon, 10 Jun 2024 08:50:01 +02:00 cpu: Move CPU hotplug function declarations into their own header Avoid upcoming #include hell when wants to use lockdep_assert_cpus_held() and creates a #include loop that would break the build for arch/riscv. [ bp: s/cpu/CPU/g ] Signed-off-by: Tony Luck Signed-off-by: Borislav Petkov (AMD) Link: https://lore.kernel.org/r/20240610003927.341707-2-tony.luck@intel.com --- include/linux/cpu.h | 33 +--------------------------- include/linux/cpuhplock.h | 47 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 48 insertions(+), 32 deletions(-) create mode 100644 include/linux/cpuhplock.h diff --git a/include/linux/cpu.h b/include/linux/cpu.h index 861c3bf..a8926d0 100644 --- a/include/linux/cpu.h +++ b/include/linux/cpu.h @@ -18,6 +18,7 @@ #include #include #include +#include #include struct device; @@ -132,38 +133,6 @@ static inline int add_cpu(unsigned int cpu) { return 0;} #endif /* CONFIG_SMP */ extern const struct bus_type cpu_subsys; -extern int lockdep_is_cpus_held(void); - -#ifdef CONFIG_HOTPLUG_CPU -extern void cpus_write_lock(void); -extern void cpus_write_unlock(void); -extern void cpus_read_lock(void); -extern void cpus_read_unlock(void); -extern int cpus_read_trylock(void); -extern void lockdep_assert_cpus_held(void); -extern void cpu_hotplug_disable(void); -extern void cpu_hotplug_enable(void); -void clear_tasks_mm_cpumask(int cpu); -int remove_cpu(unsigned int cpu); -int cpu_device_down(struct device *dev); -extern void smp_shutdown_nonboot_cpus(unsigned int primary_cpu); - -#else /* CONFIG_HOTPLUG_CPU */ - -static inline void cpus_write_lock(void) { } -static inline void cpus_write_unlock(void) { } -static inline void cpus_read_lock(void) { } -static inline void cpus_read_unlock(void) { } -static inline int cpus_read_trylock(void) { return true; } -static inline void lockdep_assert_cpus_held(void) { } -static inline void cpu_hotplug_disable(void) { } -static inline void cpu_hotplug_enable(void) { } -static inline int remove_cpu(unsigned int cpu) { return -EPERM; } -static inline void smp_shutdown_nonboot_cpus(unsigned int primary_cpu) { } -#endif /* !CONFIG_HOTPLUG_CPU */ - -DEFINE_LOCK_GUARD_0(cpus_read_lock, cpus_read_lock(), cpus_read_unlock()) - #ifdef CONFIG_PM_SLEEP_SMP extern int freeze_secondary_cpus(int primary); extern void thaw_secondary_cpus(void); diff --git a/include/linux/cpuhplock.h b/include/linux/cpuhplock.h new file mode 100644 index 0000000..386abc4 --- /dev/null +++ b/include/linux/cpuhplock.h @@ -0,0 +1,47 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * include/linux/cpuhplock.h - CPU hotplug locking + * + * Locking functions for CPU hotplug. + */ +#ifndef _LINUX_CPUHPLOCK_H_ +#define _LINUX_CPUHPLOCK_H_ + +#include +#include + +struct device; + +extern int lockdep_is_cpus_held(void); + +#ifdef CONFIG_HOTPLUG_CPU +extern void cpus_write_lock(void); +extern void cpus_write_unlock(void); +extern void cpus_read_lock(void); +extern void cpus_read_unlock(void); +extern int cpus_read_trylock(void); +extern void lockdep_assert_cpus_held(void); +extern void cpu_hotplug_disable(void); +extern void cpu_hotplug_enable(void); +void clear_tasks_mm_cpumask(int cpu); +int remove_cpu(unsigned int cpu); +int cpu_device_down(struct device *dev); +extern void smp_shutdown_nonboot_cpus(unsigned int primary_cpu); + +#else /* CONFIG_HOTPLUG_CPU */ + +static inline void cpus_write_lock(void) { } +static inline void cpus_write_unlock(void) { } +static inline void cpus_read_lock(void) { } +static inline void cpus_read_unlock(void) { } +static inline int cpus_read_trylock(void) { return true; } +static inline void lockdep_assert_cpus_held(void) { } +static inline void cpu_hotplug_disable(void) { } +static inline void cpu_hotplug_enable(void) { } +static inline int remove_cpu(unsigned int cpu) { return -EPERM; } +static inline void smp_shutdown_nonboot_cpus(unsigned int primary_cpu) { } +#endif /* !CONFIG_HOTPLUG_CPU */ + +DEFINE_LOCK_GUARD_0(cpus_read_lock, cpus_read_lock(), cpus_read_unlock()) + +#endif /* _LINUX_CPUHPLOCK_H_ */