From nobody Sat Sep 27 21:24:07 2025 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) (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 DB5FC327A12 for ; Thu, 25 Sep 2025 20:04:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.21 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758830668; cv=none; b=XT5odY7L6zSJoCeJ8w0T2hx2l6HREMnl4E+/e88U9UvNOfQifOnioN8ZrG5la1hJe8WoW/6iOF92oS4uEcEvoP7NgQLKiiFRY8lGKT4vEhM1BV2CwqDMzEAkFTFxuhFGM3/3SfcZIhiXs/VZ5bLF3VqNnQFChEg0rtQSYrv+Rv0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758830668; c=relaxed/simple; bh=JdXqo8CyC6iZZ1CPme9AeWkUa3NJj4dp5td2iQYLYZk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VZz2MQcRwYSAJ4yCYgUgGLeFUBc383+4Ss1rL4NTi/gPF5fvR+FDY7FWcZ/AB6OTf2kBZ56fVQge94hsgaq13YAWhbq/NPq1MPAEYCCfckCgnXhCiHy4iDkCsDOJwK+DOQIqddoVE+glJGsK6xf9m7d1d8ib4LGKLM7VfnRI8xo= 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=Mb/+a+Fa; arc=none smtp.client-ip=198.175.65.21 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="Mb/+a+Fa" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1758830666; x=1790366666; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=JdXqo8CyC6iZZ1CPme9AeWkUa3NJj4dp5td2iQYLYZk=; b=Mb/+a+FaxpL03KTbH2y4eiOKfBLfANRiXFbCVWIFVfbPYD+GsolTkmim 1FxsRNmX+q4wm8kqFX/QLLEyzLaxeVO4yqUPuNP3j2irUFxr4utrzpUNe 1D/l4GozAkwdvqrWExOs3hA/NJzn9fucqFLQog45Ft3eGl/HurTuNlKyf LDYffDj2ZdHp+kRjm4Y21kyuUBJh7SHaIBaD5JzsF9/GJAx6Y3IlZ+wRw 6dMesII2SMb88M0Sp9EYnYRXktfRSkNVFi6BwehGKrRgznD/6x3fg2Blh DugXAZuZ6kkcwc3WUobI8l8YFXYyjuIIB8iiZMh1JxhQy7VHpsxUMjqPi A==; X-CSE-ConnectionGUID: l238+69ITVqL4ua3oEdBdQ== X-CSE-MsgGUID: ZONzSbi8QNKSq9/F+o5taw== X-IronPort-AV: E=McAfee;i="6800,10657,11531"; a="61074380" X-IronPort-AV: E=Sophos;i="6.17,312,1747724400"; d="scan'208";a="61074380" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Sep 2025 13:04:15 -0700 X-CSE-ConnectionGUID: MX1cIAToSWyzBq95uiBNWA== X-CSE-MsgGUID: lnT2P06XQy6H8eHs9XTzhQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.18,293,1751266800"; d="scan'208";a="177003702" Received: from inaky-mobl1.amr.corp.intel.com (HELO agluck-desk3.intel.com) ([10.124.220.206]) by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Sep 2025 13:04:15 -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 v11 28/31] fs/resctrl: Provide interface to create architecture specific debugfs area Date: Thu, 25 Sep 2025 13:03:22 -0700 Message-ID: <20250925200328.64155-29-tony.luck@intel.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20250925200328.64155-1-tony.luck@intel.com> References: <20250925200328.64155-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 | 10 ++++++++++ fs/resctrl/rdtgroup.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h index c7b5e56d25bb..d4be0f54c7e8 100644 --- a/include/linux/resctrl.h +++ b/include/linux/resctrl.h @@ -678,6 +678,16 @@ void resctrl_arch_reset_cntr(struct rdt_resource *r, s= truct rdt_l3_mon_domain *d 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 f82bdb8f6f1d..16b088c5f2be 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 @@ -4513,6 +4516,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; @@ -4564,6 +4592,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.0