From nobody Sat Apr 11 12:21:33 2026 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BD1033CF681 for ; Fri, 13 Mar 2026 17:45:43 +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=1773423945; cv=none; b=rtaLZaV6h5SKXbyDs+ZgP1lCzx8CYMmgqwoxkVBYuuo1OzEDS5Yol0KuFH4fqpisVxiCmJyLDu+h9H5/fD1pNw0szKcNzPWtdPfrwhYI6RG+vDdVcDm1xCvYoXYz6vXLzIUXk4w5I4YO8TbSpNN8U0HH6VirVD0FRxZzYjnCWi0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773423945; c=relaxed/simple; bh=fiS+WI7+dFbwd3+osifScvvOyqC4dpyEw/XxyoTVVuo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=hEaGeSTCttH054CNqo2GoLV/9aIonH7JJ84y3eeuKuWy3oFCAw7YFrz8MZsfdpXq36A84o/XYEvcJtnw6Rc502SrmTgwD2CSGtPxcHBewpUr5UwZLa5wKFfOLhH6zPAUhZ6j6Q7AVmXuBH6TuZwe+0SedHbym3pXS9EgheStKNk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 102A622C7; Fri, 13 Mar 2026 10:45:37 -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 1A7DF3F694; Fri, 13 Mar 2026 10:45:40 -0700 (PDT) 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 v2 3/6] fs/resctrl: Make 'event_filter' files read only if they're not configurable Date: Fri, 13 Mar 2026 17:45:21 +0000 Message-ID: <20260313174524.3482767-4-ben.horgan@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260313174524.3482767-1-ben.horgan@arm.com> References: <20260313174524.3482767-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 driver has no support for changing event configuration and so mbm_event mode can't be used. In order to support mbm_event event with MPAM make 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 an error from event_filter_write(). Signed-off-by: Ben Horgan --- fs/resctrl/monitor.c | 6 ++++++ fs/resctrl/rdtgroup.c | 16 ++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/fs/resctrl/monitor.c b/fs/resctrl/monitor.c index d25622ee22c5..a2da771d82df 100644 --- a/fs/resctrl/monitor.c +++ b/fs/resctrl/monitor.c @@ -1414,6 +1414,12 @@ ssize_t event_filter_write(struct kernfs_open_file *= of, char *buf, size_t nbytes =20 rdt_last_cmd_clear(); =20 + if (!resctrl_arch_is_evt_configurable(mevt->evtid, true)) { + rdt_last_cmd_printf("event_filter is not configurable for %s\n", mevt->n= ame); + ret =3D -EPERM; + goto out_unlock; + } + r =3D resctrl_arch_get_resource(mevt->rid); if (!resctrl_arch_mbm_cntr_assign_enabled(r)) { rdt_last_cmd_puts("mbm_event counter assignment mode is not enabled\n"); diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c index 4753841c2ca3..2f0a509b313a 100644 --- a/fs/resctrl/rdtgroup.c +++ b/fs/resctrl/rdtgroup.c @@ -2341,6 +2341,22 @@ static int resctrl_mkdir_event_configs(struct rdt_re= source *r, struct kernfs_nod ret =3D rdtgroup_add_files(kn_subdir2, RFTYPE_ASSIGN_CONFIG); if (ret) return ret; + + if (!resctrl_arch_is_evt_configurable(mevt->evtid, true)) { + struct iattr iattr =3D {.ia_valid =3D ATTR_MODE,}; + struct kernfs_node *kn; + + kn =3D kernfs_find_and_get_ns(kn_subdir2, "event_filter", NULL); + if (!kn) + return -ENOENT; + + iattr.ia_mode =3D S_IFREG | 0444; + + ret =3D kernfs_setattr(kn, &iattr); + kernfs_put(kn); + if (ret) + return ret; + } } =20 return 0; --=20 2.43.0