aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTony Luck <tony.luck@intel.com>2017-09-25 19:39:37 -0400
committerThomas Gleixner <tglx@linutronix.de>2017-09-27 06:10:11 -0400
commitcfd0f34e4cd5f1a5ad7000a3104c37886a70bca9 (patch)
tree67630e185558f89048df72944bec18f9e591453b
parent94457b36e8a5026443707b48dcf54b204e098fd7 (diff)
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 <tony.luck@intel.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: Fenghua Yu <fenghua.yu@intel.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Vikas Shivappa <vikas.shivappa@intel.com> Cc: Boris Petkov <bp@suse.de> Cc: Reinette Chatre <reinette.chatre@intel.com> Link: https://lkml.kernel.org/r/027cf1ffb3a3695f2d54525813a1d644887353cf.1506382469.git.tony.luck@intel.com
-rw-r--r--arch/x86/kernel/cpu/intel_rdt_rdtgroup.c28
1 files changed, 22 insertions, 6 deletions
diff --git a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
index 6e0ee7ca1490..abd220bf6cd7 100644
--- a/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
+++ b/arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
@@ -1593,8 +1593,10 @@ static int mkdir_rdt_prepare(struct kernfs_node *parent_kn,
1593 int ret; 1593 int ret;
1594 1594
1595 prdtgrp = rdtgroup_kn_lock_live(prgrp_kn); 1595 prdtgrp = rdtgroup_kn_lock_live(prgrp_kn);
1596 rdt_last_cmd_clear();
1596 if (!prdtgrp) { 1597 if (!prdtgrp) {
1597 ret = -ENODEV; 1598 ret = -ENODEV;
1599 rdt_last_cmd_puts("directory was removed\n");
1598 goto out_unlock; 1600 goto out_unlock;
1599 } 1601 }
1600 1602
@@ -1602,6 +1604,7 @@ static int mkdir_rdt_prepare(struct kernfs_node *parent_kn,
1602 rdtgrp = kzalloc(sizeof(*rdtgrp), GFP_KERNEL); 1604 rdtgrp = kzalloc(sizeof(*rdtgrp), GFP_KERNEL);
1603 if (!rdtgrp) { 1605 if (!rdtgrp) {
1604 ret = -ENOSPC; 1606 ret = -ENOSPC;
1607 rdt_last_cmd_puts("kernel out of memory\n");
1605 goto out_unlock; 1608 goto out_unlock;
1606 } 1609 }
1607 *r = rdtgrp; 1610 *r = rdtgrp;
@@ -1613,6 +1616,7 @@ static int mkdir_rdt_prepare(struct kernfs_node *parent_kn,
1613 kn = kernfs_create_dir(parent_kn, name, mode, rdtgrp); 1616 kn = kernfs_create_dir(parent_kn, name, mode, rdtgrp);
1614 if (IS_ERR(kn)) { 1617 if (IS_ERR(kn)) {
1615 ret = PTR_ERR(kn); 1618 ret = PTR_ERR(kn);
1619 rdt_last_cmd_puts("kernfs create error\n");
1616 goto out_free_rgrp; 1620 goto out_free_rgrp;
1617 } 1621 }
1618 rdtgrp->kn = kn; 1622 rdtgrp->kn = kn;
@@ -1626,24 +1630,32 @@ static int mkdir_rdt_prepare(struct kernfs_node *parent_kn,
1626 kernfs_get(kn); 1630 kernfs_get(kn);
1627 1631
1628 ret = rdtgroup_kn_set_ugid(kn); 1632 ret = rdtgroup_kn_set_ugid(kn);
1629 if (ret) 1633 if (ret) {
1634 rdt_last_cmd_puts("kernfs perm error\n");
1630 goto out_destroy; 1635 goto out_destroy;
1636 }
1631 1637
1632 files = RFTYPE_BASE | RFTYPE_CTRL; 1638 files = RFTYPE_BASE | RFTYPE_CTRL;
1633 files = RFTYPE_BASE | BIT(RF_CTRLSHIFT + rtype); 1639 files = RFTYPE_BASE | BIT(RF_CTRLSHIFT + rtype);
1634 ret = rdtgroup_add_files(kn, files); 1640 ret = rdtgroup_add_files(kn, files);
1635 if (ret) 1641 if (ret) {
1642 rdt_last_cmd_puts("kernfs fill error\n");
1636 goto out_destroy; 1643 goto out_destroy;
1644 }
1637 1645
1638 if (rdt_mon_capable) { 1646 if (rdt_mon_capable) {
1639 ret = alloc_rmid(); 1647 ret = alloc_rmid();
1640 if (ret < 0) 1648 if (ret < 0) {
1649 rdt_last_cmd_puts("out of RMIDs\n");
1641 goto out_destroy; 1650 goto out_destroy;
1651 }
1642 rdtgrp->mon.rmid = ret; 1652 rdtgrp->mon.rmid = ret;
1643 1653
1644 ret = mkdir_mondata_all(kn, rdtgrp, &rdtgrp->mon.mon_data_kn); 1654 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");
1646 goto out_idfree; 1657 goto out_idfree;
1658 }
1647 } 1659 }
1648 kernfs_activate(kn); 1660 kernfs_activate(kn);
1649 1661
@@ -1721,8 +1733,10 @@ static int rdtgroup_mkdir_ctrl_mon(struct kernfs_node *parent_kn,
1721 1733
1722 kn = rdtgrp->kn; 1734 kn = rdtgrp->kn;
1723 ret = closid_alloc(); 1735 ret = closid_alloc();
1724 if (ret < 0) 1736 if (ret < 0) {
1737 rdt_last_cmd_puts("out of CLOSIDs\n");
1725 goto out_common_fail; 1738 goto out_common_fail;
1739 }
1726 closid = ret; 1740 closid = ret;
1727 1741
1728 rdtgrp->closid = closid; 1742 rdtgrp->closid = closid;
@@ -1734,8 +1748,10 @@ static int rdtgroup_mkdir_ctrl_mon(struct kernfs_node *parent_kn,
1734 * of tasks and cpus to monitor. 1748 * of tasks and cpus to monitor.
1735 */ 1749 */
1736 ret = mongroup_create_dir(kn, NULL, "mon_groups", NULL); 1750 ret = mongroup_create_dir(kn, NULL, "mon_groups", NULL);
1737 if (ret) 1751 if (ret) {
1752 rdt_last_cmd_puts("kernfs subdir error\n");
1738 goto out_id_free; 1753 goto out_id_free;
1754 }
1739 } 1755 }
1740 1756
1741 goto out_unlock; 1757 goto out_unlock;