Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2747808rda; Wed, 25 Oct 2023 11:05:14 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE6jSacS5Pv0979yoYe7M06PAlORgieh/yZa86h/T8jKKO9gftqxDpj0pr3IA/eG1W76ZhK X-Received: by 2002:a05:690c:dc9:b0:59f:61b6:f584 with SMTP id db9-20020a05690c0dc900b0059f61b6f584mr19706756ywb.9.1698257113936; Wed, 25 Oct 2023 11:05:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698257113; cv=none; d=google.com; s=arc-20160816; b=Ommz7II8CeQrK9AuVG1X0XK7asb8RM6W2CkybU3B5nO4rxgNXLP9Fw0ECtT1tpycpY tMhOvK2FH/1Md1O5bf95gt9j6SRzGz13BtSlU3hfJGRMJzFtQRuMh58sIPf0AbgoFnSN kex93ub5ilqMwB3VQVL+BUCL0kwOmVrFUIXpqZodEZ4Q1WCJc7JKnt76DxcOxBhSMrIP gjSDq8E1/H4IsXCpk14+x7mdRt4F4fdVnjAvf6ABytcrPhlT3D8p8OimTVHGs4mPucaL HyOJN2+6F5b7/OVt+MS8+dxfCrsBDoRcZsmQbZQNGbZVMnRGeuKCGLcATw4HRLk2s5eD X5Yw== 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; bh=Y728JWkQ0n8eY13e4n7rw4iGfj3LAYGB5X/HQguR0aw=; fh=xjsbdB8NZJzbiqygyESgWUxyd4BI3/oiWXjD1LwrF60=; b=ApBe7ePS+ayGZ8PUZnfB2+mWiJ9l41cuxX69OHNlAYv9N2iB5fU2C5cMR64h7HVUIX rgu4qnOCPfLjxTzJFolcTU6YfcM+inzcSumj/yQOF3v0IuD22TdiYSoyAr9chfF60PX2 4H5G6r0km1nUmxJUiSQ0hiqKbYIABUsncUoE3fk+96NZwGTuvMFMjtkPShUdj9Dmwhq7 2M4zHLTa1e3u6KOLVi0RTmuPRBxaIRR34iAQpPYl2wg2dY9Gi4KniMGThqu8DiiBA15Q /oyBY+adgXxYPsEahsYQAOTxfs+cph5xlbQK22JBKyxN+ijdLMdbaaheH8CgtQu1S7sz MhRg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id n6-20020a819e46000000b005a22fa409a0si12324354ywj.462.2023.10.25.11.05.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Oct 2023 11:05:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 3A8528023188; Wed, 25 Oct 2023 11:05:00 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229498AbjJYSEt (ORCPT + 99 others); Wed, 25 Oct 2023 14:04:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230035AbjJYSEr (ORCPT ); Wed, 25 Oct 2023 14:04:47 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id F14F2123 for ; Wed, 25 Oct 2023 11:04:43 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5202A1FB; Wed, 25 Oct 2023 11:05:25 -0700 (PDT) Received: from merodach.members.linode.com (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6DFB83F738; Wed, 25 Oct 2023 11:04:40 -0700 (PDT) From: James Morse To: x86@kernel.org, linux-kernel@vger.kernel.org Cc: Fenghua Yu , Reinette Chatre , Thomas Gleixner , Ingo Molnar , Borislav Petkov , H Peter Anvin , Babu Moger , James Morse , shameerali.kolothum.thodi@huawei.com, D Scott Phillips OS , carl@os.amperecomputing.com, lcherian@marvell.com, bobo.shaobowang@huawei.com, tan.shaopeng@fujitsu.com, baolin.wang@linux.alibaba.com, Jamie Iles , Xin Hao , peternewman@google.com, dfustini@baylibre.com, amitsinght@marvell.com, Frederic Weisbecker Subject: [PATCH v7 01/24] tick/nohz: Move tick_nohz_full_mask declaration outside the #ifdef Date: Wed, 25 Oct 2023 18:03:22 +0000 Message-Id: <20231025180345.28061-2-james.morse@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20231025180345.28061-1-james.morse@arm.com> References: <20231025180345.28061-1-james.morse@arm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 25 Oct 2023 11:05:00 -0700 (PDT) tick_nohz_full_mask lists the CPUs that are nohz_full. This is only needed when CONFIG_NO_HZ_FULL is defined. tick_nohz_full_cpu() allows a specific CPU to be tested against the mask, and evaluates to false when CONFIG_NO_HZ_FULL is not defined. The resctrl code needs to pick a CPU to run some work on, a new helper prefers housekeeping CPUs by examining the tick_nohz_full_mask. Hiding the declaration behind #ifdef CONFIG_NO_HZ_FULL forces all the users to be behind an ifdef too. Move the tick_nohz_full_mask declaration, this lets callers drop the ifdef, and guard access to tick_nohz_full_mask with IS_ENABLED() or something like tick_nohz_full_cpu(). The definition does not need to be moved as any callers should be removed at compile time unless CONFIG_NO_HZ_FULL is defined. Tested-by: Shaopeng Tan Tested-by: Peter Newman Reviewed-by: Shaopeng Tan Acked-by: Reinette Chatre # for resctrl dependency CC: Frederic Weisbecker Signed-off-by: James Morse --- No changes since v6 include/linux/tick.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/linux/tick.h b/include/linux/tick.h index 716d17f31c45..0fb903838dfb 100644 --- a/include/linux/tick.h +++ b/include/linux/tick.h @@ -164,9 +164,16 @@ static inline u64 get_cpu_idle_time_us(int cpu, u64 *unused) { return -1; } static inline u64 get_cpu_iowait_time_us(int cpu, u64 *unused) { return -1; } #endif /* !CONFIG_NO_HZ_COMMON */ +/* + * Mask of CPUs that are nohz_full. + * + * Users should be guarded by CONFIG_NO_HZ_FULL or a tick_nohz_full_cpu() + * check. + */ +extern cpumask_var_t tick_nohz_full_mask; + #ifdef CONFIG_NO_HZ_FULL extern bool tick_nohz_full_running; -extern cpumask_var_t tick_nohz_full_mask; static inline bool tick_nohz_full_enabled(void) { -- 2.39.2