From nobody Fri Oct 3 14:44:57 2025 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A28FE345752 for ; Fri, 29 Aug 2025 19:34:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.14 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756496055; cv=none; b=NgJD3PsV32L2bP0y5CsU+N6rV33f6tOlaYGPuLALOhSxVgof7h5rOewgF469XMlY00pBaiAW7Rx0Wm2n3RqwUEYvLnK7ZNaWVOuIUA0Bhkjx/UJGqSk1yJzUpUe2deSqDx/S61WcX4jC+OXcnhY741urcB3cck5I+vGQpOyVopc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1756496055; c=relaxed/simple; bh=Lncq/jLYO+WU5E8LHu+kqPvJFoGVWOJEXvzfJAno3+U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BanvKIRuaAAzjZdRkR+DYzqWwHeWnNOAKYeEim1jWhhH/Qppw89I0ZWl+xNCVH8E3Anru5lfnmo1O9G2qo9hov9mXyULakN/Net6V3aZabLxssttCiP68QpCHLr2fkpuohudRaYNcRE9RMDd8vZDVG+LPLdHzccrs/8xUfEk/co= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=oH5apJ07; arc=none smtp.client-ip=198.175.65.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="oH5apJ07" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1756496052; x=1788032052; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Lncq/jLYO+WU5E8LHu+kqPvJFoGVWOJEXvzfJAno3+U=; b=oH5apJ07ZCFwhfNGG8PR43UWhySUbDc7psronQoubKJDDF98iIR8RQHa ECifxACvHA6++HXiqm0oD/1E/tUf5+j3Y4uzyVGgcP6vRM3h7S+sf09hN Emmk8TQv+8jKHc44xbZ7SBYdOOJ6cXhmMVvGtDlKzMOR1EJhrda/3iwzz 4rpSI1EfernFIFjbUPxw7kYke4g5+DqNGRu1l0a3VNu0KKfN68pTnb8BI FLhZ1OQsQtr8to/zSNvxIkevM6IH+an1+8KJWZ1dcGQ+Wsi6OJ0M9xh0K lg0apaU/hqkKQbb8lbfO0qcH1iCxFXnED1LpvGwJZg1Fawzj43BvP/GAD A==; X-CSE-ConnectionGUID: cLvoAUYcSBiNIoS90zPanQ== X-CSE-MsgGUID: cz1fDXQDSSW4QeTxhAjYRw== X-IronPort-AV: E=McAfee;i="6800,10657,11531"; a="62625376" X-IronPort-AV: E=Sophos;i="6.17,312,1747724400"; d="scan'208";a="62625376" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Aug 2025 12:33:57 -0700 X-CSE-ConnectionGUID: nUBALeHzRXeNLRceRV0c+w== X-CSE-MsgGUID: d7bFGg2cQt+Zsp6B1i90Iw== X-ExtLoop1: 1 Received: from ldmartin-desk2.corp.intel.com (HELO agluck-desk3.intel.com) ([10.124.220.202]) by fmviesa003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Aug 2025 12:33:57 -0700 From: Tony Luck To: Fenghua Yu , Reinette Chatre , Maciej Wieczor-Retman , Peter Newman , James Morse , Babu Moger , Drew Fustini , Dave Martin , Chen Yu Cc: x86@kernel.org, linux-kernel@vger.kernel.org, patches@lists.linux.dev, Tony Luck Subject: [PATCH v9 29/31] fs/resctrl: Provide interface to create architecture specific debugfs area Date: Fri, 29 Aug 2025 12:33:41 -0700 Message-ID: <20250829193346.31565-30-tony.luck@intel.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250829193346.31565-1-tony.luck@intel.com> References: <20250829193346.31565-1-tony.luck@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" All files below /sys/fs/resctrl are considered user ABI. This leaves no place for architectures to provide additional interfaces. Add resctrl_debugfs_mon_info_arch_mkdir() which creates a directory in the debugfs file system for a monitoring resource. Naming follows the layout of the main resctrl hierarchy: /sys/kernel/debug/resctrl/info/{resource}_MON/{arch} The {arch} last level directory name matches the output of the user level "uname -m" command. Architecture code may use this directory for debug information, or for minor tuning of features. It must not be used for basic feature enabling as debugfs may not be configured/mounted on production systems. Suggested-by: Reinette Chatre Signed-off-by: Tony Luck --- include/linux/resctrl.h | 9 +++++++++ fs/resctrl/rdtgroup.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h index 1f42bc761377..8a010c29c8b4 100644 --- a/include/linux/resctrl.h +++ b/include/linux/resctrl.h @@ -569,6 +569,15 @@ void resctrl_arch_reset_all_ctrls(struct rdt_resource = *r); extern unsigned int resctrl_rmid_realloc_threshold; extern unsigned int resctrl_rmid_realloc_limit; =20 +/** + * resctrl_debugfs_mon_info_arch_mkdir() - Create a debugfs info directory. + * Removed by resctrl_exit(). + * @r: Resource (must be mon_capable). + * + * Return: dentry pointer on success, or NULL on error. + */ +struct dentry *resctrl_debugfs_mon_info_arch_mkdir(struct rdt_resource *r); + int resctrl_init(void); void resctrl_exit(void); =20 diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c index 886de0e01e8a..8f0bcb139a74 100644 --- a/fs/resctrl/rdtgroup.c +++ b/fs/resctrl/rdtgroup.c @@ -24,6 +24,7 @@ #include #include #include +#include =20 #include =20 @@ -75,6 +76,8 @@ static void rdtgroup_destroy_root(void); =20 struct dentry *debugfs_resctrl; =20 +static struct dentry *debugfs_resctrl_info; + /* * Memory bandwidth monitoring event to use for the default CTRL_MON group * and each new CTRL_MON group created by the user. Only relevant when @@ -4355,6 +4358,31 @@ int resctrl_init(void) return ret; } =20 +/* + * Create /sys/kernel/debug/resctrl/info/{r->name}_MON/{arch} directory + * by request for architecture to use for debugging or minor tuning. + * Basic functionality of features must not be controlled by files + * added to this directory as debugfs may not be configured/mounted + * on production systems. + */ +struct dentry *resctrl_debugfs_mon_info_arch_mkdir(struct rdt_resource *r) +{ + struct dentry *moninfodir; + char name[32]; + + if (!r->mon_capable) + return NULL; + + if (!debugfs_resctrl_info) + debugfs_resctrl_info =3D debugfs_create_dir("info", debugfs_resctrl); + + sprintf(name, "%s_MON", r->name); + + moninfodir =3D debugfs_create_dir(name, debugfs_resctrl_info); + + return debugfs_create_dir(utsname()->machine, moninfodir); +} + static bool resctrl_online_domains_exist(void) { struct rdt_resource *r; @@ -4406,6 +4434,7 @@ void resctrl_exit(void) =20 debugfs_remove_recursive(debugfs_resctrl); debugfs_resctrl =3D NULL; + debugfs_resctrl_info =3D NULL; unregister_filesystem(&rdt_fs_type); =20 /* --=20 2.50.1