From nobody Wed Dec 17 21:28:17 2025 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) (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 BF5C81FD7B6; Fri, 6 Dec 2024 16:31:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733502717; cv=none; b=rkWU9iMKm/oBwqxniyWi3jZGzmvcKgt9wEalLD18n/mLe4eFczwnUhxMNqXRyvBlRpcoHX1lVCh/1UsCe0L9KhtmJdQxWDb4zYiQmwFMb6QfsbqPa7GfnhrjJuDtQAbPGURekFeb7PqhVPLet4EEXd7KYe2H7hW2A75V/TUdCBU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733502717; c=relaxed/simple; bh=etYTqm8AfEupX4Sz/Qe4oxk7xfQXUQaQ2A4+EV+f2O8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=LePobAlOStX6wCkuq9Ia8C6E3axuF3klh/C+/BbqB+s0tlcO81chTBZ5RMUqsIQP6LYA8a2lmwIB/DGAONudOijDl2dMbD/9rLwDo7R66jHntVodCxwcIGcR8mfgp+UNCcZ/hkTURD66TW5fXSHxruvyZS7Ml+M8gdi+WFTKU0c= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=mNdJxea6; arc=none smtp.client-ip=192.198.163.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="mNdJxea6" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1733502716; x=1765038716; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=etYTqm8AfEupX4Sz/Qe4oxk7xfQXUQaQ2A4+EV+f2O8=; b=mNdJxea6jSzgwNEgO6zNhBo/y49JJ21q3Xx7j5zevcqVh96nKSeS8nnB jrsMWtUYffZHfc+tYnp/WIF0ZYRvupcuh473sCWdzEoDRxJlgw70RVKZG nS1i29BUlBLasMDdgh/j+G8ea2BKgwjZLR07z8PL5JU7Rh+aKB7nMrFnZ mLiYTDXzS8LHvxCPdNVwN2/YDwvrW+v0J9tAJAPj7hnzI8x7hTFaemVRf Ur7D0XylQwxJo0pkEAq/WuhmQchcF6i3zSOqeSqntQRlRVuiErdDEXcul bWQ+FRrJniSBQu8FFrMq+vNYdCyCJgkX8DSe8O6t2QAe+23TyhOsfDbUL A==; X-CSE-ConnectionGUID: bnubhCALQ9+DbxXY9xzQsg== X-CSE-MsgGUID: 7f6kXjQ9RnakYWJh5wEYIA== X-IronPort-AV: E=McAfee;i="6700,10204,11278"; a="44470374" X-IronPort-AV: E=Sophos;i="6.12,213,1728975600"; d="scan'208";a="44470374" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Dec 2024 08:31:53 -0800 X-CSE-ConnectionGUID: iGFuzyo8SX2h4pRq0cc9Pg== X-CSE-MsgGUID: 3vaGiT05R22bXwX4YTjw7Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,213,1728975600"; d="scan'208";a="95258502" Received: from agluck-desk3.sc.intel.com ([172.25.222.70]) by orviesa008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Dec 2024 08:31:53 -0800 From: Tony Luck To: Fenghua Yu , Reinette Chatre , Peter Newman , Jonathan Corbet , x86@kernel.org Cc: James Morse , Jamie Iles , Babu Moger , Randy Dunlap , "Shaopeng Tan (Fujitsu)" , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, patches@lists.linux.dev, Tony Luck Subject: [PATCH v11 1/8] x86/resctrl: Introduce resctrl_file_fflags_init() to initialize fflags Date: Fri, 6 Dec 2024 08:31:41 -0800 Message-ID: <20241206163148.83828-2-tony.luck@intel.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241206163148.83828-1-tony.luck@intel.com> References: <20241206163148.83828-1-tony.luck@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Babu Moger thread_throttle_mode_init() and mbm_config_rftype_init() both initialize fflags for resctrl files. Adding new files will involve adding another function to initialize the fflags. This can be simplified by adding a new function resctrl_file_fflags_init() and passing the file name and flags to be initialized. Consolidate fflags initialization into resctrl_file_fflags_init() and remove thread_throttle_mode_init() and mbm_config_rftype_init(). [Tony: Drop __init attribute so resctrl_file_fflags_init() can be used at run time] Signed-off-by: Babu Moger Signed-off-by: Tony Luck Reviewed-by: Reinette Chatre Tested-by: Babu Moger --- arch/x86/kernel/cpu/resctrl/internal.h | 3 +-- arch/x86/kernel/cpu/resctrl/core.c | 4 +++- arch/x86/kernel/cpu/resctrl/monitor.c | 6 ++++-- arch/x86/kernel/cpu/resctrl/rdtgroup.c | 15 ++------------- 4 files changed, 10 insertions(+), 18 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/r= esctrl/internal.h index 955999aecfca..faaff9d64102 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -647,8 +647,7 @@ void cqm_handle_limbo(struct work_struct *work); bool has_busy_rmid(struct rdt_mon_domain *d); void __check_limbo(struct rdt_mon_domain *d, bool force_free); void rdt_domain_reconfigure_cdp(struct rdt_resource *r); -void __init thread_throttle_mode_init(void); -void __init mbm_config_rftype_init(const char *config); +void resctrl_file_fflags_init(const char *config, unsigned long fflags); void rdt_staged_configs_clear(void); bool closid_allocated(unsigned int closid); int resctrl_find_cleanest_closid(void); diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resct= rl/core.c index b681c2e07dbf..f3ee5859b69d 100644 --- a/arch/x86/kernel/cpu/resctrl/core.c +++ b/arch/x86/kernel/cpu/resctrl/core.c @@ -234,7 +234,9 @@ static __init bool __get_mem_config_intel(struct rdt_re= source *r) r->membw.throttle_mode =3D THREAD_THROTTLE_PER_THREAD; else r->membw.throttle_mode =3D THREAD_THROTTLE_MAX; - thread_throttle_mode_init(); + + resctrl_file_fflags_init("thread_throttle_mode", + RFTYPE_CTRL_INFO | RFTYPE_RES_MB); =20 r->alloc_capable =3D true; =20 diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/re= sctrl/monitor.c index 5fcb3d635d91..69bdc11bacf8 100644 --- a/arch/x86/kernel/cpu/resctrl/monitor.c +++ b/arch/x86/kernel/cpu/resctrl/monitor.c @@ -1224,11 +1224,13 @@ int __init rdt_get_mon_l3_config(struct rdt_resourc= e *r) =20 if (rdt_cpu_has(X86_FEATURE_CQM_MBM_TOTAL)) { mbm_total_event.configurable =3D true; - mbm_config_rftype_init("mbm_total_bytes_config"); + resctrl_file_fflags_init("mbm_total_bytes_config", + RFTYPE_MON_INFO | RFTYPE_RES_CACHE); } if (rdt_cpu_has(X86_FEATURE_CQM_MBM_LOCAL)) { mbm_local_event.configurable =3D true; - mbm_config_rftype_init("mbm_local_bytes_config"); + resctrl_file_fflags_init("mbm_local_bytes_config", + RFTYPE_MON_INFO | RFTYPE_RES_CACHE); } } =20 diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/r= esctrl/rdtgroup.c index d906a1cd8491..d333570e893d 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -2020,24 +2020,13 @@ static struct rftype *rdtgroup_get_rftype_by_name(c= onst char *name) return NULL; } =20 -void __init thread_throttle_mode_init(void) -{ - struct rftype *rft; - - rft =3D rdtgroup_get_rftype_by_name("thread_throttle_mode"); - if (!rft) - return; - - rft->fflags =3D RFTYPE_CTRL_INFO | RFTYPE_RES_MB; -} - -void __init mbm_config_rftype_init(const char *config) +void resctrl_file_fflags_init(const char *config, unsigned long fflags) { struct rftype *rft; =20 rft =3D rdtgroup_get_rftype_by_name(config); if (rft) - rft->fflags =3D RFTYPE_MON_INFO | RFTYPE_RES_CACHE; + rft->fflags =3D fflags; } =20 /** --=20 2.47.0 From nobody Wed Dec 17 21:28:17 2025 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) (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 1D5051FD7A7; Fri, 6 Dec 2024 16:31:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733502716; cv=none; b=p2EglsW+VtrgqT4ryOLLheVTsXW5iMCf/9jz4QmtaLJBVCb/wKgb2CgJizxciSYrXMHD+BPZ+b+Rpovo/0oHGlbvUdznCYNiV3k73wPNYToHhinq+QVn8LJhVzRrlpr6ig0+hUFrC+Tetg1svczAzIPIP2O2sjbWGq4bnPG6N2U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733502716; c=relaxed/simple; bh=pJ/tsmO8xEKFasqra1vQfrzHy5pCaTXX58/S2T5W1Cs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=REzu8gblW72sS4sPeXH1MOOyJAaJkc+vga8YqUwpldZjTaR6wCLhQMxLqk28QkO4upxkcV3Tjhs8jABLnLTM0IroT/VnyPZI/ZX/REPLLbayQq05JKaOu5Gmtu2ilOHgoWUk3oF7UhM/mKL/ThbzzvhBBEygxUqEkwynJh5R2AQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=hSOLxUWu; arc=none smtp.client-ip=192.198.163.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="hSOLxUWu" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1733502715; x=1765038715; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=pJ/tsmO8xEKFasqra1vQfrzHy5pCaTXX58/S2T5W1Cs=; b=hSOLxUWuAjlXMrO5OjqkvG0Y5JvjydQgK4dzFdtGZrHBMN0hb3KnuI1g KgcK0D93HxvCwXoyMYcJgw8hIKyvDpWpFxEgJhmOTBX4NERQGlQDrHKSd OhNErkiWtp6gNc6BMCds3Z3AWvI5QQz5i5LdWw+bXUsFLDzbZT00AHGeo AAcB/hKW4G5qZ8ZCsleBVQxf5m5GU5onWh7wP/FPznTPeyy1arYfSAsqb y/ZS1dsCDmEPkJPNVNA4/JFuuOOuwk/Nn+GsGJIvIMDkIHci++qMcpsz5 PoVjaT53H9+hM4mTzLkoWJHnYA/BV+pWA4a/Pe3y8ua/XS9ZBqn59Zaee Q==; X-CSE-ConnectionGUID: /N5PE7XgQ+aHIXylQTPOmw== X-CSE-MsgGUID: jelANl/NSyKVQXBYtNG7zg== X-IronPort-AV: E=McAfee;i="6700,10204,11278"; a="44470384" X-IronPort-AV: E=Sophos;i="6.12,213,1728975600"; d="scan'208";a="44470384" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Dec 2024 08:31:54 -0800 X-CSE-ConnectionGUID: 1q793AjgTHyi1PteVP4Dyw== X-CSE-MsgGUID: bp2Xcc54QHuVF+qZRkJspg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,213,1728975600"; d="scan'208";a="95258506" Received: from agluck-desk3.sc.intel.com ([172.25.222.70]) by orviesa008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Dec 2024 08:31:54 -0800 From: Tony Luck To: Fenghua Yu , Reinette Chatre , Peter Newman , Jonathan Corbet , x86@kernel.org Cc: James Morse , Jamie Iles , Babu Moger , Randy Dunlap , "Shaopeng Tan (Fujitsu)" , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, patches@lists.linux.dev, Tony Luck Subject: [PATCH v11 2/8] x86/resctrl: Prepare for per-CTRL_MON group mba_MBps control Date: Fri, 6 Dec 2024 08:31:42 -0800 Message-ID: <20241206163148.83828-3-tony.luck@intel.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241206163148.83828-1-tony.luck@intel.com> References: <20241206163148.83828-1-tony.luck@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Resctrl uses local memory bandwidth event as input to the feedback loop when the mba_MBps mount option is used. This means that this mount option cannot be used on systems that only support monitoring of total bandwidth. Prepare to allow users to choose the input event independently for each CTRL_MON group by adding a global variable "mba_mbps_default_event" used to set the default event for each CTRL_MON group, and a new field "mba_mbps_event" in struct rdtgroup to track which event is used for each CTRL_MON group. Notes: 1) Both of these are only used when the user mounts the filesystem with the "mba_MBps" option. 2) Only check for support of local bandwidth event when initializing mba_mbps_default_event. Support for total bandwidth event can be added after other routines in resctrl have been updated to handle total bandwidth event. Signed-off-by: Tony Luck Reviewed-by: Reinette Chatre Tested-by: Babu Moger --- include/linux/resctrl.h | 2 ++ arch/x86/kernel/cpu/resctrl/internal.h | 2 ++ arch/x86/kernel/cpu/resctrl/core.c | 3 +++ arch/x86/kernel/cpu/resctrl/rdtgroup.c | 13 +++++++++++++ 4 files changed, 20 insertions(+) diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h index d94abba1c716..fd05b937e2f4 100644 --- a/include/linux/resctrl.h +++ b/include/linux/resctrl.h @@ -49,6 +49,8 @@ enum resctrl_event_id { QOS_L3_MBM_LOCAL_EVENT_ID =3D 0x03, }; =20 +extern enum resctrl_event_id mba_mbps_default_event; + /** * struct resctrl_staged_config - parsed configuration to be applied * @new_ctrl: new ctrl value to be loaded diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/r= esctrl/internal.h index faaff9d64102..485800055a7d 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -283,6 +283,7 @@ struct pseudo_lock_region { * monitor only or ctrl_mon group * @mon: mongroup related data * @mode: mode of resource group + * @mba_mbps_event: input monitoring event id when mba_sc is enabled * @plr: pseudo-locked region */ struct rdtgroup { @@ -295,6 +296,7 @@ struct rdtgroup { enum rdt_group_type type; struct mongroup mon; enum rdtgrp_mode mode; + enum resctrl_event_id mba_mbps_event; struct pseudo_lock_region *plr; }; =20 diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resct= rl/core.c index f3ee5859b69d..94bf559966d6 100644 --- a/arch/x86/kernel/cpu/resctrl/core.c +++ b/arch/x86/kernel/cpu/resctrl/core.c @@ -963,6 +963,9 @@ static __init bool get_rdt_mon_resources(void) if (!rdt_mon_features) return false; =20 + if (is_mbm_local_enabled()) + mba_mbps_default_event =3D QOS_L3_MBM_LOCAL_EVENT_ID; + return !rdt_get_mon_l3_config(r); } =20 diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/r= esctrl/rdtgroup.c index d333570e893d..8a52b25ce26b 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -65,6 +65,15 @@ static void rdtgroup_destroy_root(void); =20 struct dentry *debugfs_resctrl; =20 +/* + * Memory bandwidth monitoring event to use for the default CTRL_MON group + * and each new CTRL_MON group created by the user. Only relevant when + * the filesystem is mounted with the "mba_MBps" option so it does not + * matter that it remains uninitialized on systems that do not support + * the "mba_MBps" option. + */ +enum resctrl_event_id mba_mbps_default_event; + static bool resctrl_debug; =20 void rdt_last_cmd_clear(void) @@ -2353,6 +2362,8 @@ static int set_mba_sc(bool mba_sc) =20 r->membw.mba_sc =3D mba_sc; =20 + rdtgroup_default.mba_mbps_event =3D mba_mbps_default_event; + list_for_each_entry(d, &r->ctrl_domains, hdr.list) { for (i =3D 0; i < num_closid; i++) d->mbps_val[i] =3D MBA_MAX_MBPS; @@ -3611,6 +3622,8 @@ static int rdtgroup_mkdir_ctrl_mon(struct kernfs_node= *parent_kn, rdt_last_cmd_puts("kernfs subdir error\n"); goto out_del_list; } + if (is_mba_sc(NULL)) + rdtgrp->mba_mbps_event =3D mba_mbps_default_event; } =20 goto out_unlock; --=20 2.47.0 From nobody Wed Dec 17 21:28:17 2025 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) (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 302B21FFC41; Fri, 6 Dec 2024 16:31:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733502718; cv=none; b=b8j1HYkl2nx0jSozmt2MgSDKFSbOb7yCHeEVxkVoCL/ehjmXNxIgP0hgzmX5ONIwibdsy73f6B177bCVK3Ciucw/ap7mijIVVOJFS+vynd790VTBI2peIZCEKbN4xkIIB534VoRtRF20BK58I7+Eiog9O2RhkKYmGwRvVTpecXY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733502718; c=relaxed/simple; bh=gi6s4jrFwCELUNGcLkgK6oa6vovHsOyBVbYmIAfSobM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dXGXS5LyIltDyr7t/G0Mp1AAwhYSM7c3/w8FnDilX7WXyAj/VyElUvdg5iPXZyxTalwRxDPrmWWbBa//tUv70knAmV61bsZQrCGGrPhgBNYj7n7cAGqdBOqjofESMJcs2gJDSZkjw7lKfZT+/XSfiRrh1fYYrpwVnfsCitqcV2o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Hjy1h64x; arc=none smtp.client-ip=192.198.163.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Hjy1h64x" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1733502717; x=1765038717; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gi6s4jrFwCELUNGcLkgK6oa6vovHsOyBVbYmIAfSobM=; b=Hjy1h64x7fWdO3mktt68X26FICrIRZ3fyDswMD5AFGktVNGjcykb3vvi YzH7k2EFQ68IhMJuFdT8q5DeZLLJDROuZnG1H7U0GKvzbsZFkuDQQQUml +FgJhn60eND73hBZdfWazesXqE9a/rgVnuGHqJ2smWMK+Rh0t6fDE4JbW 9HAfm5ASbjxkY5FMN+wO49BxdcEsQmgZ8lpGaOxyHahCTUMKFHdlBkfLS mYPkRg9feT1/enALa9Zy62UNmD2K91APiUoU1n/vuE373O2e/w8S3rxqa yQDClRiDC2lR65omvmK7zL+3477dGduNj8xmCJMsxupHc9QF6vmIwa8QJ g==; X-CSE-ConnectionGUID: CCAS2FHnT5aOfFs2waNQlQ== X-CSE-MsgGUID: PFRw7mlVS0GOM4xy5DnMlQ== X-IronPort-AV: E=McAfee;i="6700,10204,11278"; a="44470395" X-IronPort-AV: E=Sophos;i="6.12,213,1728975600"; d="scan'208";a="44470395" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Dec 2024 08:31:54 -0800 X-CSE-ConnectionGUID: 6sxGJr5GTySj+sv/bm1sGA== X-CSE-MsgGUID: /IFPpwMbQWSt4AKcFnwVKg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,213,1728975600"; d="scan'208";a="95258511" Received: from agluck-desk3.sc.intel.com ([172.25.222.70]) by orviesa008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Dec 2024 08:31:54 -0800 From: Tony Luck To: Fenghua Yu , Reinette Chatre , Peter Newman , Jonathan Corbet , x86@kernel.org Cc: James Morse , Jamie Iles , Babu Moger , Randy Dunlap , "Shaopeng Tan (Fujitsu)" , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, patches@lists.linux.dev, Tony Luck Subject: [PATCH v11 3/8] x86/resctrl: Modify update_mba_bw() to use per CTRL_MON group event Date: Fri, 6 Dec 2024 08:31:43 -0800 Message-ID: <20241206163148.83828-4-tony.luck@intel.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241206163148.83828-1-tony.luck@intel.com> References: <20241206163148.83828-1-tony.luck@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" update_mba_bw() hard codes use of the memory bandwidth local event which prevents more flexible options from being deployed. Change this function to use the event specified in the rdtgroup that is being processed. Mount time checks for the "mba_MBps" option ensure that local memory bandwidth is enabled. So drop the redundant is_mbm_local_enabled() check. Signed-off-by: Tony Luck Reviewed-by: Reinette Chatre Tested-by: Babu Moger --- arch/x86/kernel/cpu/resctrl/monitor.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/re= sctrl/monitor.c index 69bdc11bacf8..adb18f088979 100644 --- a/arch/x86/kernel/cpu/resctrl/monitor.c +++ b/arch/x86/kernel/cpu/resctrl/monitor.c @@ -752,20 +752,20 @@ static void update_mba_bw(struct rdtgroup *rgrp, stru= ct rdt_mon_domain *dom_mbm) u32 closid, rmid, cur_msr_val, new_msr_val; struct mbm_state *pmbm_data, *cmbm_data; struct rdt_ctrl_domain *dom_mba; + enum resctrl_event_id evt_id; struct rdt_resource *r_mba; - u32 cur_bw, user_bw, idx; struct list_head *head; struct rdtgroup *entry; - - if (!is_mbm_local_enabled()) - return; + u32 cur_bw, user_bw; =20 r_mba =3D &rdt_resources_all[RDT_RESOURCE_MBA].r_resctrl; + evt_id =3D rgrp->mba_mbps_event; =20 closid =3D rgrp->closid; rmid =3D rgrp->mon.rmid; - idx =3D resctrl_arch_rmid_idx_encode(closid, rmid); - pmbm_data =3D &dom_mbm->mbm_local[idx]; + pmbm_data =3D get_mbm_state(dom_mbm, closid, rmid, evt_id); + if (WARN_ON_ONCE(!pmbm_data)) + return; =20 dom_mba =3D get_ctrl_domain_from_cpu(smp_processor_id(), r_mba); if (!dom_mba) { @@ -784,7 +784,9 @@ static void update_mba_bw(struct rdtgroup *rgrp, struct= rdt_mon_domain *dom_mbm) */ head =3D &rgrp->mon.crdtgrp_list; list_for_each_entry(entry, head, mon.crdtgrp_list) { - cmbm_data =3D &dom_mbm->mbm_local[entry->mon.rmid]; + cmbm_data =3D get_mbm_state(dom_mbm, entry->closid, entry->mon.rmid, evt= _id); + if (WARN_ON_ONCE(!cmbm_data)) + return; cur_bw +=3D cmbm_data->prev_bw; } =20 --=20 2.47.0 From nobody Wed Dec 17 21:28:17 2025 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) (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 2A2DE1FFC5E; Fri, 6 Dec 2024 16:31:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733502718; cv=none; b=DaOkZ9oGYM4YHl+gp3CRoZ0AWiriFxNF0X13m4BLLjQ3QWNa5bMcs3CGkO2GPSetvMNa5zLsrb5qpcjxz6Qrn1EaIVO+v2edQjN9s75RU33moQcuVdFNx0tMCm1NpEKkjZmor622Qe0t24y4AF1bNpOIh8Poh+v+ub+8OoxDPuk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733502718; c=relaxed/simple; bh=JG3z7yTbByVBYHLz+pJgSPAGR9jxx7TOcdejCgHSi+k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qPPfgXNol/LTRBDMmNIjsCULLFKqauU+hDcEge8+P71tOabcSX+pxX1/S03Gnmx8psZ4X9RI4DeT8xTg9IC9jSQcEcmwC9vt0GAr8G6UElViib0YcoB+FtEu/LTRUrzx7l2Q56JckPaj4Hxh2egG8M0gMb57/fPwElCApGcBH9s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=fC3E3IRI; arc=none smtp.client-ip=192.198.163.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="fC3E3IRI" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1733502717; x=1765038717; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=JG3z7yTbByVBYHLz+pJgSPAGR9jxx7TOcdejCgHSi+k=; b=fC3E3IRIwNMoaLg7cxk38moOBXQRb9lZ9ufFWKw0VvJpSlbrHecBfv7l zNYQ3n6hOGX+PwHyj5eLUjG/ytxKLI1EI/h8C5nsibiPZs7gGLuYJPeyZ UM85WxtQXOFxSHBArjXok7UO5P7oPApfZfl5w/S0PJJFy6I+qjsGuyIFZ v3bWYIJV5WeND82UCsMiecer6ppwiyujBRF+ilBSDv4yKiwV3rRUL0kS9 wQAsn9v1tk/UfKSFySjkdZBEUJZJNZmeWEAHaWzWvwOKdgw6/Z6h0EhTp jfAriIg+NMpaj8J3dHSX7qYmjSHcoNXzFAS784XBHzMC3NnvYINW7mYgk w==; X-CSE-ConnectionGUID: frn+yE4bQL2d1qimxZJKVA== X-CSE-MsgGUID: P3hvlKmTSXmjDVxO0GuiKg== X-IronPort-AV: E=McAfee;i="6700,10204,11278"; a="44470405" X-IronPort-AV: E=Sophos;i="6.12,213,1728975600"; d="scan'208";a="44470405" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Dec 2024 08:31:54 -0800 X-CSE-ConnectionGUID: nN6+PwVaT+CR0f3E5h3fXw== X-CSE-MsgGUID: b6p8EBjlSq6JCv+AsXuGrQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,213,1728975600"; d="scan'208";a="95258517" Received: from agluck-desk3.sc.intel.com ([172.25.222.70]) by orviesa008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Dec 2024 08:31:54 -0800 From: Tony Luck To: Fenghua Yu , Reinette Chatre , Peter Newman , Jonathan Corbet , x86@kernel.org Cc: James Morse , Jamie Iles , Babu Moger , Randy Dunlap , "Shaopeng Tan (Fujitsu)" , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, patches@lists.linux.dev, Tony Luck Subject: [PATCH v11 4/8] x86/resctrl: Compute memory bandwidth for all supported events Date: Fri, 6 Dec 2024 08:31:44 -0800 Message-ID: <20241206163148.83828-5-tony.luck@intel.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241206163148.83828-1-tony.luck@intel.com> References: <20241206163148.83828-1-tony.luck@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Switching between local and total memory bandwidth events as the input to the mba_sc feedback loop would be cumbersome and take effect slowly in the current implementation as the bandwidth is only known after two consecutive readings of the same event. Compute the bandwidth for all supported events. This doesn't add significant overhead and will make changing which event is used simple. Suggested-by: Reinette Chatre Signed-off-by: Tony Luck Reviewed-by: Reinette Chatre Tested-by: Babu Moger --- arch/x86/kernel/cpu/resctrl/monitor.c | 72 ++++++++++++--------------- 1 file changed, 33 insertions(+), 39 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/re= sctrl/monitor.c index adb18f088979..94a1d9780461 100644 --- a/arch/x86/kernel/cpu/resctrl/monitor.c +++ b/arch/x86/kernel/cpu/resctrl/monitor.c @@ -663,9 +663,12 @@ static int __mon_event_count(u32 closid, u32 rmid, str= uct rmid_read *rr) */ static void mbm_bw_count(u32 closid, u32 rmid, struct rmid_read *rr) { - u32 idx =3D resctrl_arch_rmid_idx_encode(closid, rmid); - struct mbm_state *m =3D &rr->d->mbm_local[idx]; u64 cur_bw, bytes, cur_bytes; + struct mbm_state *m; + + m =3D get_mbm_state(rr->d, closid, rmid, rr->evtid); + if (WARN_ON_ONCE(!m)) + return; =20 cur_bytes =3D rr->val; bytes =3D cur_bytes - m->prev_bw_bytes; @@ -815,54 +818,45 @@ static void update_mba_bw(struct rdtgroup *rgrp, stru= ct rdt_mon_domain *dom_mbm) resctrl_arch_update_one(r_mba, dom_mba, closid, CDP_NONE, new_msr_val); } =20 -static void mbm_update(struct rdt_resource *r, struct rdt_mon_domain *d, - u32 closid, u32 rmid) +static void mbm_update_one_event(struct rdt_resource *r, struct rdt_mon_do= main *d, + u32 closid, u32 rmid, enum resctrl_event_id evtid) { struct rmid_read rr =3D {0}; =20 rr.r =3D r; rr.d =3D d; + rr.evtid =3D evtid; + rr.arch_mon_ctx =3D resctrl_arch_mon_ctx_alloc(rr.r, rr.evtid); + if (IS_ERR(rr.arch_mon_ctx)) { + pr_warn_ratelimited("Failed to allocate monitor context: %ld", + PTR_ERR(rr.arch_mon_ctx)); + return; + } + + __mon_event_count(closid, rmid, &rr); =20 /* - * This is protected from concurrent reads from user - * as both the user and we hold the global mutex. + * If the software controller is enabled, compute the + * bandwidth for this event id. */ - if (is_mbm_total_enabled()) { - rr.evtid =3D QOS_L3_MBM_TOTAL_EVENT_ID; - rr.val =3D 0; - rr.arch_mon_ctx =3D resctrl_arch_mon_ctx_alloc(rr.r, rr.evtid); - if (IS_ERR(rr.arch_mon_ctx)) { - pr_warn_ratelimited("Failed to allocate monitor context: %ld", - PTR_ERR(rr.arch_mon_ctx)); - return; - } + if (is_mba_sc(NULL)) + mbm_bw_count(closid, rmid, &rr); =20 - __mon_event_count(closid, rmid, &rr); - - resctrl_arch_mon_ctx_free(rr.r, rr.evtid, rr.arch_mon_ctx); - } - if (is_mbm_local_enabled()) { - rr.evtid =3D QOS_L3_MBM_LOCAL_EVENT_ID; - rr.val =3D 0; - rr.arch_mon_ctx =3D resctrl_arch_mon_ctx_alloc(rr.r, rr.evtid); - if (IS_ERR(rr.arch_mon_ctx)) { - pr_warn_ratelimited("Failed to allocate monitor context: %ld", - PTR_ERR(rr.arch_mon_ctx)); - return; - } - - __mon_event_count(closid, rmid, &rr); + resctrl_arch_mon_ctx_free(rr.r, rr.evtid, rr.arch_mon_ctx); +} =20 - /* - * Call the MBA software controller only for the - * control groups and when user has enabled - * the software controller explicitly. - */ - if (is_mba_sc(NULL)) - mbm_bw_count(closid, rmid, &rr); +static void mbm_update(struct rdt_resource *r, struct rdt_mon_domain *d, + u32 closid, u32 rmid) +{ + /* + * This is protected from concurrent reads from user as both + * the user and overflow handler hold the global mutex. + */ + if (is_mbm_total_enabled()) + mbm_update_one_event(r, d, closid, rmid, QOS_L3_MBM_TOTAL_EVENT_ID); =20 - resctrl_arch_mon_ctx_free(rr.r, rr.evtid, rr.arch_mon_ctx); - } + if (is_mbm_local_enabled()) + mbm_update_one_event(r, d, closid, rmid, QOS_L3_MBM_LOCAL_EVENT_ID); } =20 /* --=20 2.47.0 From nobody Wed Dec 17 21:28:17 2025 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) (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 B46B31FFC72; Fri, 6 Dec 2024 16:31:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733502719; cv=none; b=teBCT+lOgkKPTdXQFfU/QWoSBQT94EzFO7h/m2QTnA4TDnbWlcGaPtYvETiy67Ge2Hr92nt2mtalToyGRFhtY4Xd5Q8PAsF1R+QM8ry3V/JGDOWzM640cY6YnL2nWqpILj6jiXK1nzMUbHTTxSX1uGhhuk64Nstndq4wGyWgsrQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733502719; c=relaxed/simple; bh=rWIcn0PaSYQyS8fWHC7jQf1kPs48TTM30qA5b05XLoo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=c4xt4UeyRGQMiHTGWZK3nJICjo+Pq7FNWwU4tX+ZatnSP1VFlNPwAprcWqqblH7x4p7+H9KD17XfJ16aIexhilWOcICwuEsLxQUdGdJ+Z0juJycH5jhjvkqkI0V0XFry103sPfqhItDEfnzBWG1q5xPgluIV+xhE+zjNauwpdIk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=KMz351A4; arc=none smtp.client-ip=192.198.163.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="KMz351A4" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1733502718; x=1765038718; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=rWIcn0PaSYQyS8fWHC7jQf1kPs48TTM30qA5b05XLoo=; b=KMz351A4YFqZWq4RubOFxlItAG7yVDBp4KTX+TAsyFNgOOPg/h5lJQN3 scDjndUElHEkkMbHs6RaXjxyZxP/b0te6UxoOyLquvcW8erz6KO/8k3zq x1UCF/+2775x8H/RfutwrC05+nbQVwfvtYdnMx/9NU0OphOm+ZT3dHYHJ hE2gZey5PiIOPNRRe6LCZm3g7g4v7JXPegQMjrNHjbPCAhZts8PBlfCWM +PLZcnCBukFF2DGOoV7D50R324+8+D+aCQj0LGvzXfG/eHDrOpjNSCEli JHc/FgJmZaizF3ysFucayG9+d/r2xhRYn1j5KC3Q4hyQGGW8dk+iNYJoz Q==; X-CSE-ConnectionGUID: i7OtqUqKRhCDkXwV18vQOg== X-CSE-MsgGUID: 5sFMWniSSEmfMDZiZQK69A== X-IronPort-AV: E=McAfee;i="6700,10204,11278"; a="44470416" X-IronPort-AV: E=Sophos;i="6.12,213,1728975600"; d="scan'208";a="44470416" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Dec 2024 08:31:54 -0800 X-CSE-ConnectionGUID: zhswkoOOTmeZHI2Fp6a1TQ== X-CSE-MsgGUID: sw/ZxsrGRcysPCsKiro9CA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,213,1728975600"; d="scan'208";a="95258520" Received: from agluck-desk3.sc.intel.com ([172.25.222.70]) by orviesa008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Dec 2024 08:31:55 -0800 From: Tony Luck To: Fenghua Yu , Reinette Chatre , Peter Newman , Jonathan Corbet , x86@kernel.org Cc: James Morse , Jamie Iles , Babu Moger , Randy Dunlap , "Shaopeng Tan (Fujitsu)" , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, patches@lists.linux.dev, Tony Luck Subject: [PATCH v11 5/8] x86/resctrl: Make mba_sc use total bandwidth if local is not supported Date: Fri, 6 Dec 2024 08:31:45 -0800 Message-ID: <20241206163148.83828-6-tony.luck@intel.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241206163148.83828-1-tony.luck@intel.com> References: <20241206163148.83828-1-tony.luck@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The default input measurement to the mba_sc feedback loop for memory bandwidth control when the user mounts with the "mba_MBps" option is the local bandwidth event. But some systems may not support a local bandwidth event. When local bandwidth event is not supported, check for support of total bandwidth and use that instead. Relax the mount option check to allow use of the "mba_MBps" option for systems when only total bandwidth monitoring is supported. Also update the error message. Signed-off-by: Tony Luck Reviewed-by: Reinette Chatre Tested-by: Babu Moger --- arch/x86/kernel/cpu/resctrl/core.c | 2 ++ arch/x86/kernel/cpu/resctrl/rdtgroup.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resct= rl/core.c index 94bf559966d6..3d1735ed8d1f 100644 --- a/arch/x86/kernel/cpu/resctrl/core.c +++ b/arch/x86/kernel/cpu/resctrl/core.c @@ -965,6 +965,8 @@ static __init bool get_rdt_mon_resources(void) =20 if (is_mbm_local_enabled()) mba_mbps_default_event =3D QOS_L3_MBM_LOCAL_EVENT_ID; + else if (is_mbm_total_enabled()) + mba_mbps_default_event =3D QOS_L3_MBM_TOTAL_EVENT_ID; =20 return !rdt_get_mon_l3_config(r); } diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/r= esctrl/rdtgroup.c index 8a52b25ce26b..0659b8e2a71b 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -2341,7 +2341,7 @@ static bool supports_mba_mbps(void) struct rdt_resource *rmbm =3D &rdt_resources_all[RDT_RESOURCE_L3].r_resct= rl; struct rdt_resource *r =3D &rdt_resources_all[RDT_RESOURCE_MBA].r_resctrl; =20 - return (is_mbm_local_enabled() && + return (is_mbm_enabled() && r->alloc_capable && is_mba_linear() && r->ctrl_scope =3D=3D rmbm->mon_scope); } @@ -2768,7 +2768,7 @@ static int rdt_parse_param(struct fs_context *fc, str= uct fs_parameter *param) ctx->enable_cdpl2 =3D true; return 0; case Opt_mba_mbps: - msg =3D "mba_MBps requires local MBM and linear scale MBA at L3 scope"; + msg =3D "mba_MBps requires MBM and linear scale MBA at L3 scope"; if (!supports_mba_mbps()) return invalfc(fc, msg); ctx->enable_mba_mbps =3D true; --=20 2.47.0 From nobody Wed Dec 17 21:28:17 2025 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) (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 E09FD20456C; Fri, 6 Dec 2024 16:31:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733502721; cv=none; b=FWB/cAhvscsKRXVKHU8xehoSUJxeO0+kLwQT8oxt8TtKukI+NWM9ZtKZYK5h2ltmDOIHyjhM677QdEvvaulvTtu7HvZTMim8Ly+GRvpI2QIxcgvRzqC8lmRQenBnvFyCtEJl/K6rgbuHGTodgog9Tbxo+o13/g+0jEqNRIqIJlw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733502721; c=relaxed/simple; bh=mufGsWcjvtDyozFd7iwe+tJWU+9sYLk61rM7KyeLzyE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hx3HnLFKnfaiL0iqbu7MkuMHRIeUbClL3i82vnse7Lt/VXzPMqN4tZBCeAUqxe9b9hVUfgrv5mkB3fqUSTqeWgJ344fuEGiBdwshGKLKag6MfRFPPOZCiRmAcAIAf7qiS2Ab9JTMFXzrO5OgnAD+JY6BUezwYhQuYgsObWgMzwQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Q6m+qyP1; arc=none smtp.client-ip=192.198.163.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Q6m+qyP1" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1733502719; x=1765038719; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=mufGsWcjvtDyozFd7iwe+tJWU+9sYLk61rM7KyeLzyE=; b=Q6m+qyP1JAu9LbqcrXh7DafN0YMuzuIp32oVgBwU0C3Wuah5vbqP9wqf 3t87Gl9U2K5EqngYnfp9zILPeQG+1Oj7oHa+BYdEE/456lceXD+VbiBAO BRyrKuoATwlod+fLfxkqGin51pT1amm5yUSFVHxW5D93uTFOT/DrVO1dr G+ji4oG/8jxlvxPFotqAI4AMGKzFs2XJ5b1Unveel2A77/Zz7SILcocHH NSe6fgPd0KBxPIGkEQQCI92oxAMxRP+Qi0nKWUOyjmaAAdX9wf6Ub/1Xc l16/a5v6NRRwNDEa8iChM1xNOIOTrKxlTPqo4yMJ6+Dx9oIlX3c0Gdm5C w==; X-CSE-ConnectionGUID: S+FSd+YHRN2FPQ0bFBLfHA== X-CSE-MsgGUID: RYjZ5XZgSxqfAGtubzUg+A== X-IronPort-AV: E=McAfee;i="6700,10204,11278"; a="44470426" X-IronPort-AV: E=Sophos;i="6.12,213,1728975600"; d="scan'208";a="44470426" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Dec 2024 08:31:55 -0800 X-CSE-ConnectionGUID: 41z0rpySRHed+lX5ID/2Nw== X-CSE-MsgGUID: NXRkmqPcS4qgFtGSqutT8A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,213,1728975600"; d="scan'208";a="95258525" Received: from agluck-desk3.sc.intel.com ([172.25.222.70]) by orviesa008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Dec 2024 08:31:55 -0800 From: Tony Luck To: Fenghua Yu , Reinette Chatre , Peter Newman , Jonathan Corbet , x86@kernel.org Cc: James Morse , Jamie Iles , Babu Moger , Randy Dunlap , "Shaopeng Tan (Fujitsu)" , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, patches@lists.linux.dev, Tony Luck Subject: [PATCH v11 6/8] x86/resctrl: Add "mba_MBps_event" file to CTRL_MON directories Date: Fri, 6 Dec 2024 08:31:46 -0800 Message-ID: <20241206163148.83828-7-tony.luck@intel.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241206163148.83828-1-tony.luck@intel.com> References: <20241206163148.83828-1-tony.luck@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The "mba_MBps" mount option provides an alternate method to control memory bandwidth. Instead of specifying allowable bandwidth as a percentage of maximum possible, the user provides a MiB/s limit value. In preparation to allow the user to pick the memory bandwidth monitoring event used as input to the feedback loop, provide a file in each CTRL_MON group directory that shows the event currently in use. Note that this file is only visible when the "mba_MBps" mount option is in use. Suggested-by: Reinette Chatre Signed-off-by: Tony Luck Reviewed-by: Reinette Chatre Tested-by: Babu Moger --- arch/x86/kernel/cpu/resctrl/internal.h | 2 ++ arch/x86/kernel/cpu/resctrl/ctrlmondata.c | 30 +++++++++++++++++++++++ arch/x86/kernel/cpu/resctrl/rdtgroup.c | 10 ++++++++ 3 files changed, 42 insertions(+) diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/r= esctrl/internal.h index 485800055a7d..ce10a883ecf8 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -609,6 +609,8 @@ ssize_t rdtgroup_schemata_write(struct kernfs_open_file= *of, char *buf, size_t nbytes, loff_t off); int rdtgroup_schemata_show(struct kernfs_open_file *of, struct seq_file *s, void *v); +int rdtgroup_mba_mbps_event_show(struct kernfs_open_file *of, + struct seq_file *s, void *v); bool rdtgroup_cbm_overlaps(struct resctrl_schema *s, struct rdt_ctrl_domai= n *d, unsigned long cbm, int closid, bool exclusive); unsigned int rdtgroup_cbm_to_size(struct rdt_resource *r, struct rdt_ctrl_= domain *d, diff --git a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c b/arch/x86/kernel/cp= u/resctrl/ctrlmondata.c index 200d89a64027..5fa37b4ecc7a 100644 --- a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c +++ b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c @@ -518,6 +518,36 @@ static int smp_mon_event_count(void *arg) return 0; } =20 +int rdtgroup_mba_mbps_event_show(struct kernfs_open_file *of, + struct seq_file *s, void *v) +{ + struct rdtgroup *rdtgrp; + int ret =3D 0; + + rdtgrp =3D rdtgroup_kn_lock_live(of->kn); + + if (rdtgrp) { + switch (rdtgrp->mba_mbps_event) { + case QOS_L3_MBM_LOCAL_EVENT_ID: + seq_puts(s, "mbm_local_bytes\n"); + break; + case QOS_L3_MBM_TOTAL_EVENT_ID: + seq_puts(s, "mbm_total_bytes\n"); + break; + default: + pr_warn_once("Bad event %d\n", rdtgrp->mba_mbps_event); + ret =3D -EINVAL; + break; + } + } else { + ret =3D -ENOENT; + } + + rdtgroup_kn_unlock(of->kn); + + return ret; +} + void mon_event_read(struct rmid_read *rr, struct rdt_resource *r, struct rdt_mon_domain *d, struct rdtgroup *rdtgrp, cpumask_t *cpumask, int evtid, int first) diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/r= esctrl/rdtgroup.c index 0659b8e2a71b..6eb930b8bdfd 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -1950,6 +1950,12 @@ static struct rftype res_common_files[] =3D { .seq_show =3D rdtgroup_schemata_show, .fflags =3D RFTYPE_CTRL_BASE, }, + { + .name =3D "mba_MBps_event", + .mode =3D 0444, + .kf_ops =3D &rdtgroup_kf_single_ops, + .seq_show =3D rdtgroup_mba_mbps_event_show, + }, { .name =3D "mode", .mode =3D 0644, @@ -2355,6 +2361,7 @@ static int set_mba_sc(bool mba_sc) struct rdt_resource *r =3D &rdt_resources_all[RDT_RESOURCE_MBA].r_resctrl; u32 num_closid =3D resctrl_arch_get_num_closid(r); struct rdt_ctrl_domain *d; + unsigned long fflags; int i; =20 if (!supports_mba_mbps() || mba_sc =3D=3D is_mba_sc(r)) @@ -2369,6 +2376,9 @@ static int set_mba_sc(bool mba_sc) d->mbps_val[i] =3D MBA_MAX_MBPS; } =20 + fflags =3D mba_sc ? RFTYPE_CTRL_BASE | RFTYPE_MON_BASE : 0; + resctrl_file_fflags_init("mba_MBps_event", fflags); + return 0; } =20 --=20 2.47.0 From nobody Wed Dec 17 21:28:17 2025 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) (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 304E220457A; Fri, 6 Dec 2024 16:31:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733502721; cv=none; b=WyeRe/4lPqbAPGtphnYUpS0zqQp+se0Cpt09JFOC+KMlRFLKr2MdxjE+SmHZfmIocU+8ESf/cBQVDhCvimyYaQNlRtIlrsYpgSTrR3zK0sYXlIT+n/hgtraNUuAeJMNTN2ascvUgYy3fICQ7cnYDf/CuMXZihzQu0I1LrqJ6IKA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733502721; c=relaxed/simple; bh=If2Jq4fclpDTx93FUHIMJ617nmFQmqeWFDer9cScQA0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uBqUPaoTMJC+rcdNMF9XEn6lF4UmyR6yiIpId2a0bRE27rNCMIQMCRpLq2PquCg+GV3SP4k4hAc4YWII37Pst7eTvl3uYdlO/oTlXQLeGD3nuqGQrZO9ffK8EFMgL8P2S1qIZymDYYQXXDsyGJ7uPFCdPnU8jJmJlx+gBUstM/w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=ZQnFNJLo; arc=none smtp.client-ip=192.198.163.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ZQnFNJLo" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1733502719; x=1765038719; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=If2Jq4fclpDTx93FUHIMJ617nmFQmqeWFDer9cScQA0=; b=ZQnFNJLo1s0CgbqBLIWTDCBaK2i14xFzUgNxUfb2b8p2ThqEFbeMonCb DL1sO7ZWyxhz3IF1Qhc9ObNNSZePRnR1FKWgu+2oqLf+PBZsf0QBJb5cx u5Z5duTRXKU/Wnv3W9MbXIH9Mr+2ocOKW2UxWKpEgW1q5HC3EnztOhxiH 3fwDojg0EhgzySB4fqbkSe08Rm7pDYlGBE+9phqGfcQ1ow6YhBM0p4mFK eMXMsPo9jw2VKENunB3p0nW+fsfG4iBXDJAq2saMIzfgbugOPt2/8tBuD pEO0Mci8IL+xRwSYXyg9VqHlenOVsioHO8VZUFGzTvL/W6nm4LxuDnZl7 g==; X-CSE-ConnectionGUID: aYb9gGzGRKuztnvspQ4u+Q== X-CSE-MsgGUID: 8zqiOkBqTWqXgaDmYhsIIQ== X-IronPort-AV: E=McAfee;i="6700,10204,11278"; a="44470436" X-IronPort-AV: E=Sophos;i="6.12,213,1728975600"; d="scan'208";a="44470436" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Dec 2024 08:31:55 -0800 X-CSE-ConnectionGUID: PwYzgwZPRL67PbGZpXcPpA== X-CSE-MsgGUID: 1/PsfDinTHWbuK1/9hbUAA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,213,1728975600"; d="scan'208";a="95258530" Received: from agluck-desk3.sc.intel.com ([172.25.222.70]) by orviesa008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Dec 2024 08:31:55 -0800 From: Tony Luck To: Fenghua Yu , Reinette Chatre , Peter Newman , Jonathan Corbet , x86@kernel.org Cc: James Morse , Jamie Iles , Babu Moger , Randy Dunlap , "Shaopeng Tan (Fujitsu)" , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, patches@lists.linux.dev, Tony Luck Subject: [PATCH v11 7/8] x86/resctrl: Add write option to "mba_MBps_event" file Date: Fri, 6 Dec 2024 08:31:47 -0800 Message-ID: <20241206163148.83828-8-tony.luck@intel.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241206163148.83828-1-tony.luck@intel.com> References: <20241206163148.83828-1-tony.luck@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The "mba_MBps" mount option provides an alternate method to control memory bandwidth. Instead of specifying allowable bandwidth as a percentage of maximum possible, the user provides a MiB/s limit value. There is a file in each CTRL_MON group directory that shows the event currently in use. Allow writing that file to choose a different event. A user can choose any of the memory bandwidth monitoring events listed in /sys/fs/resctrl/info/L3_mon/mon_features independently for each CTRL_MON group by writing to each of the "mba_MBps_event" files. Signed-off-by: Tony Luck Reviewed-by: Reinette Chatre Tested-by: Babu Moger --- arch/x86/kernel/cpu/resctrl/internal.h | 2 ++ arch/x86/kernel/cpu/resctrl/ctrlmondata.c | 40 +++++++++++++++++++++++ arch/x86/kernel/cpu/resctrl/rdtgroup.c | 3 +- 3 files changed, 44 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/r= esctrl/internal.h index ce10a883ecf8..6345ab3e0890 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -609,6 +609,8 @@ ssize_t rdtgroup_schemata_write(struct kernfs_open_file= *of, char *buf, size_t nbytes, loff_t off); int rdtgroup_schemata_show(struct kernfs_open_file *of, struct seq_file *s, void *v); +ssize_t rdtgroup_mba_mbps_event_write(struct kernfs_open_file *of, + char *buf, size_t nbytes, loff_t off); int rdtgroup_mba_mbps_event_show(struct kernfs_open_file *of, struct seq_file *s, void *v); bool rdtgroup_cbm_overlaps(struct resctrl_schema *s, struct rdt_ctrl_domai= n *d, diff --git a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c b/arch/x86/kernel/cp= u/resctrl/ctrlmondata.c index 5fa37b4ecc7a..536351159cc2 100644 --- a/arch/x86/kernel/cpu/resctrl/ctrlmondata.c +++ b/arch/x86/kernel/cpu/resctrl/ctrlmondata.c @@ -518,6 +518,46 @@ static int smp_mon_event_count(void *arg) return 0; } =20 +ssize_t rdtgroup_mba_mbps_event_write(struct kernfs_open_file *of, + char *buf, size_t nbytes, loff_t off) +{ + struct rdtgroup *rdtgrp; + int ret =3D 0; + + /* Valid input requires a trailing newline */ + if (nbytes =3D=3D 0 || buf[nbytes - 1] !=3D '\n') + return -EINVAL; + buf[nbytes - 1] =3D '\0'; + + rdtgrp =3D rdtgroup_kn_lock_live(of->kn); + if (!rdtgrp) { + rdtgroup_kn_unlock(of->kn); + return -ENOENT; + } + rdt_last_cmd_clear(); + + if (!strcmp(buf, "mbm_local_bytes")) { + if (is_mbm_local_enabled()) + rdtgrp->mba_mbps_event =3D QOS_L3_MBM_LOCAL_EVENT_ID; + else + ret =3D -EINVAL; + } else if (!strcmp(buf, "mbm_total_bytes")) { + if (is_mbm_total_enabled()) + rdtgrp->mba_mbps_event =3D QOS_L3_MBM_TOTAL_EVENT_ID; + else + ret =3D -EINVAL; + } else { + ret =3D -EINVAL; + } + + if (ret) + rdt_last_cmd_printf("Unsupported event id '%s'\n", buf); + + rdtgroup_kn_unlock(of->kn); + + return ret ?: nbytes; +} + int rdtgroup_mba_mbps_event_show(struct kernfs_open_file *of, struct seq_file *s, void *v) { diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/r= esctrl/rdtgroup.c index 6eb930b8bdfd..6419e04d8a7b 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -1952,8 +1952,9 @@ static struct rftype res_common_files[] =3D { }, { .name =3D "mba_MBps_event", - .mode =3D 0444, + .mode =3D 0644, .kf_ops =3D &rdtgroup_kf_single_ops, + .write =3D rdtgroup_mba_mbps_event_write, .seq_show =3D rdtgroup_mba_mbps_event_show, }, { --=20 2.47.0 From nobody Wed Dec 17 21:28:17 2025 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) (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 B5ADD20458F; Fri, 6 Dec 2024 16:31:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733502721; cv=none; b=PhIvszoknMbkC4kpXmOZLeFhGdyadW/egd0+O3+imv9dXGSN8Eo/sNRj6nwrlkf50g5Smkv6uq1hIBo6F6gsa16NSHCVFX79Tga43R0OExD3OWrqQUITEXHmgaONgyqnN5DJ5eayoWMiJI2HbemwzRVw2ZmSkfEiofaZkAcuWV0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733502721; c=relaxed/simple; bh=RFzKZU16G64WevDvffNNaOLPzBtFmeFhRrOM1vduHhg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=lcF8ZFFivn5CE5E0fRQJWNCmLbjd2XpYfYtR9dZ0xhKagtMkYmLuKL7RTT3c5aLJ+bcEfkbCmjy7M4FnG9HT7h+l4hd+4KXdUxV5nID0Tk12ezPwhw7s5qwXtAZ8xQoSOIW9PjUbHxfhs8Brq8WxgDoSGTs8YIcZFDG78yox68w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=JQy7ju9G; arc=none smtp.client-ip=192.198.163.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="JQy7ju9G" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1733502720; x=1765038720; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=RFzKZU16G64WevDvffNNaOLPzBtFmeFhRrOM1vduHhg=; b=JQy7ju9GNAunx5Rc4T6ckckFBDRjFVmiist2LnZCF3/D1J8/gZOfx1qL AXN73GHW1UO7gG+qI25d0UDs5d4/JHeL6SDed9pjxYr7XW1gO3yg7vAm5 byS3g3rGrClRm1ncmNpnvnV7TdJS82gbe+6VnIUDDrqXcLD72PRui/sTz iP3YYnVgvfd1/j2J7avHlqQoKoj6hOmslgvHYiOvW5L06OfBfeJGOWa8N TErjpfc/ksutifAFCNshtG23NXhngsLNqwVKROtnztF73pJquOlWXCs1D 7R+54ePFUmLchR+KdeU3qQrVb4k6trjDkiLWzjoBxxR89mUlhtjfWQZdR Q==; X-CSE-ConnectionGUID: VfNi3os7SLyCIMygeDmeAQ== X-CSE-MsgGUID: YHR7dfaDTha7IIv1Pj+10w== X-IronPort-AV: E=McAfee;i="6700,10204,11278"; a="44470446" X-IronPort-AV: E=Sophos;i="6.12,213,1728975600"; d="scan'208";a="44470446" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Dec 2024 08:31:55 -0800 X-CSE-ConnectionGUID: jctF4re7QMyXOcO8Jb6sSw== X-CSE-MsgGUID: ahdfbdBNT5KrzPn25pqrtw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,213,1728975600"; d="scan'208";a="95258533" Received: from agluck-desk3.sc.intel.com ([172.25.222.70]) by orviesa008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Dec 2024 08:31:56 -0800 From: Tony Luck To: Fenghua Yu , Reinette Chatre , Peter Newman , Jonathan Corbet , x86@kernel.org Cc: James Morse , Jamie Iles , Babu Moger , Randy Dunlap , "Shaopeng Tan (Fujitsu)" , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, patches@lists.linux.dev, Tony Luck Subject: [PATCH v11 8/8] x86/resctrl: Document the new "mba_MBps_event" file Date: Fri, 6 Dec 2024 08:31:48 -0800 Message-ID: <20241206163148.83828-9-tony.luck@intel.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241206163148.83828-1-tony.luck@intel.com> References: <20241206163148.83828-1-tony.luck@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add a section to document a new read/write file that shows/sets the memory bandwidth event used to control bandwidth used by each CTRL_MON group. Signed-off-by: Tony Luck Reviewed-by: Reinette Chatre Tested-by: Babu Moger --- Documentation/arch/x86/resctrl.rst | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Documentation/arch/x86/resctrl.rst b/Documentation/arch/x86/re= sctrl.rst index a824affd741d..6768fc1fad16 100644 --- a/Documentation/arch/x86/resctrl.rst +++ b/Documentation/arch/x86/resctrl.rst @@ -384,6 +384,16 @@ When monitoring is enabled all MON groups will also co= ntain: Available only with debug option. The identifier used by hardware for the monitor group. On x86 this is the RMID. =20 +When the "mba_MBps" mount option is used all CTRL_MON groups will also con= tain: + +"mba_MBps_event": + Reading this file shows which memory bandwidth event is used + as input to the software feedback loop that keeps memory bandwidth + below the value specified in the schemata file. Writing the + name of one of the supported memory bandwidth events found in + /sys/fs/resctrl/info/L3_MON/mon_features changes the input + event. + Resource allocation rules ------------------------- =20 --=20 2.47.0