From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AEAED426D25 for ; Tue, 28 Apr 2026 13:04:42 +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=1777381484; cv=none; b=svp13iSRGF9dwArOygBW2/3ywwbjo5gU/AiD6BvaismNhHr1iCK8Qu4/tDUBVLmv2YLnp0tPvWLpEyCbnVtLoVOFG3GqgtMweF7EoiTxrFeWrPSHBACRDQZq0iiSYL2uoJEDVm+o6iFkPY8afuyrFmsm+r3Pm8CcEOSPCQ3gB0E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777381484; c=relaxed/simple; bh=Wtdx1tzqQdWmhIx083AC4AoKTHILekBfkOD16l1CMbQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rOPd8IYQs93P+yUNmqoKWySciJbovIBstprvNeaTAhbdEXY/p3dfXkWNrwu3lu1+OgdahB7f14r1LLW9w2mnd2fgOvHo7XtSO+eADvY6MASqF3fDRFP14c9pCv20ysJAdQ9JlXA0o99CxdRuZ+IFma79ov1y/aJbzxc+0EaXGG0= 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=rwf4q/8m; 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="rwf4q/8m" 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 8D74D2BCB; Tue, 28 Apr 2026 06:04:36 -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 E4C853F62B; Tue, 28 Apr 2026 06:04:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1777381482; bh=Wtdx1tzqQdWmhIx083AC4AoKTHILekBfkOD16l1CMbQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rwf4q/8mg5F+8L5whuyXpLmV6nEFZIV6cg2iJ6jHaoQvXRlp8ifLuq7NOkqv/f7lt jrUf9/3e7eywPscTo7HW2yQVbKeq81IXM/IJ8E2jqXpRksfl24cwBxuBlaqqOAqDiv mJoHCfVzoV3oBL0Oh0CK57lyJ60aVzxyd8W7+xMc= 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 v5 4/7] fs/resctrl: Add monitor property 'mbm_cntr_assign_fixed' Date: Tue, 28 Apr 2026 14:04:19 +0100 Message-ID: <20260428130422.2287302-5-ben.horgan@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260428130422.2287302-1-ben.horgan@arm.com> References: <20260428130422.2287302-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: 8bit 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 --- 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. --- 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_file *of, else seq_puts(s, "[default]\n"); - 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, } if (enable != resctrl_arch_mbm_cntr_assign_enabled(r)) { + if (r->mon.mbm_cntr_assign_fixed) { + ret = -EINVAL; + rdt_last_cmd_puts("Counter assignment mode is not configurable\n"); + goto out_unlock; + } + ret = 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; }; /** -- 2.43.0