From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) (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 75AE334D3BD for ; Wed, 17 Dec 2025 17:22:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.9 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765992153; cv=none; b=ttqNvu/12L2BD91/Q7+j4BjlljLjOOJbpuZVLPPH9uSXdKw7naIqJCfly8n15bjV0c0AvM1pDFmx6YjHPe0ChU80FhTbAWBrJV1njvEo5I9Q4fCscbG0zNzhNmXDtXmvHJnk3JxR/pc4m/QIRAqwZxRgKke9IkKY00Tf/Eb1dCo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765992153; c=relaxed/simple; bh=2kkrtHJ+jzO5VqzUI6Z+k4diP6bcNc+WvpKR6flS/H4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ubwV4LM0MMMz8lNpD4MNC1nzwiMGidwkL5Vkvp2Le6w9Xm+rODPH2E1MubXrkwUa1DIcjn7Bck5aIj+o5GCXMsL8LGPDy8vqC6vXrmjvt2NdePt/ToDnfRdqvx6azD1JE1LH+yK3KDofw0fDJ7olpmgzSIjis+zizDYoJiyjJvA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=fail smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=UA8t0Pan; arc=none smtp.client-ip=198.175.65.9 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=fail 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="UA8t0Pan" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1765992149; x=1797528149; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=2kkrtHJ+jzO5VqzUI6Z+k4diP6bcNc+WvpKR6flS/H4=; b=UA8t0PanGtvKlgiI6nYmtvWL5rv5fjPmf9ixvi03DwgDUI0PSucUS38t URb1sLeTNKO+SaJxWW8jdfjEdw0KUj7+PQZNCnz0iaTXGTKAdTcUbDFyB fly+mFm+/woWKCBKlgSB2snV9MLGGq5Mcug04J2GInpDAPdgY/AU0JPZG 6s7Ix/YCjFMQwy6SPYVrCOEVTO9CNc57r9y0+T/zzJrheNKuK13ZA4m6R 4lndxMJ9W6uYRSeDOCUItWUVMfM2c1DenXPNiTUNdJZmseMPt28g4aiU2 jTh4tuZlvm1PRa7ciNpR4v5fFhj8HpcBL0EVYJnGgdigD1hzCW6zRm83s A==; X-CSE-ConnectionGUID: rk0YiWifQiK03aHswb0kDg== X-CSE-MsgGUID: JsIzF469TduY2CB27pwXSQ== X-IronPort-AV: E=McAfee;i="6800,10657,11645"; a="90594854" X-IronPort-AV: E=Sophos;i="6.21,156,1763452800"; d="scan'208";a="90594854" Received: from fmviesa002.fm.intel.com ([10.60.135.142]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Dec 2025 09:21:38 -0800 X-CSE-ConnectionGUID: lCZUOYXKQn6iK451rfeqog== X-CSE-MsgGUID: V2M0qqOjSca1hj8UbRn0CQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,156,1763452800"; d="scan'208";a="221748278" Received: from pgcooper-mobl3.ger.corp.intel.com (HELO agluck-desk3.home.arpa) ([10.124.223.131]) by fmviesa002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Dec 2025 09:21:37 -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 v17 30/32] fs/resctrl: Provide interface to create architecture specific debugfs area Date: Wed, 17 Dec 2025 09:21:17 -0800 Message-ID: <20251217172121.12030-31-tony.luck@intel.com> X-Mailer: git-send-email 2.52.0 In-Reply-To: <20251217172121.12030-1-tony.luck@intel.com> References: <20251217172121.12030-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 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_resource *r); 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 d49ffc56ea61..d13291d71adf 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 @@ -4599,6 +4602,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; @@ -4650,6 +4678,7 @@ void resctrl_exit(void) debugfs_remove_recursive(debugfs_resctrl); debugfs_resctrl = NULL; + debugfs_resctrl_info = NULL; unregister_filesystem(&rdt_fs_type); /* -- 2.52.0