Skip to content

Commit 522b71c

Browse files
committed
NVIDIA: VR: SAUCE: resctrl: add MBA max_lim sysfs and visibility from init
Add rdt_mb_max_lim_show() and the max_lim entry in res_common_files[]. Add mb_max_lim_init() to call resctrl_file_fflags_init("max_lim", ...) when arch_has_mb_max_lim, and invoke it from resctrl_init() after io_alloc_init(). Signed-off-by: Fenghua Yu <fenghuay@nvidia.com>
1 parent bc9488c commit 522b71c

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

fs/resctrl/rdtgroup.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1276,6 +1276,17 @@ static int rdt_delay_linear_show(struct kernfs_open_file *of,
12761276
return 0;
12771277
}
12781278

1279+
static int rdt_mb_max_lim_show(struct kernfs_open_file *of,
1280+
struct seq_file *seq, void *v)
1281+
{
1282+
struct resctrl_schema *s = rdt_kn_parent_priv(of->kn);
1283+
struct rdt_resource *r = s->res;
1284+
1285+
seq_printf(seq, "%d\n", r->membw.mb_max_lim);
1286+
1287+
return 0;
1288+
}
1289+
12791290
static int max_threshold_occ_show(struct kernfs_open_file *of,
12801291
struct seq_file *seq, void *v)
12811292
{
@@ -2090,6 +2101,12 @@ static struct rftype res_common_files[] = {
20902101
.seq_show = rdt_delay_linear_show,
20912102
.fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_MB,
20922103
},
2104+
{
2105+
.name = "max_lim",
2106+
.mode = 0444,
2107+
.kf_ops = &rdtgroup_kf_single_ops,
2108+
.seq_show = rdt_mb_max_lim_show,
2109+
},
20932110
/*
20942111
* Platform specific which (if any) capabilities are provided by
20952112
* thread_throttle_mode. Defer "fflags" initialization to platform
@@ -2307,6 +2324,17 @@ static void thread_throttle_mode_init(void)
23072324
RFTYPE_CTRL_INFO | RFTYPE_RES_MB);
23082325
}
23092326

2327+
/* The resctrl file "max_lim" is added using MB resource if visible. */
2328+
static void mb_max_lim_init(void)
2329+
{
2330+
struct rdt_resource *r = resctrl_arch_get_resource(RDT_RESOURCE_MBA);
2331+
2332+
if (!r->membw.arch_has_mb_max_lim)
2333+
return;
2334+
2335+
resctrl_file_fflags_init("max_lim", RFTYPE_CTRL_INFO | RFTYPE_RES_MB);
2336+
}
2337+
23102338
void resctrl_file_fflags_init(const char *config, unsigned long fflags)
23112339
{
23122340
struct rftype *rft;
@@ -4770,6 +4798,8 @@ int resctrl_init(void)
47704798

47714799
thread_throttle_mode_init();
47724800

4801+
mb_max_lim_init();
4802+
47734803
ret = resctrl_mon_init();
47744804
if (ret)
47754805
return ret;

0 commit comments

Comments
 (0)