From nobody Thu Jun 11 05:50:53 2026 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 222193E3C59 for ; Wed, 6 May 2026 08:29:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778056149; cv=none; b=VGf5pHxJJFJPrLiFzA2WPOFXYKxQ9lM0WNS2ilTJcd7YdSGtq7q6eZJ1cwF4f/eperdtG1Zt2QAg+8bNC+IPn7SABHzrQfa1qTCuk3s+2gQZ64ZxdD8wwXus5xD5OFgQtZ4WGvYU1wI7VGPqcxbRi0Nz9FjIlIhOS86k91W/JIs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778056149; c=relaxed/simple; bh=i3BWJm5Wc4DqV9P4dcBQDCZ3T6VnCrSYNeQlUGqTa2s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Qb/TbTCjC0eZruVKZrgrLU2nYQ9rW+eDs1YTZ2QkuVdHV+q6sufxQDr5rQdoNI4pt34++W1k+L/X2VONGvQA1S+G67oP0h4+wYsEqWXcPS8FgpRzwvK1Nq2VTY3fm0O3iyMeCiWVZEaczqBilzPMQYj+NSmpx8Hif/HhvsNd4v4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=QTnKvD8U; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="QTnKvD8U" Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2A4751AED; Wed, 6 May 2026 01:29:02 -0700 (PDT) Received: from e134344.cambridge.arm.com (e134344.arm.com [10.1.196.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id AF9C63F836; Wed, 6 May 2026 01:29:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1778056147; bh=i3BWJm5Wc4DqV9P4dcBQDCZ3T6VnCrSYNeQlUGqTa2s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QTnKvD8UfT0oOapPd70bqzSUHOkhdHMPidAaXs00zoq8KUOUbYiAf0x81MSO6G114 38TtLpiZcXSToQoSxEBjGh99Lj2698fCSsA18Gam/T1/jM+ld5onoQYdsLa4u7qnvT V2A+DspkYere+iur95P44qvi2fqAgVg9/zzudgTA= From: Ben Horgan To: linux-kernel@vger.kernel.org Cc: tony.luck@intel.com, reinette.chatre@intel.com, Dave.Martin@arm.com, james.morse@arm.com, babu.moger@amd.com, tglx@kernel.org, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, ben.horgan@arm.com, fenghuay@nvidia.com, tan.shaopeng@fujitsu.com Subject: [PATCH v7 1/7] fs/resctrl: Tidy up the error path in resctrl_mkdir_event_configs() Date: Wed, 6 May 2026 09:28:49 +0100 Message-ID: <20260506082855.3694761-2-ben.horgan@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260506082855.3694761-1-ben.horgan@arm.com> References: <20260506082855.3694761-1-ben.horgan@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The error path in resctrl_mkdir_event_configs() is unnecessarily complicated. Simplify it to just return directly on error. Signed-off-by: Ben Horgan Reviewed-by: Reinette Chatre Reviewed-by: Babu Moger Tested-by: Babu Moger --- Changes since v5: Correct order of the tags Changes since v6: Add missing commit message separator,--- --- fs/resctrl/rdtgroup.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c index 5dfdaa6f9d8f..fb6999178fe2 100644 --- a/fs/resctrl/rdtgroup.c +++ b/fs/resctrl/rdtgroup.c @@ -2333,20 +2333,19 @@ static int resctrl_mkdir_event_configs(struct rdt_r= esource *r, struct kernfs_nod kn_subdir2 =3D kernfs_create_dir(kn_subdir, mevt->name, kn_subdir->mode,= mevt); if (IS_ERR(kn_subdir2)) { ret =3D PTR_ERR(kn_subdir2); - goto out; + return ret; } =20 ret =3D rdtgroup_kn_set_ugid(kn_subdir2); if (ret) - goto out; + return ret; =20 ret =3D rdtgroup_add_files(kn_subdir2, RFTYPE_ASSIGN_CONFIG); if (ret) - break; + return ret; } =20 -out: - return ret; + return 0; } =20 static int rdtgroup_mkdir_info_resdir(void *priv, char *name, --=20 2.43.0 From nobody Thu Jun 11 05:50:53 2026 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 61CB03E3DB6 for ; Wed, 6 May 2026 08:29:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778056152; cv=none; b=EO9cDLNCafrQwAhgQsKHAxyoAvxCdA3MR6IuKenF67TO6xxd3she1IbwrBq9H0iNeggLJLfJYoCI6jvCxIyfqe01GEDOl5S4WhSjBAgPVe9rNC+vhKbxkMj2DAjZKRABW2ZzTYV4TGLYopZhVvpOSLBkRU2qsdFZ69Zx1SFQKEU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778056152; c=relaxed/simple; bh=5VGuL82iXoX4pDbqndVdK2+cD2d0E3Pb1jjcNgdcU7k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QWgAu9vS9A6Je7ZGVcC1yVkWxqr1fA/aXzk5AtByw7mILbC2EOEn8RuGjRRf/2RwJraWz12WMj0Wk688kUPZv4NVBEVJVi8qKFypHCBa0vY/YOvPqeRiIIlxdPoolr/i3VZ5vZTEZP4EZxEd1NXmUDz4m28d70dazLGFqJDzSro= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=oxPbZqDs; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="oxPbZqDs" Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 322AD32CF; Wed, 6 May 2026 01:29:04 -0700 (PDT) Received: from e134344.cambridge.arm.com (e134344.arm.com [10.1.196.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id C4E733F836; Wed, 6 May 2026 01:29:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1778056149; bh=5VGuL82iXoX4pDbqndVdK2+cD2d0E3Pb1jjcNgdcU7k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oxPbZqDsgKcINIx72xs6/PlBeTYpnXYT1aJ8d1bRRb5c2qc4g01faTplIECfc2rsM DBC6bUPnSkl4qJ1SsRiWuSD0ofAl8Mh+jIwryIAmeoXVDASDmsQ/ZSIxM9fkssmD5W YcYf0OKH57sP6xOqRE7lp+qplFkHK6uRcuRej4GA= From: Ben Horgan To: linux-kernel@vger.kernel.org Cc: tony.luck@intel.com, reinette.chatre@intel.com, Dave.Martin@arm.com, james.morse@arm.com, babu.moger@amd.com, tglx@kernel.org, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, ben.horgan@arm.com, fenghuay@nvidia.com, tan.shaopeng@fujitsu.com Subject: [PATCH v7 2/7] x86,fs/resctrl: Create 'event_filter' files read only if they're not configurable Date: Wed, 6 May 2026 09:28:50 +0100 Message-ID: <20260506082855.3694761-3-ben.horgan@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260506082855.3694761-1-ben.horgan@arm.com> References: <20260506082855.3694761-1-ben.horgan@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" When the counter assignment mode is mbm_event resctrl assumes the MBM events are configurable and exposes the 'event_filter' files. These files live at info/L3_MON/event_configs//event_filter and are used to display and set the event configuration. The MPAM architecture has support for configuring the memory bandwidth utilization (MBWU) counters to only count reads or only count writes. However, in MPAM, this event filtering support is optional in the hardware (and not yet implemented in the MPAM driver) but MBM counter assignment is always possible for MPAM MBWU counters. In order to support mbm_event mode with MPAM, create the 'event_filter' files read only if the event configuration can't be changed. A user can still chmod the file and so also return early with an error from event_filter_write(). Introduce a new monitor property, mbm_cntr_configurable, to indicate whether or not assignable MBM counters are configurable. On x86, set this to true whenever mbm_cntr_assignable is true to keep existing behaviour. Signed-off-by: Ben Horgan Reviewed-by: Reinette Chatre Reviewed-by: Babu Moger Tested-by: Babu Moger --- Changes since v2: Use property, mbm_cntr_configurable, rather than arch hook Change the event_filter mode to read only in res_common_files[] Add resctrl_file_mode_init() and use in resctrl_l3_mon_resource_init() set mbm_cntr_configurable for x86 ABMC and mention in commit message Changes since v4: Add documentation make -> create in commit message Changes since v5: Commit message typo, In -> in Add Reinette's Rb --- Documentation/filesystems/resctrl.rst | 11 +++++------ arch/x86/kernel/cpu/resctrl/monitor.c | 1 + fs/resctrl/internal.h | 2 ++ fs/resctrl/monitor.c | 7 +++++++ fs/resctrl/rdtgroup.c | 11 ++++++++++- include/linux/resctrl.h | 16 +++++++++------- 6 files changed, 34 insertions(+), 14 deletions(-) diff --git a/Documentation/filesystems/resctrl.rst b/Documentation/filesyst= ems/resctrl.rst index b003bed339fd..2898a51e6f4b 100644 --- a/Documentation/filesystems/resctrl.rst +++ b/Documentation/filesystems/resctrl.rst @@ -427,9 +427,9 @@ with the following files: =20 Two MBM events are supported by default: mbm_local_bytes and mbm_total_by= tes. Each MBM event's sub-directory contains a file named "event_filter" that = is - used to view and modify which memory transactions the MBM event is config= ured - with. The file is accessible only when "mbm_event" counter assignment mod= e is - enabled. + used to view and (if writable) modify which memory transactions the MBM e= vent + is configured with. The file is accessible only when "mbm_event" counter + assignment mode is enabled. =20 List of memory transaction types supported: =20 @@ -454,9 +454,8 @@ with the following files: # cat /sys/fs/resctrl/info/L3_MON/event_configs/mbm_local_bytes/event_f= ilter local_reads,local_non_temporal_writes,local_reads_slow_memory =20 - Modify the event configuration by writing to the "event_filter" file with= in - the "event_configs" directory. The read/write "event_filter" file contain= s the - configuration of the event that reflects which memory transactions are co= unted by it. + The memory transactions the MBM event is configured with can be changed + if "event_filter" is writable. =20 For example:: =20 diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/re= sctrl/monitor.c index 9bd87bae4983..794a6fb175e4 100644 --- a/arch/x86/kernel/cpu/resctrl/monitor.c +++ b/arch/x86/kernel/cpu/resctrl/monitor.c @@ -454,6 +454,7 @@ int __init rdt_get_l3_mon_config(struct rdt_resource *r) (rdt_cpu_has(X86_FEATURE_CQM_MBM_TOTAL) || rdt_cpu_has(X86_FEATURE_CQM_MBM_LOCAL))) { r->mon.mbm_cntr_assignable =3D true; + r->mon.mbm_cntr_configurable =3D true; cpuid_count(0x80000020, 5, &eax, &ebx, &ecx, &edx); r->mon.num_mbm_cntrs =3D (ebx & GENMASK(15, 0)) + 1; hw_res->mbm_cntr_assign_enabled =3D true; diff --git a/fs/resctrl/internal.h b/fs/resctrl/internal.h index 1a9b29119f88..48af75b9dc85 100644 --- a/fs/resctrl/internal.h +++ b/fs/resctrl/internal.h @@ -408,6 +408,8 @@ void __check_limbo(struct rdt_l3_mon_domain *d, bool fo= rce_free); =20 void resctrl_file_fflags_init(const char *config, unsigned long fflags); =20 +void resctrl_file_mode_init(const char *config, umode_t mode); + void rdt_staged_configs_clear(void); =20 bool closid_allocated(unsigned int closid); diff --git a/fs/resctrl/monitor.c b/fs/resctrl/monitor.c index 9fd901c78dc6..916f7a9d5658 100644 --- a/fs/resctrl/monitor.c +++ b/fs/resctrl/monitor.c @@ -1422,6 +1422,11 @@ ssize_t event_filter_write(struct kernfs_open_file *= of, char *buf, size_t nbytes ret =3D -EINVAL; goto out_unlock; } + if (!r->mon.mbm_cntr_configurable) { + rdt_last_cmd_puts("event_filter is not configurable\n"); + ret =3D -EPERM; + goto out_unlock; + } =20 ret =3D resctrl_parse_mem_transactions(buf, &evt_cfg); if (!ret && mevt->evt_cfg !=3D evt_cfg) { @@ -1886,6 +1891,8 @@ int resctrl_l3_mon_resource_init(void) resctrl_file_fflags_init("available_mbm_cntrs", RFTYPE_MON_INFO | RFTYPE_RES_CACHE); resctrl_file_fflags_init("event_filter", RFTYPE_ASSIGN_CONFIG); + if (r->mon.mbm_cntr_configurable) + resctrl_file_mode_init("event_filter", 0644); resctrl_file_fflags_init("mbm_assign_on_mkdir", RFTYPE_MON_INFO | RFTYPE_RES_CACHE); resctrl_file_fflags_init("mbm_L3_assignments", RFTYPE_MON_BASE); diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c index fb6999178fe2..b382a348dd79 100644 --- a/fs/resctrl/rdtgroup.c +++ b/fs/resctrl/rdtgroup.c @@ -2022,7 +2022,7 @@ static struct rftype res_common_files[] =3D { }, { .name =3D "event_filter", - .mode =3D 0644, + .mode =3D 0444, .kf_ops =3D &rdtgroup_kf_single_ops, .seq_show =3D event_filter_show, .write =3D event_filter_write, @@ -2215,6 +2215,15 @@ void resctrl_file_fflags_init(const char *config, un= signed long fflags) rft->fflags =3D fflags; } =20 +void resctrl_file_mode_init(const char *config, umode_t mode) +{ + struct rftype *rft; + + rft =3D rdtgroup_get_rftype_by_name(config); + if (rft) + rft->mode =3D mode; +} + /** * rdtgroup_kn_mode_restrict - Restrict user access to named resctrl file * @r: The resource group with which the file is associated. diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h index 006e57fd7ca5..06e8c72e8660 100644 --- a/include/linux/resctrl.h +++ b/include/linux/resctrl.h @@ -286,13 +286,14 @@ enum resctrl_schema_fmt { =20 /** * struct resctrl_mon - Monitoring related data of a resctrl resource. - * @num_rmid: Number of RMIDs available. - * @mbm_cfg_mask: Memory transactions that can be tracked when bandwidth - * monitoring events can be configured. - * @num_mbm_cntrs: Number of assignable counters. - * @mbm_cntr_assignable:Is system capable of supporting counter assignment? - * @mbm_assign_on_mkdir:True if counters should automatically be assigned = to MBM - * events of monitor groups created via mkdir. + * @num_rmid: Number of RMIDs available. + * @mbm_cfg_mask: Memory transactions that can be tracked when + * bandwidth monitoring events can be configured. + * @num_mbm_cntrs: Number of assignable counters. + * @mbm_cntr_assignable: Is system capable of supporting counter assignmen= t? + * @mbm_assign_on_mkdir: True if counters should automatically be assigned= to MBM + * events of monitor groups created via mkdir. + * @mbm_cntr_configurable: True if assignable counters are configurable. */ struct resctrl_mon { u32 num_rmid; @@ -300,6 +301,7 @@ struct resctrl_mon { int num_mbm_cntrs; bool mbm_cntr_assignable; bool mbm_assign_on_mkdir; + bool mbm_cntr_configurable; }; =20 /** --=20 2.43.0 From nobody Thu Jun 11 05:50:53 2026 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5F6A43E3D8D for ; Wed, 6 May 2026 08:29:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778056154; cv=none; b=ffUjgc0nUWlk3rFDxehaFmwwZQLJVEjxVM3y8cRMxqOnbuvXzVfSKm8Z+zFKTuuSB9iffiRBZFSFGVy6Q94Ax8QTdTHR59lRmfns9DtMv+kouiSAZc+Ii3d+6H4aPObmUEjWMXoC5g1eK1C4DEnf68j6814Au+VBROKDGDfMP+Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778056154; c=relaxed/simple; bh=RHERwI/V2582YDF2zurjHnpNfiEb650HwFIaihu9bRw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Z7xiXCPRZjenWG2ecef0/0mCeiR+zCBGkICDdp1PmUq8YEk1aowGKw7j2Ku/Kr5w0U8U/laTt6yintmedQvVaJtpP0GpKuHg+mvOXKGmc8wmcmdF2jB2UwMvi8IX/EmPjsNwgnCDJ0iLGe3Ge2AG9qWHVxpbKaXH6a/JPAzHkTs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=Qyq3tHTx; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="Qyq3tHTx" Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 41C8A32E4; Wed, 6 May 2026 01:29:06 -0700 (PDT) Received: from e134344.cambridge.arm.com (e134344.arm.com [10.1.196.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id D0A093F836; Wed, 6 May 2026 01:29:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1778056151; bh=RHERwI/V2582YDF2zurjHnpNfiEb650HwFIaihu9bRw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Qyq3tHTxGncuhrbHcdk2zzyEFN3oYXq1iCySLTIfyGFmNfkN7xH1v6gdP2Uqj997J yJBPn55rqB3jgaaDh2bCBUGOuvj5/pJeUJo+WG0iVDEWPhuRx1R3DPQRT0Xp5S7PHr jaCl1BdFCAq4mCX/CgWmLfA39hDSyHA+uveTDrpc= From: Ben Horgan To: linux-kernel@vger.kernel.org Cc: tony.luck@intel.com, reinette.chatre@intel.com, Dave.Martin@arm.com, james.morse@arm.com, babu.moger@amd.com, tglx@kernel.org, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, ben.horgan@arm.com, fenghuay@nvidia.com, tan.shaopeng@fujitsu.com Subject: [PATCH v7 3/7] fs/resctrl: Disallow the software controller when MBM counters are assignable Date: Wed, 6 May 2026 09:28:51 +0100 Message-ID: <20260506082855.3694761-4-ben.horgan@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260506082855.3694761-1-ben.horgan@arm.com> References: <20260506082855.3694761-1-ben.horgan@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The software controller requires that there is one MBM counter per monitor group that is assigned to the event backing the software controller, as per mba_MBps_event. When mbm_event mode is in use, it is not guaranteed that any particular event will have an assigned counter. Currently, only AMD systems support counter assignment, but the MBA delay is non-linear and so the software controller is never supported anyway. On MPAM systems, the MBA delay is linear and so the software controller could be supported. The MPAM driver, unless a need arises, will not support the 'default' mbm_assign_mode and will always use the 'mbm_event' mode for memory bandwidth monitoring. Rather than develop a way to guarantee the counter assignment requirements needed by the software controller, take the pragmatic approach. Don't allow the software controller to be used at the same time as 'mbm_event' mode. As MPAM is the only relevant architecture and it will use 'mbm_event' mode whenever there are assignable MBM counters, for simplicity's sake, don't allow the software controller when the MBM counters are assignable. Implement this by failing the mount if the user requests the software controller, the mba_MBps option, and the MBM counters are assignable. Signed-off-by: Ben Horgan Reviewed-by: Reinette Chatre Reviewed-by: Babu Moger Tested-by: Babu Moger --- Changes since v4: Remove "for each MBA control" from commit message Update last_cmd_status message Changes since v5: Extend comment on supports_mba_mbps() (Reinette) Add Reinette's R-b --- fs/resctrl/rdtgroup.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c index b382a348dd79..459eb8accc6f 100644 --- a/fs/resctrl/rdtgroup.c +++ b/fs/resctrl/rdtgroup.c @@ -2518,10 +2518,13 @@ static void mba_sc_domain_destroy(struct rdt_resour= ce *r, } =20 /* - * MBA software controller is supported only if - * MBM is supported and MBA is in linear scale, - * and the MBM monitor scope is the same as MBA - * control scope. + * The MBA software controller is supported only if MBM is supported and M= BA is + * in linear scale, and the MBM monitor scope is the same as MBA control s= cope. + * + * The software controller cannot be supported when the MBM counters are + * assignable. There is no guarantee that MBM counters are assigned to the + * event backing the software controller in all monitoring domains of all + * monitoring groups. */ static bool supports_mba_mbps(void) { @@ -2530,7 +2533,8 @@ static bool supports_mba_mbps(void) =20 return (resctrl_is_mbm_enabled() && r->alloc_capable && is_mba_linear() && - r->ctrl_scope =3D=3D rmbm->mon_scope); + r->ctrl_scope =3D=3D rmbm->mon_scope && + !rmbm->mon.mbm_cntr_assignable); } =20 /* @@ -2945,7 +2949,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 MBM and linear scale MBA at L3 scope"; + msg =3D "mba_MBps requires MBM (mbm_event mode not supported) and linear= scale MBA at L3 scope"; if (!supports_mba_mbps()) return invalfc(fc, msg); ctx->enable_mba_mbps =3D true; --=20 2.43.0 From nobody Thu Jun 11 05:50:53 2026 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 327AB3E3D80 for ; Wed, 6 May 2026 08:29:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778056155; cv=none; b=m6aZm5QxvJDZZvR2rcngIPu1q5L5/Gt3KbT762fdBJOYuqSovwYQYY6ukj4cjyw24tSCFrEHG4CW+4jNm4vBv6NeZx9rYUY+dVeRDOFCWOt/TnrM7SeaLDvCI73Vglu+mPT0yyiARfDIimYG3tFCHYyxFAAnkddIOGo4pGJPF0g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778056155; c=relaxed/simple; bh=PbOuR4xX1K8EMMQRK5J9AZSnA5Kl408aUg2WDpfzcKw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=A34qzLWXwd9vzldrKXCh4AaygzrS3MAiuMxu9pBH6ifrayiq1l/RFMXAWBTKsXpOSimCTK+28B5V5X7FBFpuTOZxTXp1hL7ktOkwZLOw81iAyQjb4tpDE5Ydqz1aQFDtpDaErhcYlYE/WZ2LI3f4fI8EFNMvR9fDvTeWdVs5qYs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=pKprwhR9; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="pKprwhR9" Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4A8263318; Wed, 6 May 2026 01:29:08 -0700 (PDT) Received: from e134344.cambridge.arm.com (e134344.arm.com [10.1.196.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id DC7213F836; Wed, 6 May 2026 01:29:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1778056153; bh=PbOuR4xX1K8EMMQRK5J9AZSnA5Kl408aUg2WDpfzcKw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pKprwhR9o4sGYPuP6RTaCOISSOnO0KWX1f12USNm8P4H1OK6KjKmX5hN+AlNdGB/S JBtGyneLNQHYShpfAzvyeNpLyKEeSu0SNKaonThYwohGYKNi5ufdSDK7BAl2A8A1Ff US6+hTeejxJ1ZkryP++AahcLP8+D45zzP5k0utbk= From: Ben Horgan To: linux-kernel@vger.kernel.org Cc: tony.luck@intel.com, reinette.chatre@intel.com, Dave.Martin@arm.com, james.morse@arm.com, babu.moger@amd.com, tglx@kernel.org, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, ben.horgan@arm.com, fenghuay@nvidia.com, tan.shaopeng@fujitsu.com Subject: [PATCH v7 4/7] fs/resctrl: Add monitor property 'mbm_cntr_assign_fixed' Date: Wed, 6 May 2026 09:28:52 +0100 Message-ID: <20260506082855.3694761-5-ben.horgan@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260506082855.3694761-1-ben.horgan@arm.com> References: <20260506082855.3694761-1-ben.horgan@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Commit 3b497c3f4f04 ("fs/resctrl: Introduce the interface to display monitoring = modes") introduced CONFIG_RESCTRL_ASSIGN_FIXED but left adding the Kconfig entry until it was necessary. The counter assignment mode is fixed in MPAM, even when there are assignable counters, and so addressing this is needed to support MPAM. To avoid the burden of another Kconfig entry, replace CONFIG_RESCTRL_ASSIGN_FIXED with a new property in 'struct resctrl_mon', 'mbm_cntr_assign_fixed' to be set by the architecture. Do not request the architecture to change the counter assignment mode if it does not support doing so. Provide insight to user space about why such a request fails. Signed-off-by: Ben Horgan Reviewed-by: Reinette Chatre Reviewed-by: Babu Moger Tested-by: Babu Moger --- Changes since v2: Change to a resctrl_mon property rather than a arch hook Update the commit message to mention the property Changes since v4: fix -> fixed in comment commit message drop x86 In commit message add "to be set by the architecture" and update last paragraph. Changes since v5: Add Reinette's R-b --- fs/resctrl/monitor.c | 8 +++++++- include/linux/resctrl.h | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/fs/resctrl/monitor.c b/fs/resctrl/monitor.c index 916f7a9d5658..5fbcc64e50ce 100644 --- a/fs/resctrl/monitor.c +++ b/fs/resctrl/monitor.c @@ -1456,7 +1456,7 @@ int resctrl_mbm_assign_mode_show(struct kernfs_open_f= ile *of, else seq_puts(s, "[default]\n"); =20 - if (!IS_ENABLED(CONFIG_RESCTRL_ASSIGN_FIXED)) { + if (!r->mon.mbm_cntr_assign_fixed) { if (enabled) seq_puts(s, "default\n"); else @@ -1507,6 +1507,12 @@ ssize_t resctrl_mbm_assign_mode_write(struct kernfs_= open_file *of, char *buf, } =20 if (enable !=3D resctrl_arch_mbm_cntr_assign_enabled(r)) { + if (r->mon.mbm_cntr_assign_fixed) { + ret =3D -EINVAL; + rdt_last_cmd_puts("Counter assignment mode is not configurable\n"); + goto out_unlock; + } + ret =3D resctrl_arch_mbm_cntr_assign_set(r, enable); if (ret) goto out_unlock; diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h index 06e8c72e8660..73ff522448a0 100644 --- a/include/linux/resctrl.h +++ b/include/linux/resctrl.h @@ -294,6 +294,7 @@ enum resctrl_schema_fmt { * @mbm_assign_on_mkdir: True if counters should automatically be assigned= to MBM * events of monitor groups created via mkdir. * @mbm_cntr_configurable: True if assignable counters are configurable. + * @mbm_cntr_assign_fixed: True if the counter assignment mode is fixed. */ struct resctrl_mon { u32 num_rmid; @@ -302,6 +303,7 @@ struct resctrl_mon { bool mbm_cntr_assignable; bool mbm_assign_on_mkdir; bool mbm_cntr_configurable; + bool mbm_cntr_assign_fixed; }; =20 /** --=20 2.43.0 From nobody Thu Jun 11 05:50:53 2026 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4E24C3E557E for ; Wed, 6 May 2026 08:29:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778056157; cv=none; b=ObzrMik54k8EGe66bTWYYYhh6lsK+YuT4d3BvOCBmEMSOhpNWE8mW2xUVHPZMotQBQEct5gP6CpOULXxoL7yopSASz8uPMyuziJjqqg3BFU/MuwaC0BtI62ksRvolMSB/SzCP37nIvD/6DXrmTLWpEsF7ozFAkuhTI6aWdyi0ec= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778056157; c=relaxed/simple; bh=chmImYVBLPHJJ8Tso/tSEM45J4HazsQ8gqUV3HpkWG8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cHFPABJKuDx0Hmnlz23nIVOxslR838Dxi2Vom6LEkfwTUJPbwG/X8O0XQV5dyAFIiE9zhDkkcnj6gey3CbfoiHWH0P+voUcAcYeSRWa6jPUcITrYP8pOM0bcnnmxe3M6g1nNVr0SgCUvWaP5IulBmpmE6Yf8qXCvzFAJevDeOW4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=N/qWEzfI; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="N/qWEzfI" Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 54D971A25; Wed, 6 May 2026 01:29:10 -0700 (PDT) Received: from e134344.cambridge.arm.com (e134344.arm.com [10.1.196.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id E7F9C3F836; Wed, 6 May 2026 01:29:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1778056155; bh=chmImYVBLPHJJ8Tso/tSEM45J4HazsQ8gqUV3HpkWG8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N/qWEzfIt823K0ugSmPpTuIH8lrZOvYqb2VxioIX1Qj2MWJZqaJyZ8KRhIiBqjbAj cR/P9oE2b2ne76LnBLaRD1ft2wGU1ipOjjRH8Psid6onLOLcdEFsY/fn028uProAbG joyS33Jn13zvPdTnQo+3RDeOZsecptUxJCeaJ1TI= From: Ben Horgan To: linux-kernel@vger.kernel.org Cc: tony.luck@intel.com, reinette.chatre@intel.com, Dave.Martin@arm.com, james.morse@arm.com, babu.moger@amd.com, tglx@kernel.org, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, ben.horgan@arm.com, fenghuay@nvidia.com, tan.shaopeng@fujitsu.com Subject: [PATCH v7 5/7] fs/resctrl: Continue counter allocation after failure Date: Wed, 6 May 2026 09:28:53 +0100 Message-ID: <20260506082855.3694761-6-ben.horgan@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260506082855.3694761-1-ben.horgan@arm.com> References: <20260506082855.3694761-1-ben.horgan@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" In mbm_event mode, with mbm_assign_on_mkdir set to 1, when a user creates a new CTRL_MON or MON group resctrl attempts to allocate counters for each of the supported MBM events on each resctrl domain. As counters are limited, such allocation may fail and when it does counter allocations for the remaining domains are skipped even if the domains have available counters. Since a counter allocation failure may result in counter allocation being skipped on other domains the user needs to view the resource group's mbm_L3_assignments file to get an accurate view of counter assignment in a new resource group and then manually create counters in the skipped domains with available counters. Writes to mbm_L3_assignments using the wildcard format, :*=3De, also skip counter allocation in other domains after a counter allocation failure. When handling a request to create counters in all domains it is unnecessary for a counter allocation in one domain to prevent counter allocation in other domains. Always attempt to allocate all the counters requested. Signed-off-by: Ben Horgan Reviewed-by: Reinette Chatre Reviewed-by: Babu Moger Tested-by: Babu Moger --- Changes since v4: Update commit message (Reinette) Changes since v5: files -> file in commit message Add Reinette's R-b --- fs/resctrl/monitor.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/fs/resctrl/monitor.c b/fs/resctrl/monitor.c index 5fbcc64e50ce..0e6a389a16bf 100644 --- a/fs/resctrl/monitor.c +++ b/fs/resctrl/monitor.c @@ -1211,9 +1211,10 @@ static int rdtgroup_alloc_assign_cntr(struct rdt_res= ource *r, struct rdt_l3_mon_ * NULL; otherwise, assign the counter to the specified domain @d. * * If all counters in a domain are already in use, rdtgroup_alloc_assign_c= ntr() - * will fail. The assignment process will abort at the first failure encou= ntered - * during domain traversal, which may result in the event being only parti= ally - * assigned. + * will fail. When attempting to assign counters to all domains, carry on = trying + * to assign counters after a failure since only some domains may have cou= nters + * and the goal is to assign counters where possible. If any counter assig= nment + * fails, return the error from the last failing assignment. * * Return: * 0 on success, < 0 on failure. @@ -1226,9 +1227,11 @@ static int rdtgroup_assign_cntr_event(struct rdt_l3_= mon_domain *d, struct rdtgro =20 if (!d) { list_for_each_entry(d, &r->mon_domains, hdr.list) { - ret =3D rdtgroup_alloc_assign_cntr(r, d, rdtgrp, mevt); - if (ret) - return ret; + int err; + + err =3D rdtgroup_alloc_assign_cntr(r, d, rdtgrp, mevt); + if (err) + ret =3D err; } } else { ret =3D rdtgroup_alloc_assign_cntr(r, d, rdtgrp, mevt); --=20 2.43.0 From nobody Thu Jun 11 05:50:53 2026 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 058653E5ECB for ; Wed, 6 May 2026 08:29:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778056159; cv=none; b=JsmZYM8IV0lyMgvmVCfttCDtnE+SXWQJOLBuriJn69kZLlDRuyqPt63CGxlXUNZ1g99CxEpTEk5RMZ6tmKT8kBoC6uDHBy+1vaq9C6CWe4FBQQJ66nEFVY3QhkTcBwXZblw6WdBLUZgljvB7PXYMWQxV7jsiMQh9Ou/eAbvuGS0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778056159; c=relaxed/simple; bh=IEbO8c0VoV2wXdge73Q9P25Q8+7bAKUjsgH/T+KToAg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WaigAJn1k5w1E2/n5vNj7sBw0eNBy591M27Io9m6Zc4IGfXOeSRkjBG7SyETiccqBmM0vvFoX/cpPuvYU6bhGhZ+3b8T9k/aj/L+VP7SZbLm4Tl3MfFWTNwmzngunfAMzq6pfCPXEs9yz5hlQhiOkz0mkW4ehgi2h4D8fe0yV8o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=nnyqSaz6; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="nnyqSaz6" Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 667F3331A; Wed, 6 May 2026 01:29:12 -0700 (PDT) Received: from e134344.cambridge.arm.com (e134344.arm.com [10.1.196.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id F2CCD3F836; Wed, 6 May 2026 01:29:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1778056157; bh=IEbO8c0VoV2wXdge73Q9P25Q8+7bAKUjsgH/T+KToAg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nnyqSaz6jPfDSl8Q+s0lZ08nVjKnI/dWbqMokBChzTbPZJgIrKdquUGa1ILUxDn/5 /NvqVqZ3YrXKt5oed0qTAXuPevrJoMMFl3/GdHaYm9cQbjpuJ8kj2uzl/wxtztc3YL UKRvTMy++DNBsExE/eLJFZhrbEInthKwRhTqiW9E= From: Ben Horgan To: linux-kernel@vger.kernel.org Cc: tony.luck@intel.com, reinette.chatre@intel.com, Dave.Martin@arm.com, james.morse@arm.com, babu.moger@amd.com, tglx@kernel.org, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, ben.horgan@arm.com, fenghuay@nvidia.com, tan.shaopeng@fujitsu.com Subject: [PATCH v7 6/7] fs/resctrl: Document that automatic counter assignment is best effort Date: Wed, 6 May 2026 09:28:54 +0100 Message-ID: <20260506082855.3694761-7-ben.horgan@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260506082855.3694761-1-ben.horgan@arm.com> References: <20260506082855.3694761-1-ben.horgan@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" When using automatic counter assignment it's useful for a user to know which counters they can expect to be assigned on group creation. Document that automatic counter assignment is best effort and how to discover any assignment failures. Suggested-by: Reinette Chatre Signed-off-by: Ben Horgan Reviewed-by: Reinette Chatre Reviewed-by: Babu Moger Tested-by: Babu Moger --- Changes since v4: Point user to mbm_L3_assignments rather than last_cmd_status (Reinette) Add "in all domains" (Reinette) Changes since v5: Add Reinette's R-b --- Documentation/filesystems/resctrl.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Documentation/filesystems/resctrl.rst b/Documentation/filesyst= ems/resctrl.rst index 2898a51e6f4b..b388e9193896 100644 --- a/Documentation/filesystems/resctrl.rst +++ b/Documentation/filesystems/resctrl.rst @@ -479,6 +479,12 @@ with the following files: "1": Auto assignment is enabled. =20 + Automatic counter assignment is done with best effort. If auto + assignment is enabled but there are not enough available counters then + monitor group creation could succeed while one or more events belonging + to the group may not have a counter assigned in all domains. Consult + mbm_L3_assignments for counter assignment states of the new groups. + Example:: =20 # echo 0 > /sys/fs/resctrl/info/L3_MON/mbm_assign_on_mkdir --=20 2.43.0 From nobody Thu Jun 11 05:50:53 2026 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A8AB33E6389 for ; Wed, 6 May 2026 08:29:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778056162; cv=none; b=al8hwmDS92DWqok/IFHLbGupyBs38s02bqKkMDjob7zM6/wqoa2i2UDIpg+dCIbgDey7v1VzNBQGeBFAxaR3mEvYGf45Zn09BkR/eQzpnYdNhgydWpBI45q5EeGfEKSH6vK6H2paUB6J82A6zQ4bSQDEGehcS2yku7oYCZT2c6A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778056162; c=relaxed/simple; bh=8ayx3YQjK9IQqtjWpuX6HJdEkM3DVaPur5Xb0z3dZi8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EnN2WmGmOx0U94DtnrbT1pqI7KhBWChDdLIMfvLXlltuwG7RenkYonHCacs8WTPVnC3xSZMJ0pKiaO+7srcfUsQ3hD5r5/xbTMdbfw4Js+H5SvVi79lW+S/WSI4En+F+hpoHrjgeeAyFCW8NaSmO83jw4OLkEzdzknF4ADDYgvc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=WqIm1hUd; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="WqIm1hUd" Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6F1B11AED; Wed, 6 May 2026 01:29:14 -0700 (PDT) Received: from e134344.cambridge.arm.com (e134344.arm.com [10.1.196.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 0B42B3F836; Wed, 6 May 2026 01:29:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1778056159; bh=8ayx3YQjK9IQqtjWpuX6HJdEkM3DVaPur5Xb0z3dZi8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WqIm1hUdxDt6XdAREqzU+HUWsiqE7UzVfg7aaQyVFZXtTz87TbLGUdJpwl51qZPxg BpRKi32shxE8u1ugarfDUclPRWwY7FId/aqSY9/CvhOMD0oGIBzUWg2Unj7/bwBbsK kzaMol3/TDPKadE4GnNdc3no49/3VeE4NrdygftY= From: Ben Horgan To: linux-kernel@vger.kernel.org Cc: tony.luck@intel.com, reinette.chatre@intel.com, Dave.Martin@arm.com, james.morse@arm.com, babu.moger@amd.com, tglx@kernel.org, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, ben.horgan@arm.com, fenghuay@nvidia.com, tan.shaopeng@fujitsu.com Subject: [PATCH v7 7/7] fs/resctrl: Document tasks file behaviour for task id 0 and idle tasks Date: Wed, 6 May 2026 09:28:55 +0100 Message-ID: <20260506082855.3694761-8-ben.horgan@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260506082855.3694761-1-ben.horgan@arm.com> References: <20260506082855.3694761-1-ben.horgan@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" When 0 is written to the tasks file it is interpreted as the current task in rdtgroup_move_task(). Each CPU's idle task has task_struct::pid set to 0 and, on x86, task_struct::closid to RESCTRL_RESERVED_CLOSID and task_struct::rmid to RESCTRL_RESERVED_RMID. Equivalently, on MPAM platforms, thread_info::mpam_partid_pmg is encoded with PARTID and PMG set to RESCTRL_RESERVED_CLOSID and RESCTRL_RESERVED_RMID, respectively. As there is no interface to change these from the default, the resctrl configuration for the idle tasks is fixed and they always behave equivalently to a task in the default tasks file and so take their configuration from the cpus/cpus_list files. On read of the tasks file, show_rdt_tasks() filters out any 0 PID. Hence, a task id of 0 is never shown in the tasks file and the idle tasks are not represented either. Document the user visible behaviour. Signed-off-by: Ben Horgan Reviewed-by: Reinette Chatre Reviewed-by: Babu Moger Tested-by: Babu Moger --- I have confirmed this experimentally on an MPAM platform. Changes since v4: Clean up the commit message (Reinette) Changes since v5: Add Reinette's R-b --- Documentation/filesystems/resctrl.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Documentation/filesystems/resctrl.rst b/Documentation/filesyst= ems/resctrl.rst index b388e9193896..e4b66af55ffb 100644 --- a/Documentation/filesystems/resctrl.rst +++ b/Documentation/filesystems/resctrl.rst @@ -575,6 +575,11 @@ All groups contain the following files: then the task must already belong to the CTRL_MON parent of this group. The task is removed from any previous MON group. =20 + When writing to this file, a task id of 0 is interpreted as the + task id of the currently running task. On reading the file, a task + id of 0 will never be shown and there is no representation of the + idle tasks. Instead, a CPU's idle task is always considered as a + member of the group owning the CPU. =20 "cpus": Reading this file shows a bitmask of the logical CPUs owned by --=20 2.43.0