Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp606591lqp; Thu, 21 Mar 2024 10:03:48 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVHaW+1WHRmkecOTzwHSUaEf1/iGz7+HlF2O8TRR3Dm2Tc6/pMUNKmiYE9w04pYZLpptdphYJhgLHaw84oSbXqx5kedXtfiG1uRaNJZKQ== X-Google-Smtp-Source: AGHT+IGgoS80w/ye/UXh7mhV65g8VLK3WpC83c7235LaK2Ifgs3mWSk2eRiVbtgSpqCw6Sj5GZyW X-Received: by 2002:a50:d5d0:0:b0:569:4831:5e5f with SMTP id g16-20020a50d5d0000000b0056948315e5fmr1889192edj.19.1711040628262; Thu, 21 Mar 2024 10:03:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711040628; cv=pass; d=google.com; s=arc-20160816; b=dbj6oVTWLzlgG3rJXOtwcd/fDmNUGwAm0BytgnwYPeG+3CzyTT6EEOc8VRA37K43lh feMyRcvYjXu6F4GciV/xO/3r+1mmMaRB6LgzEpJrUfsneam595uDqqH7bFTLBBCkeAmy AN6i75Y3Ogf/1SYcYYpGnwU5xvKeJ2afPskMVmysj5xBhhZ6ptDFJkxSCVKhfbcTLUah Y1uYotest1sfzLUlrqjlgx/o/W8rN4yD5+7ejfXcJmihaLIgvE+W+TaiRS5jFBR9c45E RlY4bygQm2qRHFSD446NHOyeUDplAl4o5G72MNMezDxMluOn/rLxzzvminZMLvAxqEVv pH2Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=42JSXxFmHRRe82JaSYINs1yU0sfBn83q+kr0qI1qWOA=; fh=knouHfhWmUABu+sT2q0nnGKUzC7/WRiZH1KSpGv7uFs=; b=ZhuQzwLk5v5fKdALO+Da/4n5UGL7Y2e0sEeAerSHskvbn4JTdxUKQZRzJ0dJM3+sY3 j77MIYef/daIIBZZeuB0A0yL/+PFqtxf7n5QuOKWecWC0JV/OFXYVhv+DfSNjFqKuPN3 kHYAuEcd+EzoXYligJ0qfv1Kj2Zf0NvlUI7LmC+K8FXkGEJ8xtBviMTom9nIxTE1XXfq w0blhaUOUA7YlddzHcKNvVTP3HBihdn4UfGt4xNNBGqjVwjlILv1fqCicpbZNYLYxL7o vYmVAFv7JnZBJGgKo/xPskla1f71Ygae3sMxeZ429Ebc5Z9CLJfXy+v9hfI2CEZ9FSGB wV9A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-110440-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-110440-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id q27-20020a50cc9b000000b00568a61b191asi62704edi.396.2024.03.21.10.03.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Mar 2024 10:03:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-110440-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-110440-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-110440-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id E745A1F21B2F for ; Thu, 21 Mar 2024 17:03:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 35754140395; Thu, 21 Mar 2024 16:52:47 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8825614036D for ; Thu, 21 Mar 2024 16:52:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711039966; cv=none; b=qHJTlKH8ZlMd+aBmxDyOERVSy489Z+aYD59OshkXcseotvT8JqvtlQlxXysMSlboVpGlx3KufME9xaZF2OJWHJM0sJriAB5AutlNFl+Wo8GAfAAedb+a80AiaaH2Ko+MuzJSbZ/M17ehxMy+5m/drFIo1tY/9SX9Oas8ckAO1Nc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711039966; c=relaxed/simple; bh=4sbh/kqrZtrfXlsKx3MPM+skeCX9CMiUPgiESH/gTYI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=n8VIM3xSnjRqT/rXkNZJAZtJq3e4RiWr6aBnltN4FsmZYWI0yzhQTqKSO7bcHhgzMi0jLBsbFUl4DZF9OpZTMg55ir8AkyuY84aUplT3e+o9vZXT7PzSs39M5rp1K9ZWy4PRSr81wTXIRzL5TIhBhHj+RvNHsM1DgZseDVtvys8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 66F9F1063; Thu, 21 Mar 2024 09:53:18 -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 281B13F67D; Thu, 21 Mar 2024 09:52:41 -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, David Hildenbrand , Rex Nie , Dave Martin Subject: [PATCH v1 23/31] x86/resctrl: Move thread_throttle_mode_init() to be managed by resctrl Date: Thu, 21 Mar 2024 16:50:58 +0000 Message-Id: <20240321165106.31602-24-james.morse@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20240321165106.31602-1-james.morse@arm.com> References: <20240321165106.31602-1-james.morse@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit thread_throttle_mode_init() is called from the architecture specific code to make the 'thread_throttle_mode' file visible. The architecture specific code has already set the membw.throttle_mode in the rdt_resource. This doesn't need to be specific to the architecture, the throttle_mode can be used by resctrl to determine if the 'thread_throttle_mode' file should be visible. Call thread_throttle_mode_init() from resctrl_setup(), check the membw.throttle_mode on the MBA resource. This avoids publishing an extra function between the architecture and filesystem code. Signed-off-by: James Morse --- arch/x86/kernel/cpu/resctrl/core.c | 1 - arch/x86/kernel/cpu/resctrl/internal.h | 1 - arch/x86/kernel/cpu/resctrl/rdtgroup.c | 9 ++++++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c index 824a94593e9d..7cdecd8ac00b 100644 --- a/arch/x86/kernel/cpu/resctrl/core.c +++ b/arch/x86/kernel/cpu/resctrl/core.c @@ -227,7 +227,6 @@ static bool __get_mem_config_intel(struct rdt_resource *r) r->membw.throttle_mode = THREAD_THROTTLE_PER_THREAD; else r->membw.throttle_mode = THREAD_THROTTLE_MAX; - thread_throttle_mode_init(); r->alloc_capable = true; diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index be4e8f31b127..e849d4407769 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -478,7 +478,6 @@ void cqm_handle_limbo(struct work_struct *work); bool has_busy_rmid(struct rdt_domain *d); void __check_limbo(struct rdt_domain *d, bool force_free); void rdt_domain_reconfigure_cdp(struct rdt_resource *r); -void __init thread_throttle_mode_init(void); void mbm_config_rftype_init(const char *config); void rdt_staged_configs_clear(void); bool closid_allocated(unsigned int closid); diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c index 9275d6f8a74e..702a94fad6db 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -2069,10 +2069,15 @@ static struct rftype *rdtgroup_get_rftype_by_name(const char *name) return NULL; } -void __init thread_throttle_mode_init(void) +static void __init thread_throttle_mode_init(void) { + struct rdt_resource *r = resctrl_arch_get_resource(RDT_RESOURCE_MBA); struct rftype *rft; + if (!r->alloc_capable || + r->membw.throttle_mode == THREAD_THROTTLE_UNDEFINED) + return; + rft = rdtgroup_get_rftype_by_name("thread_throttle_mode"); if (!rft) return; @@ -4194,6 +4199,8 @@ int __init resctrl_init(void) rdtgroup_setup_default(); + thread_throttle_mode_init(); + ret = resctrl_mon_resource_init(); if (ret) return ret; -- 2.39.2