From mboxrd@z Thu Jan 1 00:00:00 1970 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 20D68357A37 for ; Wed, 29 Oct 2025 16:21:51 +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=1761754912; cv=none; b=abt0lwyAmS35f1lZMVEB0L4+803MRQAG17RZftDkNdjgbHKRWhjaWc8ujm5iG8ThFpyDjiXuK5Le/S4N93ooegzqtpxdtI2wEtudkfYfk0koz6XzzhpIQcrd8Cf3PbTsISBO8r44qo2YlYG41zXMA38jdNERKTIJ3BYU7SZ5mKQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761754912; c=relaxed/simple; bh=JgzCMbemHDEiivLyDauttzfjz0gFspBynkBemT2+69k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=eOAtZE3sj/BATC5AwQ2I0G80Uouxu1/XOAAUnrlHcL7yIfEzRW+EHkaFweqvLBb5A2SM/ZacU5le7TdOZd5ejrhhNLjbgHzhyb0/JEumWkRIBzbuvzXRHR+4FDcChjdA9kVtBc4Yd48wpgTlZZuZ7oizJD9Y+EM8K3SPikVcfVE= 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=Oif2OT83; 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="Oif2OT83" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1761754911; x=1793290911; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=JgzCMbemHDEiivLyDauttzfjz0gFspBynkBemT2+69k=; b=Oif2OT83UBxhiTl/Zuv9g9gW3C+TUDlWH0a6EcNtWAsPjrjRjNdMcTm1 os4awpYFZwGzfro+WJzZZmhx8URFch54TMgM+j+Uw4pkYO+CS0WesKkGg rl7s732LlnHYHYdcXvw6/DTl9DZAegnbfoXXjnkb0XvH85wqzDtOf0Y6z e4okJgj3YiL1az5Pm2N7SzudByoIFCWHMwk/uFm+npYYzQuSCFBEmK7nt oAfWA3Kmbeg3bEbrhDj/NZBfcIyioQCEe2Qw2loVISvFWT0vOwt1M/84b z9DP0UFI9xtgtZilc2ihvuJNBEyhKgqBOMngQjoeSnHYXixFjpTbUjPNN g==; X-CSE-ConnectionGUID: 3AMOs+btS26t2CymrEeQLA== X-CSE-MsgGUID: xcs6dgvbRAC9A9G7HTn1Hg== X-IronPort-AV: E=McAfee;i="6800,10657,11597"; a="74481351" X-IronPort-AV: E=Sophos;i="6.19,264,1754982000"; d="scan'208";a="74481351" Received: from orviesa006.jf.intel.com ([10.64.159.146]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Oct 2025 09:21:36 -0700 X-CSE-ConnectionGUID: S47MFZktTGOIg0cL+9Xcow== X-CSE-MsgGUID: KIL3ymaXSyKvrcEAw/gs7A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.19,264,1754982000"; d="scan'208";a="184901419" Received: from mgerlach-mobl1.amr.corp.intel.com (HELO agluck-desk3.home.arpa) ([10.124.223.146]) by orviesa006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Oct 2025 09:21:36 -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 v13 30/32] fs/resctrl: Provide interface to create architecture specific debugfs area Date: Wed, 29 Oct 2025 09:21:13 -0700 Message-ID: <20251029162118.40604-31-tony.luck@intel.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251029162118.40604-1-tony.luck@intel.com> References: <20251029162118.40604-1-tony.luck@intel.com> Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 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 a2bf335052d6..3d176f4d6b6e 100644 --- a/include/linux/resctrl.h +++ b/include/linux/resctrl.h @@ -678,6 +678,16 @@ void resctrl_arch_reset_cntr(struct rdt_resource *r, struct rdt_l3_mon_domain *d extern unsigned int resctrl_rmid_realloc_threshold; extern unsigned int resctrl_rmid_realloc_limit; +/** + * 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); diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c index 17f5b986f210..0257c9938455 100644 --- a/fs/resctrl/rdtgroup.c +++ b/fs/resctrl/rdtgroup.c @@ -24,6 +24,7 @@ #include #include #include +#include #include @@ -75,6 +76,8 @@ static void rdtgroup_destroy_root(void); struct dentry *debugfs_resctrl; +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 @@ -4531,6 +4534,31 @@ int resctrl_init(void) return ret; } +/* + * 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 = debugfs_create_dir("info", debugfs_resctrl); + + sprintf(name, "%s_MON", r->name); + + moninfodir = 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; @@ -4582,6 +4610,7 @@ void resctrl_exit(void) debugfs_remove_recursive(debugfs_resctrl); debugfs_resctrl = NULL; + debugfs_resctrl_info = NULL; unregister_filesystem(&rdt_fs_type); /* -- 2.51.0