Received: by 2002:ab2:1c04:0:b0:1f7:53ba:1ebe with SMTP id f4csp40673lqg; Fri, 26 Apr 2024 08:14:57 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX8yJb7G77+icN5XFidWg2M0BnQAj+8Hhkg0LAGIy9wdE03jl6ab42D5UoChZqWQrzdyHdVFB3r9zFpYd4FooV7dJ9ufI5Nol8JOy6SNg== X-Google-Smtp-Source: AGHT+IEwrMCpKMtwJ711uucgyZ0Q7QkqmfXiWRIP9JPT6F7feJfm1JKe1fld6YE0R9ZI/Oe4s/iH X-Received: by 2002:a9d:7a90:0:b0:6ed:c79f:e877 with SMTP id l16-20020a9d7a90000000b006edc79fe877mr2937496otn.12.1714144497667; Fri, 26 Apr 2024 08:14:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714144497; cv=pass; d=google.com; s=arc-20160816; b=C9sodRGUuP3DiurEXeFG1JB2+Yq1ZBMsJWcD3Cu3cgJIqrJ0HHB7qbPYtLiayb2rNZ mLfCSB4mtpXgIULJWpVY5vbrwaQ+jBWgfLIo3UIpZx9KFjJDEmGp3gjT2ngQhvxI/VAP xInifDAkDBt8yMwCAN0iV3t7ivQFOTys9u+mj1NBMpRCS2kvA7QP0IheU79qllzaizgz +mnko4xQ6EqhDr0Ck/uk2NYFdcYsebYvDORHVLvcCTQ4sn8q9SMO10/nUiTvz+97GE8W MEEWHbGr/5bkG3KcgyGcmKrtUHwCCT/C+zxG++YUAmm3d4XupfG4uNW4l/jUoLq0FURc me/w== 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=1/ZYqHT9rPzbJDGdpuCg6elWmmKTu17J3l6HAzqGZyU=; fh=Vo4MxA0u7CmSKYL/GjcyKHwusyvU+nKR43bqJem+vcY=; b=CfdR/UhMweHq/FkHHlir9g/6fydPHYVVssNSeYPlWWX0UPQuf87bg5+krf6qtd5ROi wjBofL+vmKu8hTYOY5czdic+MYH3lAPWw2nlWZUoTpRrBSVaPwVbVP7bqD3m6Y8XtEdj dtZPh3xk0EuhXjZ+kDI37vDTO8/g+8JRjid6o/V9/e3Fa+JDAKLeWuffd1Yz8crSzx5j E1+CorWQ+j821VE2WgXoFOmdqT7fLzp/5VfA/iMc6WBowOfXD9NDXwneB5MR6reDnjEN SCuHK+9e2hBLGvYtfcN++dLov+sNGOqCmS8ODeTCIi3Tg3dSa7wCcpD0pFhDautNuyOE IG6g==; 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-160241-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160241-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id s18-20020a056102109200b0047b96e6242dsi3523315vsr.668.2024.04.26.08.14.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 08:14:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-160241-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; 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-160241-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160241-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 5F4BE1C21039 for ; Fri, 26 Apr 2024 15:14:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 84AE617106C; Fri, 26 Apr 2024 15:10:26 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A461716FF5F for ; Fri, 26 Apr 2024 15:10:24 +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=1714144226; cv=none; b=UIIzQR6G3yx9AeR4/ueAxZw1KSA+znNatuJJyfRwBayF9s0J8E0ZkDYy64+4X1JUwsyiY8fReJ76fLtPJTLKB1Zn1iV1AVfZHIgxenTAcE45/WuIDuKclCGiNvEukcuB5WedrMpMt7pCK7EH7Ijj0E+B6MnJ444p/y2Zg86cLvI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714144226; c=relaxed/simple; bh=Yc/Du8TTACSvFMbPAG+zasNqe/csSB/NLpP9Ig58bBM=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=a3/eTbc20I9awGWA6WZzRMGKWZN2GZ3UWRKTmpTaU6ou+8eoNY7TQ6CdB6ZFuEE2goFooiw2SU+Pr6uovDfwHljhqWYcXOaJlC+9K0v88BHiQ+U1bbPjjuCETmZ5n7T5nVX50/Ld5L/ZhaESWSjxSYWUcgJvk5369aBSaiyQPHE= 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 210321682; Fri, 26 Apr 2024 08:10:52 -0700 (PDT) Received: from e133380.cambridge.arm.com (e133380.arm.com [10.1.197.52]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3C3013F73F; Fri, 26 Apr 2024 08:10:21 -0700 (PDT) From: Dave Martin To: x86@kernel.org, linux-kernel@vger.kernel.org Cc: James Morse , Fenghua Yu , Reinette Chatre , Thomas Gleixner , Ingo Molnar , Borislav Petkov , H Peter Anvin , Babu Moger , shameerali.kolothum.thodi@huawei.com, D Scott Phillips OS , carl@os.amperecomputing.com, lcherian@marvell.com, bobo.shaobowang@huawei.com, "Shaopeng Tan (Fujitsu)" , baolin.wang@linux.alibaba.com, Jamie Iles , Xin Hao , Peter Newman , dfustini@baylibre.com, amitsinght@marvell.com, David Hildenbrand , Rex Nie Subject: [PATCH v2 23/35] x86/resctrl: Move thread_throttle_mode_init() to be managed by resctrl Date: Fri, 26 Apr 2024 16:08:52 +0100 Message-Id: <20240426150904.8854-23-Dave.Martin@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240426150904.8854-1-Dave.Martin@arm.com> References: <20240426150537.8094-1-Dave.Martin@arm.com> <20240426150904.8854-1-Dave.Martin@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 From: James Morse 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 6ca986d3f5f2..ff209ba9176e 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -2067,10 +2067,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; @@ -4196,6 +4201,8 @@ int __init resctrl_init(void) rdtgroup_setup_default(); + thread_throttle_mode_init(); + ret = resctrl_mon_resource_init(); if (ret) return ret; -- 2.34.1