From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) (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 A4E012E610D for ; Mon, 11 Aug 2025 18:17:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.13 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754936274; cv=none; b=apeSFKVWzfNDQLYHpSuLC2Yi4JbQSg7mjaLko095oyT7CLtVmcIj4h9ubI+LvxV0c2tZfZErekjmSTK92YPMe+ZB9RIxtASVLJHbLO7LL4xFTLzRW0V8H1PWBYkt3B4yIMvheyb60MeVgs0cDxeh3qswF3l1KyMRV/ECLJdsFPk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1754936274; c=relaxed/simple; bh=EddyqxZoO2oB2oKRo3cjCHXi9KMfEvhPkZ+9MhTxLTw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GIpPi20zAidOcHsJW2zUur1dgGBa3LcC9IGTYHWT1mWIlL4Z8FDx0D1EYqzPLn2JRNccuZP6xmfXaPF6ulxyRWgCWp5yglrla/gNfnD+PgBE9L+iTFxILubF4vHpPKmPXtlMWWr1cr+RzaxEcg++byYxxXxCqsvT4vKSfLtxky0= 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=SQlle93m; arc=none smtp.client-ip=198.175.65.13 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="SQlle93m" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1754936272; x=1786472272; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=EddyqxZoO2oB2oKRo3cjCHXi9KMfEvhPkZ+9MhTxLTw=; b=SQlle93m/5dKW0/Ql0PvQHLg+W0UnCu2cnHtPpVuqaDNVlIS9jyKAv+P DafXef1aHg94Gnh1itEW9RPQ8yPF7Izp+TqXRE0OEbnWQBb+qFO1O0wXG qJnP0NZYmpI+OiVaACVl6TL7ER/7CtiGSZH99j+s+XVeb6RCADpauzyCF q9DuiRJV/8RD72ZfqgDfgR9zMw+0YGPuZthaYbGYTDIBsy6AoSAOTs/HJ 2xQvDDmOrC+WqyioKDgsqBXAplFF4u09f1Fi1RSsJDERawF1RTjiNsPib qzXK3evVLbnpSGXaUKh1Hqc1i+cBSz4sgm3HNlmvpHq4Fseqk1ZPziD/A Q==; X-CSE-ConnectionGUID: 8Vnm163KRfSOULKzl4jl0g== X-CSE-MsgGUID: F97oPD5uQ4yEzcGxQ2HYjw== X-IronPort-AV: E=McAfee;i="6800,10657,11518"; a="68277570" X-IronPort-AV: E=Sophos;i="6.17,278,1747724400"; d="scan'208";a="68277570" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Aug 2025 11:17:28 -0700 X-CSE-ConnectionGUID: j6FQF43vTnWqpZnBthawCg== X-CSE-MsgGUID: 6F+KuQiOTXW7zskkXqh8iA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.17,278,1747724400"; d="scan'208";a="196825714" Received: from puneetse-mobl.amr.corp.intel.com (HELO agluck-desk3.home.arpa) ([10.124.221.229]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Aug 2025 11:17:27 -0700 From: Tony Luck To: Fenghua Yu , Reinette Chatre , Maciej Wieczor-Retman , Peter Newman , James Morse , Babu Moger , Drew Fustini , Dave Martin , Anil Keshavamurthy , Chen Yu Cc: x86@kernel.org, linux-kernel@vger.kernel.org, patches@lists.linux.dev, Tony Luck Subject: [PATCH v8 30/32] fs/resctrl: Provide interface to create architecture specific debugfs area Date: Mon, 11 Aug 2025 11:17:04 -0700 Message-ID: <20250811181709.6241-31-tony.luck@intel.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: <20250811181709.6241-1-tony.luck@intel.com> References: <20250811181709.6241-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 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 c1cfba3c8422..b6af933ca3f9 100644 --- a/include/linux/resctrl.h +++ b/include/linux/resctrl.h @@ -571,6 +571,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; +/** + * 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); diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c index d1ecc5cd3089..fccac3da90cb 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 @@ -4355,6 +4358,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; @@ -4406,6 +4434,7 @@ void resctrl_exit(void) debugfs_remove_recursive(debugfs_resctrl); debugfs_resctrl = NULL; + debugfs_resctrl_info = NULL; unregister_filesystem(&rdt_fs_type); /* -- 2.50.1