Skip to content

Commit c32a7d7

Browse files
James Morsebp3tk0v
authored andcommitted
x86/resctrl: Move mbm_cfg_mask to struct rdt_resource
The mbm_cfg_mask field lists the bits that user-space can set when configuring an event. This value is output via the last_cmd_status file. Once the filesystem parts of resctrl are moved to live in /fs/, the struct rdt_hw_resource is inaccessible to the filesystem code. Because this value is output to user-space, it has to be accessible to the filesystem code. Move it to struct rdt_resource. Signed-off-by: James Morse <james.morse@arm.com> Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de> Reviewed-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com> Reviewed-by: Tony Luck <tony.luck@intel.com> Reviewed-by: Reinette Chatre <reinette.chatre@intel.com> Reviewed-by: Fenghua Yu <fenghuay@nvidia.com> Reviewed-by: Babu Moger <babu.moger@amd.com> Tested-by: Carl Worth <carl@os.amperecomputing.com> # arm64 Tested-by: Shaopeng Tan <tan.shaopeng@jp.fujitsu.com> Tested-by: Peter Newman <peternewman@google.com> Tested-by: Amit Singh Tomar <amitsinght@marvell.com> # arm64 Tested-by: Shanker Donthineni <sdonthineni@nvidia.com> # arm64 Tested-by: Babu Moger <babu.moger@amd.com> Link: https://lore.kernel.org/r/20250311183715.16445-23-james.morse@arm.com
1 parent 37bae17 commit c32a7d7

File tree

4 files changed

+6
-7
lines changed

4 files changed

+6
-7
lines changed

arch/x86/kernel/cpu/resctrl/internal.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -417,8 +417,6 @@ struct msr_param {
417417
* @msr_update: Function pointer to update QOS MSRs
418418
* @mon_scale: cqm counter * mon_scale = occupancy in bytes
419419
* @mbm_width: Monitor width, to detect and correct for overflow.
420-
* @mbm_cfg_mask: Bandwidth sources that can be tracked when Bandwidth
421-
* Monitoring Event Configuration (BMEC) is supported.
422420
* @cdp_enabled: CDP state of this resource
423421
*
424422
* Members of this structure are either private to the architecture
@@ -432,7 +430,6 @@ struct rdt_hw_resource {
432430
void (*msr_update)(struct msr_param *m);
433431
unsigned int mon_scale;
434432
unsigned int mbm_width;
435-
unsigned int mbm_cfg_mask;
436433
bool cdp_enabled;
437434
};
438435

arch/x86/kernel/cpu/resctrl/monitor.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1260,7 +1260,7 @@ int __init rdt_get_mon_l3_config(struct rdt_resource *r)
12601260

12611261
/* Detect list of bandwidth sources that can be tracked */
12621262
cpuid_count(0x80000020, 3, &eax, &ebx, &ecx, &edx);
1263-
hw_res->mbm_cfg_mask = ecx & MAX_EVT_CONFIG_BITS;
1263+
r->mbm_cfg_mask = ecx & MAX_EVT_CONFIG_BITS;
12641264
}
12651265

12661266
r->mon_capable = true;

arch/x86/kernel/cpu/resctrl/rdtgroup.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1731,7 +1731,6 @@ static void mbm_config_write_domain(struct rdt_resource *r,
17311731

17321732
static int mon_config_write(struct rdt_resource *r, char *tok, u32 evtid)
17331733
{
1734-
struct rdt_hw_resource *hw_res = resctrl_to_arch_res(r);
17351734
char *dom_str = NULL, *id_str;
17361735
unsigned long dom_id, val;
17371736
struct rdt_mon_domain *d;
@@ -1758,9 +1757,9 @@ static int mon_config_write(struct rdt_resource *r, char *tok, u32 evtid)
17581757
}
17591758

17601759
/* Value from user cannot be more than the supported set of events */
1761-
if ((val & hw_res->mbm_cfg_mask) != val) {
1760+
if ((val & r->mbm_cfg_mask) != val) {
17621761
rdt_last_cmd_printf("Invalid event configuration: max valid mask is 0x%02x\n",
1763-
hw_res->mbm_cfg_mask);
1762+
r->mbm_cfg_mask);
17641763
return -EINVAL;
17651764
}
17661765

include/linux/resctrl.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,8 @@ enum resctrl_schema_fmt {
217217
* @name: Name to use in "schemata" file.
218218
* @schema_fmt: Which format string and parser is used for this schema.
219219
* @evt_list: List of monitoring events
220+
* @mbm_cfg_mask: Bandwidth sources that can be tracked when bandwidth
221+
* monitoring events can be configured.
220222
* @cdp_capable: Is the CDP feature available on this resource
221223
*/
222224
struct rdt_resource {
@@ -233,6 +235,7 @@ struct rdt_resource {
233235
char *name;
234236
enum resctrl_schema_fmt schema_fmt;
235237
struct list_head evt_list;
238+
unsigned int mbm_cfg_mask;
236239
bool cdp_capable;
237240
};
238241

0 commit comments

Comments
 (0)