[PATCH OLK-6.6 0/2] Fix unexpected behavior in resctrl mounting
When mounting resctrl, some options that should be present are not shown in the mount list. Additionally, there is a lack of validation for the effectiveness of mount parameters when mounting resctrl. This patch set fixes the aforementioned unexpected behavior during resctrl mounting. Quanmin Yan (2): fs/resctrl: Fix resctrl mount options display in mount list fs/resctrl: Prevent mounting with unsupported options fs/resctrl/rdtgroup.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) -- 2.43.0
hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IDA7PH -------------------------------- Currently, after mounting resctrl, the -o l2 option is not shown in the mount list, and under the -o cdp option, cdpl2 information is incorrectly displayed additionally. This fix resolves the incorrect display of mount options in the mount list. After the fix, the mount list will show the actual effective mount parameters, as illustrated by the following examples: 1. After mounting with -o cdpl2, the mount list will now show only cdp. 2. After mounting with -o l2,cdpl2, the mount list will show l2,cdpl2. Fixes: 13e249bf4944 ("x86/resctrl: Move the filesystem portions of resctrl to live in '/fs/'") Signed-off-by: Quanmin Yan <yanquanmin1@huawei.com> --- fs/resctrl/rdtgroup.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c index 96a9c3d001db..00e24d052650 100644 --- a/fs/resctrl/rdtgroup.c +++ b/fs/resctrl/rdtgroup.c @@ -3932,10 +3932,12 @@ static int rdtgroup_rename(struct kernfs_node *kn, static int rdtgroup_show_options(struct seq_file *seq, struct kernfs_root *kf) { + bool l2_visible = !resctrl_arch_get_resource(RDT_RESOURCE_L2)->invisible; + if (resctrl_arch_get_cdp_enabled(RDT_RESOURCE_L3)) seq_puts(seq, ",cdp"); - if (resctrl_arch_get_cdp_enabled(RDT_RESOURCE_L2)) + if (l2_visible && resctrl_arch_get_cdp_enabled(RDT_RESOURCE_L2)) seq_puts(seq, ",cdpl2"); if (is_mba_sc(resctrl_arch_get_resource(RDT_RESOURCE_MBA))) @@ -3944,6 +3946,9 @@ static int rdtgroup_show_options(struct seq_file *seq, struct kernfs_root *kf) if (resctrl_debug) seq_puts(seq, ",debug"); + if (IS_ENABLED(CONFIG_ARM64_MPAM) && l2_visible) + seq_puts(seq, ",l2"); + return 0; } -- 2.43.0
hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IDA7PH -------------------------------- Currently, resctrl lacks validation for the effectiveness of mount parameter during mounting. For example, when ACPI does not report L2 information, mounting with the -o l2 parameter can succeed, but L2 resources cannot actually be controlled, which may cause confusion for users. Add necessary validation for the legality of resctrl mount parameters to prevent successful mounting when the system configuration does not actually support the specified options. Fixes: 13e249bf4944 ("x86/resctrl: Move the filesystem portions of resctrl to live in '/fs/'") Signed-off-by: Quanmin Yan <yanquanmin1@huawei.com> --- fs/resctrl/rdtgroup.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c index 00e24d052650..cb139678fef0 100644 --- a/fs/resctrl/rdtgroup.c +++ b/fs/resctrl/rdtgroup.c @@ -2809,6 +2809,7 @@ static int rdt_parse_param(struct fs_context *fc, struct fs_parameter *param) { struct rdt_fs_context *ctx = rdt_fc2context(fc); struct fs_parse_result result; + struct rdt_resource *r; int opt; opt = fs_parse(fc, rdt_fs_parameters, param, &result); @@ -2817,9 +2818,15 @@ static int rdt_parse_param(struct fs_context *fc, struct fs_parameter *param) switch (opt) { case Opt_cdp: + r = resctrl_arch_get_resource(RDT_RESOURCE_L3); + if (!r->alloc_capable) + return -EINVAL; ctx->enable_cdpl3 = true; return 0; case Opt_cdpl2: + r = resctrl_arch_get_resource(RDT_RESOURCE_L2); + if (!r->alloc_capable) + return -EINVAL; ctx->enable_cdpl2 = true; return 0; case Opt_mba_mbps: @@ -2831,6 +2838,9 @@ static int rdt_parse_param(struct fs_context *fc, struct fs_parameter *param) ctx->enable_debug = true; return 0; case Opt_l2: + r = resctrl_arch_get_resource(RDT_RESOURCE_L2); + if (!r->alloc_capable) + return -EINVAL; ctx->enable_l2 = true; return 0; } -- 2.43.0
反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://gitee.com/openeuler/kernel/pulls/19530 邮件列表地址:https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/CTD... FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://gitee.com/openeuler/kernel/pulls/19530 Mailing list address: https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/CTD...
participants (2)
-
patchwork bot -
Quanmin Yan