Skip to content

Commit d415924

Browse files
babumogerbp3tk0v
authored andcommitted
x86/resctrl: Rename rftype flags for consistency
resctrl associates rftype flags with its files so that files can be chosen based on the resource, whether it is info or base, and if it is control or monitor type file. These flags use the RF_ as well as RFTYPE_ prefixes. Change the prefix to RFTYPE_ for all these flags to be consistent. Signed-off-by: Babu Moger <[email protected]> Signed-off-by: Borislav Petkov (AMD) <[email protected]> Reviewed-by: Peter Newman <[email protected]> Reviewed-by: Tan Shaopeng <[email protected]> Reviewed-by: Fenghua Yu <[email protected]> Reviewed-by: Reinette Chatre <[email protected]> Reviewed-by: Ilpo Järvinen <[email protected]> Tested-by: Peter Newman <[email protected]> Tested-by: Tan Shaopeng <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 6846dc1 commit d415924

File tree

2 files changed

+27
-27
lines changed

2 files changed

+27
-27
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -248,10 +248,10 @@ struct rdtgroup {
248248
#define RFTYPE_TOP BIT(6)
249249
#define RFTYPE_RES_CACHE BIT(8)
250250
#define RFTYPE_RES_MB BIT(9)
251-
#define RF_CTRL_INFO (RFTYPE_INFO | RFTYPE_CTRL)
252-
#define RF_MON_INFO (RFTYPE_INFO | RFTYPE_MON)
253-
#define RF_TOP_INFO (RFTYPE_INFO | RFTYPE_TOP)
254-
#define RF_CTRL_BASE (RFTYPE_BASE | RFTYPE_CTRL)
251+
#define RFTYPE_CTRL_INFO (RFTYPE_INFO | RFTYPE_CTRL)
252+
#define RFTYPE_MON_INFO (RFTYPE_INFO | RFTYPE_MON)
253+
#define RFTYPE_TOP_INFO (RFTYPE_INFO | RFTYPE_TOP)
254+
#define RFTYPE_CTRL_BASE (RFTYPE_BASE | RFTYPE_CTRL)
255255

256256
/* List of all resource groups */
257257
extern struct list_head rdt_all_groups;
@@ -267,7 +267,7 @@ void __exit rdtgroup_exit(void);
267267
* @mode: Access mode
268268
* @kf_ops: File operations
269269
* @flags: File specific RFTYPE_FLAGS_* flags
270-
* @fflags: File specific RF_* or RFTYPE_* flags
270+
* @fflags: File specific RFTYPE_* flags
271271
* @seq_show: Show content of the file
272272
* @write: Write to the file
273273
*/

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

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1716,77 +1716,77 @@ static struct rftype res_common_files[] = {
17161716
.mode = 0444,
17171717
.kf_ops = &rdtgroup_kf_single_ops,
17181718
.seq_show = rdt_last_cmd_status_show,
1719-
.fflags = RF_TOP_INFO,
1719+
.fflags = RFTYPE_TOP_INFO,
17201720
},
17211721
{
17221722
.name = "num_closids",
17231723
.mode = 0444,
17241724
.kf_ops = &rdtgroup_kf_single_ops,
17251725
.seq_show = rdt_num_closids_show,
1726-
.fflags = RF_CTRL_INFO,
1726+
.fflags = RFTYPE_CTRL_INFO,
17271727
},
17281728
{
17291729
.name = "mon_features",
17301730
.mode = 0444,
17311731
.kf_ops = &rdtgroup_kf_single_ops,
17321732
.seq_show = rdt_mon_features_show,
1733-
.fflags = RF_MON_INFO,
1733+
.fflags = RFTYPE_MON_INFO,
17341734
},
17351735
{
17361736
.name = "num_rmids",
17371737
.mode = 0444,
17381738
.kf_ops = &rdtgroup_kf_single_ops,
17391739
.seq_show = rdt_num_rmids_show,
1740-
.fflags = RF_MON_INFO,
1740+
.fflags = RFTYPE_MON_INFO,
17411741
},
17421742
{
17431743
.name = "cbm_mask",
17441744
.mode = 0444,
17451745
.kf_ops = &rdtgroup_kf_single_ops,
17461746
.seq_show = rdt_default_ctrl_show,
1747-
.fflags = RF_CTRL_INFO | RFTYPE_RES_CACHE,
1747+
.fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_CACHE,
17481748
},
17491749
{
17501750
.name = "min_cbm_bits",
17511751
.mode = 0444,
17521752
.kf_ops = &rdtgroup_kf_single_ops,
17531753
.seq_show = rdt_min_cbm_bits_show,
1754-
.fflags = RF_CTRL_INFO | RFTYPE_RES_CACHE,
1754+
.fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_CACHE,
17551755
},
17561756
{
17571757
.name = "shareable_bits",
17581758
.mode = 0444,
17591759
.kf_ops = &rdtgroup_kf_single_ops,
17601760
.seq_show = rdt_shareable_bits_show,
1761-
.fflags = RF_CTRL_INFO | RFTYPE_RES_CACHE,
1761+
.fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_CACHE,
17621762
},
17631763
{
17641764
.name = "bit_usage",
17651765
.mode = 0444,
17661766
.kf_ops = &rdtgroup_kf_single_ops,
17671767
.seq_show = rdt_bit_usage_show,
1768-
.fflags = RF_CTRL_INFO | RFTYPE_RES_CACHE,
1768+
.fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_CACHE,
17691769
},
17701770
{
17711771
.name = "min_bandwidth",
17721772
.mode = 0444,
17731773
.kf_ops = &rdtgroup_kf_single_ops,
17741774
.seq_show = rdt_min_bw_show,
1775-
.fflags = RF_CTRL_INFO | RFTYPE_RES_MB,
1775+
.fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_MB,
17761776
},
17771777
{
17781778
.name = "bandwidth_gran",
17791779
.mode = 0444,
17801780
.kf_ops = &rdtgroup_kf_single_ops,
17811781
.seq_show = rdt_bw_gran_show,
1782-
.fflags = RF_CTRL_INFO | RFTYPE_RES_MB,
1782+
.fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_MB,
17831783
},
17841784
{
17851785
.name = "delay_linear",
17861786
.mode = 0444,
17871787
.kf_ops = &rdtgroup_kf_single_ops,
17881788
.seq_show = rdt_delay_linear_show,
1789-
.fflags = RF_CTRL_INFO | RFTYPE_RES_MB,
1789+
.fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_MB,
17901790
},
17911791
/*
17921792
* Platform specific which (if any) capabilities are provided by
@@ -1805,7 +1805,7 @@ static struct rftype res_common_files[] = {
18051805
.kf_ops = &rdtgroup_kf_single_ops,
18061806
.write = max_threshold_occ_write,
18071807
.seq_show = max_threshold_occ_show,
1808-
.fflags = RF_MON_INFO | RFTYPE_RES_CACHE,
1808+
.fflags = RFTYPE_MON_INFO | RFTYPE_RES_CACHE,
18091809
},
18101810
{
18111811
.name = "mbm_total_bytes_config",
@@ -1852,29 +1852,29 @@ static struct rftype res_common_files[] = {
18521852
.kf_ops = &rdtgroup_kf_single_ops,
18531853
.write = rdtgroup_schemata_write,
18541854
.seq_show = rdtgroup_schemata_show,
1855-
.fflags = RF_CTRL_BASE,
1855+
.fflags = RFTYPE_CTRL_BASE,
18561856
},
18571857
{
18581858
.name = "mode",
18591859
.mode = 0644,
18601860
.kf_ops = &rdtgroup_kf_single_ops,
18611861
.write = rdtgroup_mode_write,
18621862
.seq_show = rdtgroup_mode_show,
1863-
.fflags = RF_CTRL_BASE,
1863+
.fflags = RFTYPE_CTRL_BASE,
18641864
},
18651865
{
18661866
.name = "size",
18671867
.mode = 0444,
18681868
.kf_ops = &rdtgroup_kf_single_ops,
18691869
.seq_show = rdtgroup_size_show,
1870-
.fflags = RF_CTRL_BASE,
1870+
.fflags = RFTYPE_CTRL_BASE,
18711871
},
18721872
{
18731873
.name = "sparse_masks",
18741874
.mode = 0444,
18751875
.kf_ops = &rdtgroup_kf_single_ops,
18761876
.seq_show = rdt_has_sparse_bitmasks_show,
1877-
.fflags = RF_CTRL_INFO | RFTYPE_RES_CACHE,
1877+
.fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_CACHE,
18781878
},
18791879

18801880
};
@@ -1931,7 +1931,7 @@ void __init thread_throttle_mode_init(void)
19311931
if (!rft)
19321932
return;
19331933

1934-
rft->fflags = RF_CTRL_INFO | RFTYPE_RES_MB;
1934+
rft->fflags = RFTYPE_CTRL_INFO | RFTYPE_RES_MB;
19351935
}
19361936

19371937
void __init mbm_config_rftype_init(const char *config)
@@ -1940,7 +1940,7 @@ void __init mbm_config_rftype_init(const char *config)
19401940

19411941
rft = rdtgroup_get_rftype_by_name(config);
19421942
if (rft)
1943-
rft->fflags = RF_MON_INFO | RFTYPE_RES_CACHE;
1943+
rft->fflags = RFTYPE_MON_INFO | RFTYPE_RES_CACHE;
19441944
}
19451945

19461946
/**
@@ -2075,21 +2075,21 @@ static int rdtgroup_create_info_dir(struct kernfs_node *parent_kn)
20752075
if (IS_ERR(kn_info))
20762076
return PTR_ERR(kn_info);
20772077

2078-
ret = rdtgroup_add_files(kn_info, RF_TOP_INFO);
2078+
ret = rdtgroup_add_files(kn_info, RFTYPE_TOP_INFO);
20792079
if (ret)
20802080
goto out_destroy;
20812081

20822082
/* loop over enabled controls, these are all alloc_capable */
20832083
list_for_each_entry(s, &resctrl_schema_all, list) {
20842084
r = s->res;
2085-
fflags = r->fflags | RF_CTRL_INFO;
2085+
fflags = r->fflags | RFTYPE_CTRL_INFO;
20862086
ret = rdtgroup_mkdir_info_resdir(s, s->name, fflags);
20872087
if (ret)
20882088
goto out_destroy;
20892089
}
20902090

20912091
for_each_mon_capable_rdt_resource(r) {
2092-
fflags = r->fflags | RF_MON_INFO;
2092+
fflags = r->fflags | RFTYPE_MON_INFO;
20932093
sprintf(name, "%s_MON", r->name);
20942094
ret = rdtgroup_mkdir_info_resdir(r, name, fflags);
20952095
if (ret)
@@ -3727,7 +3727,7 @@ static int __init rdtgroup_setup_root(void)
37273727

37283728
list_add(&rdtgroup_default.rdtgroup_list, &rdt_all_groups);
37293729

3730-
ret = rdtgroup_add_files(kernfs_root_to_node(rdt_root), RF_CTRL_BASE);
3730+
ret = rdtgroup_add_files(kernfs_root_to_node(rdt_root), RFTYPE_CTRL_BASE);
37313731
if (ret) {
37323732
kernfs_destroy_root(rdt_root);
37333733
goto out;

0 commit comments

Comments
 (0)