Skip to content

Commit cfd0f34

Browse files
aeglKAGA-KOKO
authored andcommitted
x86/intel_rdt: Add diagnostics when making directories
Mostly this is about running out of RMIDs or CLOSIDs. Other errors are various internal errors. Signed-off-by: Tony Luck <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Cc: Fenghua Yu <[email protected]> Cc: Steven Rostedt <[email protected]> Cc: Vikas Shivappa <[email protected]> Cc: Boris Petkov <[email protected]> Cc: Reinette Chatre <[email protected]> Link: https://lkml.kernel.org/r/027cf1ffb3a3695f2d54525813a1d644887353cf.1506382469.git.tony.luck@intel.com
1 parent 94457b3 commit cfd0f34

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

arch/x86/kernel/cpu/intel_rdt_rdtgroup.c

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1593,15 +1593,18 @@ static int mkdir_rdt_prepare(struct kernfs_node *parent_kn,
15931593
int ret;
15941594

15951595
prdtgrp = rdtgroup_kn_lock_live(prgrp_kn);
1596+
rdt_last_cmd_clear();
15961597
if (!prdtgrp) {
15971598
ret = -ENODEV;
1599+
rdt_last_cmd_puts("directory was removed\n");
15981600
goto out_unlock;
15991601
}
16001602

16011603
/* allocate the rdtgroup. */
16021604
rdtgrp = kzalloc(sizeof(*rdtgrp), GFP_KERNEL);
16031605
if (!rdtgrp) {
16041606
ret = -ENOSPC;
1607+
rdt_last_cmd_puts("kernel out of memory\n");
16051608
goto out_unlock;
16061609
}
16071610
*r = rdtgrp;
@@ -1613,6 +1616,7 @@ static int mkdir_rdt_prepare(struct kernfs_node *parent_kn,
16131616
kn = kernfs_create_dir(parent_kn, name, mode, rdtgrp);
16141617
if (IS_ERR(kn)) {
16151618
ret = PTR_ERR(kn);
1619+
rdt_last_cmd_puts("kernfs create error\n");
16161620
goto out_free_rgrp;
16171621
}
16181622
rdtgrp->kn = kn;
@@ -1626,24 +1630,32 @@ static int mkdir_rdt_prepare(struct kernfs_node *parent_kn,
16261630
kernfs_get(kn);
16271631

16281632
ret = rdtgroup_kn_set_ugid(kn);
1629-
if (ret)
1633+
if (ret) {
1634+
rdt_last_cmd_puts("kernfs perm error\n");
16301635
goto out_destroy;
1636+
}
16311637

16321638
files = RFTYPE_BASE | RFTYPE_CTRL;
16331639
files = RFTYPE_BASE | BIT(RF_CTRLSHIFT + rtype);
16341640
ret = rdtgroup_add_files(kn, files);
1635-
if (ret)
1641+
if (ret) {
1642+
rdt_last_cmd_puts("kernfs fill error\n");
16361643
goto out_destroy;
1644+
}
16371645

16381646
if (rdt_mon_capable) {
16391647
ret = alloc_rmid();
1640-
if (ret < 0)
1648+
if (ret < 0) {
1649+
rdt_last_cmd_puts("out of RMIDs\n");
16411650
goto out_destroy;
1651+
}
16421652
rdtgrp->mon.rmid = ret;
16431653

16441654
ret = mkdir_mondata_all(kn, rdtgrp, &rdtgrp->mon.mon_data_kn);
1645-
if (ret)
1655+
if (ret) {
1656+
rdt_last_cmd_puts("kernfs subdir error\n");
16461657
goto out_idfree;
1658+
}
16471659
}
16481660
kernfs_activate(kn);
16491661

@@ -1721,8 +1733,10 @@ static int rdtgroup_mkdir_ctrl_mon(struct kernfs_node *parent_kn,
17211733

17221734
kn = rdtgrp->kn;
17231735
ret = closid_alloc();
1724-
if (ret < 0)
1736+
if (ret < 0) {
1737+
rdt_last_cmd_puts("out of CLOSIDs\n");
17251738
goto out_common_fail;
1739+
}
17261740
closid = ret;
17271741

17281742
rdtgrp->closid = closid;
@@ -1734,8 +1748,10 @@ static int rdtgroup_mkdir_ctrl_mon(struct kernfs_node *parent_kn,
17341748
* of tasks and cpus to monitor.
17351749
*/
17361750
ret = mongroup_create_dir(kn, NULL, "mon_groups", NULL);
1737-
if (ret)
1751+
if (ret) {
1752+
rdt_last_cmd_puts("kernfs subdir error\n");
17381753
goto out_id_free;
1754+
}
17391755
}
17401756

17411757
goto out_unlock;

0 commit comments

Comments
 (0)