Skip to content

Commit c8eafe1

Browse files
xiaochenshensuryasaimadhu
authored andcommitted
x86/resctrl: Fix potential lockdep warning
rdtgroup_cpus_write() and mkdir_rdt_prepare() call rdtgroup_kn_lock_live() -> kernfs_to_rdtgroup() to get 'rdtgrp', and then call the rdt_last_cmd_{clear,puts,...}() functions which will check if rdtgroup_mutex is held/requires its caller to hold rdtgroup_mutex. But if 'rdtgrp' returned from kernfs_to_rdtgroup() is NULL, rdtgroup_mutex is not held and calling rdt_last_cmd_{clear,puts,...}() will result in a self-incurred, potential lockdep warning. Remove the rdt_last_cmd_{clear,puts,...}() calls in these two paths. Just returning error should be sufficient to report to the user that the entry doesn't exist any more. [ bp: Massage. ] Fixes: 94457b3 ("x86/intel_rdt: Add diagnostics when writing the cpus file") Fixes: cfd0f34 ("x86/intel_rdt: Add diagnostics when making directories") Signed-off-by: Xiaochen Shen <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Reviewed-by: Tony Luck <[email protected]> Reviewed-by: Fenghua Yu <[email protected]> Reviewed-by: Reinette Chatre <[email protected]> Cc: "H. Peter Anvin" <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: [email protected] Cc: Thomas Gleixner <[email protected]> Cc: x86-ml <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent fc5db58 commit c8eafe1

File tree

1 file changed

+0
-4
lines changed

1 file changed

+0
-4
lines changed

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

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -461,10 +461,8 @@ static ssize_t rdtgroup_cpus_write(struct kernfs_open_file *of,
461461
}
462462

463463
rdtgrp = rdtgroup_kn_lock_live(of->kn);
464-
rdt_last_cmd_clear();
465464
if (!rdtgrp) {
466465
ret = -ENOENT;
467-
rdt_last_cmd_puts("Directory was removed\n");
468466
goto unlock;
469467
}
470468

@@ -2648,10 +2646,8 @@ static int mkdir_rdt_prepare(struct kernfs_node *parent_kn,
26482646
int ret;
26492647

26502648
prdtgrp = rdtgroup_kn_lock_live(prgrp_kn);
2651-
rdt_last_cmd_clear();
26522649
if (!prdtgrp) {
26532650
ret = -ENODEV;
2654-
rdt_last_cmd_puts("Directory was removed\n");
26552651
goto out_unlock;
26562652
}
26572653

0 commit comments

Comments
 (0)