From nobody Tue Dec 2 00:46:13 2025 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) (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 BC35D327C16 for ; Mon, 24 Nov 2025 18:55:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764010515; cv=none; b=sZ9Ub3zNPgYKZLzPqlrF3u4SR6ICObkKQJZgcsbA7udBpoC17VWFbSAc9BSXJv6+yqurniqoFNGUIyfcDeUP5sCIUV0ufZZ4hjds2DN+uaiKcxrYsoCxC4cV2KtgwXpSrkGmSGu6ADkSDMcagjiXxFvjZCNz5CB62rI0/DdaXKc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764010515; c=relaxed/simple; bh=a6GqSiYes3g1hfurapo7TsD5x6nKUzU6tpAj8OUBXbc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gvldO2jCH3blQcKXihRzn6OuT+M9NvH5JF9VZVhpoGpOzRZFiQ1E6nNo5Vty8FI4kSrBYKfMcaBW3Su8yNkL9Y3Bnbul9CeFMmlMxFSIm8BQmDRKsaS/H5C8FPnYbojOGGMsCGaKzdETCqPfXv8YyknC5BQMYMmFDbCK70iUE+4= 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=j+pGaSnu; arc=none smtp.client-ip=192.198.163.11 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="j+pGaSnu" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1764010514; x=1795546514; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=a6GqSiYes3g1hfurapo7TsD5x6nKUzU6tpAj8OUBXbc=; b=j+pGaSnu3ZTup7/U1TRIfunzCt7I1ELluxCujzOKmJ6gIsL/Ho2SMRHc 0ip1FT7Eww7AOnQQ0iDgojzhcxIRQt97hwIb655ucRN19Vqu8rCVipxe/ 68JZh6YyI7G7oOb7BJmb89g0kFRwA7NLNemSm6IIINwXFA2VPKXpgpiZ3 Liy6h1pVLXX/4ORPcx73JEuhCVLcVmsZi4NbntVAkfKnKbsd9+GCCjtNf wEiaFFGOkQ4CoNvtD6F2sCiLJ2HfAcc4Du1JML8AmtAA+i7pRwNtnZdvG fMUPUZhqGXyGPysAVgP1Y7dv9GsDCjs/8vSQo2kKVWTizl5A0hP/y31eY A==; X-CSE-ConnectionGUID: PE8766vtQ4GXFBI0AZ7Ybg== X-CSE-MsgGUID: 6Ipcn10JQUaFS0CJSFqTeQ== X-IronPort-AV: E=McAfee;i="6800,10657,11623"; a="76636953" X-IronPort-AV: E=Sophos;i="6.20,223,1758610800"; d="scan'208";a="76636953" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2025 10:54:32 -0800 X-CSE-ConnectionGUID: 1Pj1nOF0S5idjYP30dN5bg== X-CSE-MsgGUID: u5re61K5SfaGAvuFIPadlQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.20,223,1758610800"; d="scan'208";a="192225045" Received: from rfrazer-mobl3.amr.corp.intel.com (HELO agluck-desk3.home.arpa) ([10.124.222.153]) by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Nov 2025 10:54:32 -0800 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 v14 30/32] fs/resctrl: Provide interface to create architecture specific debugfs area Date: Mon, 24 Nov 2025 10:54:07 -0800 Message-ID: <20251124185412.24155-31-tony.luck@intel.com> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20251124185412.24155-1-tony.luck@intel.com> References: <20251124185412.24155-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 debug= fs may not be configured/mounted on production systems. Suggested-by: Reinette Chatre Signed-off-by: Tony Luck Reviewed-by: Reinette Chatre --- include/linux/resctrl.h | 10 ++++++++++ fs/resctrl/rdtgroup.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h index 8623e450619a..b862a9dd785b 100644 --- a/include/linux/resctrl.h +++ b/include/linux/resctrl.h @@ -702,6 +702,16 @@ bool resctrl_arch_get_io_alloc_enabled(struct rdt_reso= urce *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: NULL if resource is not monitoring capable, + * dentry pointer on success, or ERR_PTR(-ERROR) on failure. + */ +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 d49ffc56ea61..d13291d71adf 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 @@ -4599,6 +4602,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; @@ -4650,6 +4678,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.51.1