From nobody Sat Feb 7 16:34:21 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) (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 9F5DE1C2337; Fri, 22 Nov 2024 23:58:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732319921; cv=none; b=cBroIWywK/KpGB5TEbzO9hN51qqurb87aBt+2Rqjglj1HYtxc1pTqV+FIhjYlrRvBbJMVNAZNasJPofULQlcI1dgUSO3Rs17j3436FDDYq6P3MgxPDHE4hJQ9VDRRJmlYFfg5wSVoM4q4cMXiuANeXDssoqFsa/myCC99ePm02I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732319921; c=relaxed/simple; bh=DgdFQG7ogmZInC9WaL3dmKhljd5aCwuTH2jubE9qPbw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=HyQ07ewCOQRBdSXZzVYAcwrF/ANa5X+r1vU1+aeygbf7lIOWbhFyD0bi7cgdiP011nHwsfVGgZUm/lk+y2ITHdQEJXhAknTulE35ButnIIUwFTt04AJAZ2nO88T4sJVlYI35Ry4YP8nFbxylx7qu8KDF8lR1FA3/LMYmKiv4U1E= 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=aqozgCdK; arc=none smtp.client-ip=198.175.65.18 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="aqozgCdK" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1732319920; x=1763855920; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=DgdFQG7ogmZInC9WaL3dmKhljd5aCwuTH2jubE9qPbw=; b=aqozgCdKk/nJbD/chv8WbGdsqyxqV76eH9bCxnBTH8+w83T6UpGybywA KMHTOAXlOKxr/zvoRpa9SVXSmXRmFrWfd8Y/CFgBxgkPpf4C/gNrbrqrZ 7DyopsZ+xzmxV5r4qX5yFY3koggygtxRNtRPPxK4baIeesQYxBzLS/Fn2 7h00akNhpg+xFb1/c8ddLHqXqWleXOscYm0olXvFIm4qHsL+IaW5PPBP0 ijNiQRj6d85fsyJInv4skmtYaXzFNnc/2w9A7iQMAIV0sKeNoat1sMSfP RnufMMA2sGYekxwiEsUaCABmqR+Mo58YlLWITCzY4Q/EZuC3jYJXup3d5 Q==; X-CSE-ConnectionGUID: d0eY08AMQmGVi5n2PvrTuw== X-CSE-MsgGUID: H5WXtxLWQQaQIek3OaaFtg== X-IronPort-AV: E=McAfee;i="6700,10204,11264"; a="32642693" X-IronPort-AV: E=Sophos;i="6.12,177,1728975600"; d="scan'208";a="32642693" Received: from orviesa006.jf.intel.com ([10.64.159.146]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Nov 2024 15:58:38 -0800 X-CSE-ConnectionGUID: QC6a06pMReubT/mxCz+Dkg== X-CSE-MsgGUID: M6apAD8YTCiOrgay/CremA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,177,1728975600"; d="scan'208";a="90850892" Received: from agluck-desk3.sc.intel.com ([172.25.222.70]) by orviesa006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Nov 2024 15:58:37 -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 v10 1/8] x86/resctrl: Introduce resctrl_file_fflags_init() to initialize fflags Date: Fri, 22 Nov 2024 15:58:25 -0800 Message-ID: <20241122235832.27498-2-tony.luck@intel.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241122235832.27498-1-tony.luck@intel.com> References: <20241122235832.27498-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 --- 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 851b561850e0..7ef1a293cc13 100644 --- a/arch/x86/kernel/cpu/resctrl/monitor.c +++ b/arch/x86/kernel/cpu/resctrl/monitor.c @@ -1223,11 +1223,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 d7163b764c62..2b198ef95e1e 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 Sat Feb 7 16:34:21 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) (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 5576618C351; Fri, 22 Nov 2024 23:58:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732319921; cv=none; b=YJBfgMqBzzKyg/iH+aQvaWWXlA6ZBqihL0F6ngIniYStt8rFmO7VjJjlORLPF3Q+sI6fACq3wHmPIfu/emglLOIyNkhNkN8JlKD/GXQj/LonyucFsDbLLdaJLDNArwldICPHfygVSAFJnskRWqMuCbR1HA0fQx3jiFOGrllny+k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732319921; c=relaxed/simple; bh=i6OS/23JSfExyu1ilEdrupZOnJZBzfqFPJKgl+4PL6E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kzIZ0VYLwxi+5RIDh7P0nldQsqS+fPOE1E96CzN4I1XO1zAb6LAJdABKfIYatkiThFk+z+Av/o5POKB6TINPEym3QtzmXQDSu1hjktLez55kE8Mx9qWub1JCuFAGZDZjYQ6NlMmzxIyX47fATd7nKTCV1iwEP3rQ6cwAKnv+U1U= 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=krqK/9q1; arc=none smtp.client-ip=198.175.65.18 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="krqK/9q1" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1732319920; x=1763855920; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=i6OS/23JSfExyu1ilEdrupZOnJZBzfqFPJKgl+4PL6E=; b=krqK/9q1HfpwTscywe6vi5QllCY3oA7n06vyZF0mwfI4BK+q/OAQfYqr sWzXpN1QfRFHdifIIBt32oE+DzwsnZC/DuTMS1/krLZfP3RDOmYUxQmpA CZ2rXCjCZQWTMcLtSF9mQBb/ywTgsy3Ar2dEYuspGVVOig5e1DeVRdQRY QtW1XBeLJzC4SblLNm48hRi6vWPaZQ+p1l2O1KihA/jJI/Gcg/78Uu76r x6bkvvEGDSyRk8QpOxy6D+7eNHsYYkTdkqKjXsx0H/gbnIezoSdQm/Cy6 gFIkSJy7pTJfBXAYeMf8dAFdj++Qh7rf+J0yT/M3NXABnwIS1ZBXTRCuU Q==; X-CSE-ConnectionGUID: IRuNfjI/T1G20IYl9ZCxjA== X-CSE-MsgGUID: 0tvF4n8aSTauTbyQjlyLOg== X-IronPort-AV: E=McAfee;i="6700,10204,11264"; a="32642703" X-IronPort-AV: E=Sophos;i="6.12,177,1728975600"; d="scan'208";a="32642703" Received: from orviesa006.jf.intel.com ([10.64.159.146]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Nov 2024 15:58:38 -0800 X-CSE-ConnectionGUID: SaNROrlqRlSk2QAlFdACHw== X-CSE-MsgGUID: fsxFkDZFRH2vfWy0DvrrDA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,177,1728975600"; d="scan'208";a="90850895" Received: from agluck-desk3.sc.intel.com ([172.25.222.70]) by orviesa006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Nov 2024 15:58:38 -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 v10 2/8] x86/resctrl: Prepare for per-CTRL_MON group mba_MBps control Date: Fri, 22 Nov 2024 15:58:26 -0800 Message-ID: <20241122235832.27498-3-tony.luck@intel.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241122235832.27498-1-tony.luck@intel.com> References: <20241122235832.27498-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 filesystm 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 --- 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 | 15 +++++++++++++++ 4 files changed, 22 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 2b198ef95e1e..2d42d69ddbe5 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -65,6 +65,17 @@ 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 +2364,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 +3624,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 Sat Feb 7 16:34:21 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) (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 4844D1CB534; Fri, 22 Nov 2024 23:58:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732319922; cv=none; b=Kp3+z5IA0QXKNwbQ8vpzy6hKhwzjEG3HS+sA2cMlzB/bVJjKsP/b5L77Y8fDt/4GJlTbwz9yKLJR+uGcgc7UcJm1gsrJTpbGlxoBM+ZN+KavSpDnoQFMC4OahY9N/Ym3anoswpawoB0EnLb+pTG6yEH1LCc03b1qWXDpxosHTM8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732319922; c=relaxed/simple; bh=Syhd0kuw6fN7AJ+GTquPajZxSLFc2Qlh/gYSKbznIJw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=baHx9emKK5SGW2SvI4iQ1T3j8mlw2LeZh+C5ayyAx3/mZcd80+xp6gffQXK1D1VdhwDkCM25EomOyvkSDbBck/eMzBk8cIiMkQYXiivrQijvw3DBRT1HbKmFr7OMx98halVB+Y9T27c2FX2na/GLYxRewFjZGemlQL5/iQxWjbA= 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=XJgM4I95; arc=none smtp.client-ip=198.175.65.18 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="XJgM4I95" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1732319921; x=1763855921; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Syhd0kuw6fN7AJ+GTquPajZxSLFc2Qlh/gYSKbznIJw=; b=XJgM4I95tnEpdHSgqV1ERu140bKmBDIC8yY2VXaG6JN9iTeVlscTw4Qf b/0iWlp49Uh90K38nFGIyr+0mHgqlmvrfrn9/4iQ66q8KqRbeZhOWMK73 NgRvNBLNJ2yFghRlNtUnDzYPzPrHLOH5W6Gv3OdsJ8WgHgwbCbCLK9/24 Cc97rmBSoSZ/ByUYKynlBU9g9RIStT3qpfGGaRZarwpVbDBQsfLzC5F2m 8nRb0J/ny/PB6ypMf2+BWB4j0bqPHydMoZRdcTGnVLNXmDyyA0aNC0Dme 0hHgFu6mOsr8VZ9lDaHp9kSyrHiq/ugjKxb+hX27HU+GIAOSc1eGHFdIo Q==; X-CSE-ConnectionGUID: uPm0uTyNR6iqZT76iOslYw== X-CSE-MsgGUID: F1hEzqWiShqAPBVpJk5qnA== X-IronPort-AV: E=McAfee;i="6700,10204,11264"; a="32642713" X-IronPort-AV: E=Sophos;i="6.12,177,1728975600"; d="scan'208";a="32642713" Received: from orviesa006.jf.intel.com ([10.64.159.146]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Nov 2024 15:58:39 -0800 X-CSE-ConnectionGUID: 3sWU245SQn23T3YiF4rzcw== X-CSE-MsgGUID: O4q4Mf85SIKarPVZYNQ+ug== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,177,1728975600"; d="scan'208";a="90850899" Received: from agluck-desk3.sc.intel.com ([172.25.222.70]) by orviesa006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Nov 2024 15:58:38 -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 v10 3/8] x86/resctrl: Modify update_mba_bw() to use per CTRL_MON group event Date: Fri, 22 Nov 2024 15:58:27 -0800 Message-ID: <20241122235832.27498-4-tony.luck@intel.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241122235832.27498-1-tony.luck@intel.com> References: <20241122235832.27498-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 --- 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 7ef1a293cc13..6fe2e6ab8dd4 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 Sat Feb 7 16:34:21 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) (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 6CDD71CEEA0; Fri, 22 Nov 2024 23:58:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732319923; cv=none; b=gHSxZiIz0FOYrCl5TbAogd2/B3DP8KDmLJjVIsSf+a9v3rrzKD2OKzDIZtj7wgK99rt6u/X6Xz0e0iULsz7sN3KCvNFLiBWeePXT2B9Cp2xd7uygE1pyco9gg/I4i3NmQr2lVocbw5xzBQpHHl2Wgf80SOclrZdZp9rSYXClDO8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732319923; c=relaxed/simple; bh=28d3tajIB1I9f5LK3PdnSh/I+O/CCvwrrBrwaxDseR8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=YqdhM34jjHuo7ZTIO2ypPjPwNCxUWaQ7Hi4XWThDXMaOEmKkV8/hQfW92GjB5OskLsTetHXW9528WbDM+L32JY3wa9QTGQplyuNghQZ6Xl+aas0RycqFCLnHJR7npk0gE+OsGjrxeZPj4EeL0ndiu5kbDRCww78eHiGet7OxHIw= 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=ZS8IzdSG; arc=none smtp.client-ip=198.175.65.18 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="ZS8IzdSG" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1732319922; x=1763855922; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=28d3tajIB1I9f5LK3PdnSh/I+O/CCvwrrBrwaxDseR8=; b=ZS8IzdSG8YRt3EB0MjiBLfUgqH96w0sJ+0lmFhJREU6EJ2xQQoSbOwIe ErUHffR14FxRvR5fDKGLG08kaVnd4T+C80D0kP2gtKgq8LuYb2Lor2gLC hZ6PIddK7JkHKCQ0yEslGUr+qJ908sghkiEHr26xtnLK8bqBf26LosjWI viLYZfi4jRxdQZ4xa80/cYz+4WMg3mkDVzhra1meM5g63LBtnSk83nFpO TIQ8ZJsGab26kh/9e37IhZyuCLn/XRTemvydKwDXecdgIttFcFZ97+j95 d+oywfDiQqrztgYv7XlJtXk03+rUWVPt1IXNTrmdILY45g6B8VI9h2zdG A==; X-CSE-ConnectionGUID: bEVSe9opQjOpFyg3punxKA== X-CSE-MsgGUID: bnmCYzAtSk619k/VnA4zRA== X-IronPort-AV: E=McAfee;i="6700,10204,11264"; a="32642723" X-IronPort-AV: E=Sophos;i="6.12,177,1728975600"; d="scan'208";a="32642723" Received: from orviesa006.jf.intel.com ([10.64.159.146]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Nov 2024 15:58:39 -0800 X-CSE-ConnectionGUID: RVFT7FKvRBe7cuw6QGf2BQ== X-CSE-MsgGUID: tETC5iWzQMyLcVvt1ZLGGw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,177,1728975600"; d="scan'208";a="90850902" Received: from agluck-desk3.sc.intel.com ([172.25.222.70]) by orviesa006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Nov 2024 15:58:38 -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 v10 4/8] x86/resctrl: Compute memory bandwidth for all supported events Date: Fri, 22 Nov 2024 15:58:28 -0800 Message-ID: <20241122235832.27498-5-tony.luck@intel.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241122235832.27498-1-tony.luck@intel.com> References: <20241122235832.27498-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 --- 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 6fe2e6ab8dd4..4ca38bc9dd96 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 Sat Feb 7 16:34:21 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) (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 A57BF1D0E27; Fri, 22 Nov 2024 23:58:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732319923; cv=none; b=a5CscZDLt3236svqyt/L/TkOqLgEIOi1kXujHXX/qvIgtlmj/gel03cROU4mj0+bwhJgL/fzm47ZxWgOUU3VhSzyiHuffhkHGImX5Nnowp+zvZM4fcjNTtDyrFbAWTC9kwWo0/4/JJB41m7nyg1uwWCcd/2p3p7D3FJhZa+0oQg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732319923; c=relaxed/simple; bh=Bg6SlYlXirA+vF8zbaUcEyBxCSwRzWcikhAsk3FfFC0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PM9rHiZjt5ROcCPxgZw7T5Ch82L5++b9gzHxcBc1jYZZ9IrqKM8RIwCzYGoSnBSLAndpDhto8AvAa/T2Kj3Zwe6vbwpGDCh4rw8FMqxbO2arKbwbgnZ2p4q7afdMQh19KqjA+VkxVjZNcTatZf8DNtZsdhJ3eQlB1LltUZ0zEKI= 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=ZmR9XtHx; arc=none smtp.client-ip=198.175.65.18 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="ZmR9XtHx" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1732319922; x=1763855922; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Bg6SlYlXirA+vF8zbaUcEyBxCSwRzWcikhAsk3FfFC0=; b=ZmR9XtHxyW7XSFTCjgH2faBOBnRXsNmdw6MrGDjp6pb822b9F5cJmSr3 VkoGXOoLPzotomIDhB6ucmBlleBQwCRA7xXjxkXWByk+LygZAvJJ3JwBv IBLUzJPKi1uzBMQR+rEV0Y9xEuzZjAbRJ8q9X1ECss58twy2mDLwQf1MX EmhZuiRTaf7tiigu2QRKUOLL48KkM/vSSUWUmAg9O11UjL8TYe2+vMpUS jsz35/4S8805Rr5Vi8elFMyvG/K6sxNIcnrGDQmvx1YDb+PZ7aq5sKllv TcypI9H5/nZ0IsSfeR3jmzBK0uc1PCgu10ZRA/V9AK+eiTWtwTKoDzRUV g==; X-CSE-ConnectionGUID: v9FA29n5QAGRAdPj4WuRTg== X-CSE-MsgGUID: XPjcCsPURf6/0LDZe0MwgA== X-IronPort-AV: E=McAfee;i="6700,10204,11264"; a="32642733" X-IronPort-AV: E=Sophos;i="6.12,177,1728975600"; d="scan'208";a="32642733" Received: from orviesa006.jf.intel.com ([10.64.159.146]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Nov 2024 15:58:39 -0800 X-CSE-ConnectionGUID: wUMzVUoDT8S/x+x8+o8gKg== X-CSE-MsgGUID: cromQMalRjefqA1PTbHDcQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,177,1728975600"; d="scan'208";a="90850906" Received: from agluck-desk3.sc.intel.com ([172.25.222.70]) by orviesa006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Nov 2024 15:58:39 -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 v10 5/8] x86/resctrl: Make mba_sc use total bandwidth if local is not supported Date: Fri, 22 Nov 2024 15:58:29 -0800 Message-ID: <20241122235832.27498-6-tony.luck@intel.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241122235832.27498-1-tony.luck@intel.com> References: <20241122235832.27498-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 --- 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 2d42d69ddbe5..98d27199c2fe 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -2343,7 +2343,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); } @@ -2770,7 +2770,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 Sat Feb 7 16:34:21 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) (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 1D71E1D3564; Fri, 22 Nov 2024 23:58:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732319923; cv=none; b=qrwOV9LSXj8CxwD69kVDI/31D/4i/QoL3jcaoPzIrSThCWq0qxV7BMUHQ/DZ3kF/YCyDvUBGq2BoNNaAIILO52bk8ETg8WyWyzNpTy35W3LZKShSa+RB6uUQCP9xfTm8ZSW7/MpaDxW2Be+QFwQVZp1DwVkt2b3W5MoWB58gMx8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732319923; c=relaxed/simple; bh=80SJws0Hb0cg3maKZlhIw9vkNKd0N1ngxiJHAJ8H6KI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ktfl5bwVFfOUGhIbHLT04KyO8lbnCpVJJNeGCalEJVEAEczyQtPSNqjoXUGyG2YovzisfCa2p62V2LqN1DaH1eY3BGwYWZZGuzY4MuCzlBFl3rPoeLZk7Lr6ceTafsX6aq6NqIk4d5YJ6vv73QHx5siuifusMYxWUUxyIo2hWXM= 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=HrDkSLMC; arc=none smtp.client-ip=198.175.65.18 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="HrDkSLMC" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1732319922; x=1763855922; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=80SJws0Hb0cg3maKZlhIw9vkNKd0N1ngxiJHAJ8H6KI=; b=HrDkSLMC1RHk1AGMqJnsDjW/Nryr39MqYHDqs3xqXWDivlwYY7gSZbcu 7m3F4zfDJZxaTBJTqn7Ec59tSVhmPyD5H2S0yEaIFlveO30f+VkBpjd2o zgnH/iL+W7WeDHM6OXC5rsAZ4dVHdMgDg68EMB4/1VaXG5zx65tgd8xmp /Go5FMnTdap+1My/GrMR5NLdqHWBDspOGEJMWJ7Iv1oOQdzdtQYAJKuI1 EOaT55ARXS4JJeR/4wVRKLG2Co6SatDYTxgPqCn06DFLOpDs7TocnFX2B o3xWWsdd1QvUhtVqSZMBDlSSEDeKTLWqjq9Rcb7W1qxL7eRwa99qxyBv0 g==; X-CSE-ConnectionGUID: 6nFFMwyMR7a2FIxWpgxVsA== X-CSE-MsgGUID: HWPCAyVGSim6HWJ2q2HGXg== X-IronPort-AV: E=McAfee;i="6700,10204,11264"; a="32642744" X-IronPort-AV: E=Sophos;i="6.12,177,1728975600"; d="scan'208";a="32642744" Received: from orviesa006.jf.intel.com ([10.64.159.146]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Nov 2024 15:58:40 -0800 X-CSE-ConnectionGUID: ZbB1NTZ/Ty2SwuWufgOqIQ== X-CSE-MsgGUID: UEdOp2qpQeG88vTRvY+vFQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,177,1728975600"; d="scan'208";a="90850911" Received: from agluck-desk3.sc.intel.com ([172.25.222.70]) by orviesa006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Nov 2024 15:58:39 -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 v10 6/8] x86/resctrl: Add "mba_MBps_event" file to CTRL_MON directories Date: Fri, 22 Nov 2024 15:58:30 -0800 Message-ID: <20241122235832.27498-7-tony.luck@intel.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241122235832.27498-1-tony.luck@intel.com> References: <20241122235832.27498-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 --- 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 98d27199c2fe..22265d3e238a 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -1952,6 +1952,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, @@ -2357,6 +2363,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)) @@ -2371,6 +2378,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 Sat Feb 7 16:34:21 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) (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 503FC1D9598; Fri, 22 Nov 2024 23:58:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732319925; cv=none; b=F+v6rjoqXBwG2OpRgIWH0CzXx7ljNDTT6UXdPQ9KThfpPMzpfrrH/uE5dxuktVQs+nrRiThSyBhR4ssHnAMpb5IZv6dAYCUYH/4EwFYB6kim4Ng7UTI4oWoBa8FS6PD1VFKdv1f98MxupuMEIW8yfEV1NANNEl9yq91mjv2hNRc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732319925; c=relaxed/simple; bh=ysY/aIqy1UialU2bl9Cc0ocplEvrsKmpK3PGw6E++PY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WSVGWTSyWz3gJfdeoF/sTynKO3R3Gu+kD98z+lH8QIskyQvi5+90TYWQoFGfRksRWpfnnsM+xQpNzZEsRI3kaT2faxyhKdl6YLs9vJ2yfgTS1eATws2LkGW9AX0yBqExI+YNNfggmGCsbiXq/0MXGfVylwp9CS4oA++OSCkMX3Q= 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=YVcbu7xR; arc=none smtp.client-ip=198.175.65.18 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="YVcbu7xR" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1732319924; x=1763855924; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ysY/aIqy1UialU2bl9Cc0ocplEvrsKmpK3PGw6E++PY=; b=YVcbu7xR65wsWwgwdq7Zhdj4rleRYNl1t9XGhJkNrzDJn+RL8iFI7yCY +CnvjJpRQAhAqU/VGLXpNgt72diu32g0VLR6JkufRYw1UPQ/cJKopxbhb U/dNGUuZxiyjM7cWvbrbAahy4vxIBFAqW/J1RMI9KoXNREzT8jw+YdnwL I8MA3UHC4GitFfYYzQdQKcl7romsnV2DFujR9sR4fm6wqwyXa1Z4FkYqH 27fjPOIi8OEWhhcjFd6Rl+5+GjXh4H04NRua05Ed2XVcaIGMsxP29ZJcT S3xJGVtbFk6lbXwzAuJAv2KHtGVlFWiLFSGEp2BmhcKU1inCYYn8UlHaA g==; X-CSE-ConnectionGUID: a7bwt2BqTGyYdUT5AuwbOg== X-CSE-MsgGUID: jghWpO5hQcyzpHZyKkdDoQ== X-IronPort-AV: E=McAfee;i="6700,10204,11264"; a="32642755" X-IronPort-AV: E=Sophos;i="6.12,177,1728975600"; d="scan'208";a="32642755" Received: from orviesa006.jf.intel.com ([10.64.159.146]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Nov 2024 15:58:40 -0800 X-CSE-ConnectionGUID: KBW8D0VWQmuG/4fEO9nWCw== X-CSE-MsgGUID: oeUJlIueQFyIJdm14Fagfw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,177,1728975600"; d="scan'208";a="90850916" Received: from agluck-desk3.sc.intel.com ([172.25.222.70]) by orviesa006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Nov 2024 15:58:39 -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 v10 7/8] x86/resctrl: Add write option to "mba_MBps_event" file Date: Fri, 22 Nov 2024 15:58:31 -0800 Message-ID: <20241122235832.27498-8-tony.luck@intel.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241122235832.27498-1-tony.luck@intel.com> References: <20241122235832.27498-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 --- 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 22265d3e238a..14fa6db578f4 100644 --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c @@ -1954,8 +1954,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 Sat Feb 7 16:34:21 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) (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 7FF091DDA34; Fri, 22 Nov 2024 23:58:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732319925; cv=none; b=rvkYveSB297Vb8vQYsACESgwNxlYr2Pct4LXPzMPGve5BfEz7SWlRFd5Pk+/+BMCTibw5USYc0ruLquW0Nz6eC2RRL1Fl/XgmHtF0iZvAeedWTl9q0Rd35iKXDNIfr3VMIhs69ufu0m+T5IUzFKpnWYEEooFJe2pQgD7R6XVBro= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732319925; c=relaxed/simple; bh=fDfCFpRA+LjYsiAD12YwWZsVIyVX7Go/gjuhBuSbHhw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZM2EOPmVQUrHi3lQvBbJEDDKnMb1z9PDFb3Eg9Lv28UgYUOSL5g7C9fMemTmb5sEqQpsfKw4MKpenM+xjnUSf+mR/dOqkaGeOctZJpUAt9+yXvMpyUgMqUWYriRcEdS+3WcsCwdoBjbmSrxn4JF2eKdpsWdOArv2h+AqIFde0F4= 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=cJVs6z2K; arc=none smtp.client-ip=198.175.65.18 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="cJVs6z2K" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1732319924; x=1763855924; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=fDfCFpRA+LjYsiAD12YwWZsVIyVX7Go/gjuhBuSbHhw=; b=cJVs6z2KqDyOmheMrn2HYie0Zpf5Zf29JHEGM/FcMlv9qqnzAUpbblzg /hxDvXqnMg6+d8IJGFt0FTxcFgwEKgATYxWdRX+UvOEcU+y5NHqfvZYoc MQW8QdJZD85yG188kUrqW+i/0iSMEF1LkGZtToKAtGBHdu7A45sAppDLt vaVQNq6JGsaMW9TZNVNBTzZVqkYZu6GiJLnYbuSOAAIlJkcVF4SDeZiqp KwBKE/iJZBNTxs/VKv+UCFK14C32kXy+8fUyOtA1Dixi6LUhjTfGO27xZ Az5gNeo2O9ecjxpqPbdkywYFIPDc1iah85Qs4yzuLCbxlxks8IMR3LPdr A==; X-CSE-ConnectionGUID: qJl9lnLURcio6lRDjNcOiw== X-CSE-MsgGUID: v8+lscckRoK6rUVpLII0bQ== X-IronPort-AV: E=McAfee;i="6700,10204,11264"; a="32642765" X-IronPort-AV: E=Sophos;i="6.12,177,1728975600"; d="scan'208";a="32642765" Received: from orviesa006.jf.intel.com ([10.64.159.146]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Nov 2024 15:58:40 -0800 X-CSE-ConnectionGUID: QRhHz35tSHyVzsmQTImAGg== X-CSE-MsgGUID: /aPj5Iq+SpG2br21mtPLsg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,177,1728975600"; d="scan'208";a="90850919" Received: from agluck-desk3.sc.intel.com ([172.25.222.70]) by orviesa006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Nov 2024 15:58:40 -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 v10 8/8] x86/resctrl: Document the new "mba_MBps_event" file Date: Fri, 22 Nov 2024 15:58:32 -0800 Message-ID: <20241122235832.27498-9-tony.luck@intel.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241122235832.27498-1-tony.luck@intel.com> References: <20241122235832.27498-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 --- 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