From nobody Sat Sep 27 20:26:41 2025 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.17]) (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 3CBEB368081 for ; Fri, 12 Sep 2025 22:11:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.17 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757715086; cv=none; b=chFOTtXF9edsvKWsIsdcqxjFp08JEPt3H/nySBeklOhT11SqXrw4qOyaCDxKqyoFaCTt7ecqCi31C2PHnVegEoiIHC0BTTgWR5ShMA/SUVS2fAhznLw/fkHRS8+MXZDbnbzD5/kF0tpQZvGhd+t651zrN5Y6wvQ2y8UNT3kBVy4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757715086; c=relaxed/simple; bh=KUB65dBQVze38qJ3dYR+jdqsRXWXGNnAMDUO6kvsa2k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EmSUIJj7Seo5HVouN1orddain8LygZ5Tfr0YRqnI1E3RpfIQOv/kwPW1rFqEB64WSQYTve0FEy06a3Qo1GD4Y6JiD2pFsD6YwWrOQZsgBkzSqv5tXtkHtKBgSIHXl8kEiKPJ8RI+ZhAyEd7mk4UAUhfZYL9qTivGqqk/i4mI64E= 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=av1ue3gt; arc=none smtp.client-ip=192.198.163.17 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="av1ue3gt" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1757715084; x=1789251084; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=KUB65dBQVze38qJ3dYR+jdqsRXWXGNnAMDUO6kvsa2k=; b=av1ue3gtzxEKEsxjDn9I2v/ZlIbgPPnSf/AUT08M7XXpJ6buy+jUvUWf IRP81Wq/nimmwFAT9mfR75vCLadMZaT7QSqYlLBo8O4uuek/Cpj0oYFGE Mm/85eXznCQ0PNGRDipavz0r7sEd9761RjNxD8BTo1loxp7pk52HFFCPa Klj8yGtqAJl7qU5JgpA/yUIhcjX7NQ7/fT1TkkrGTqTONEpds8otjBOO2 Hl+J9hweBtd+z1um6DAPCOY+dUGqx2tf/BA2DjGS85uznsAxdteKRrKGg PcIrvwuxw6/bhH1/BsunY9v28tZzM6UnvvC5Er7Z0G6dBuWMHbjmluL5k Q==; X-CSE-ConnectionGUID: wwxKLfihQqSKqKcnvtBGMg== X-CSE-MsgGUID: z2SJGBMXSLuSIM7oFDGWOw== X-IronPort-AV: E=McAfee;i="6800,10657,11551"; a="60002855" X-IronPort-AV: E=Sophos;i="6.18,260,1751266800"; d="scan'208";a="60002855" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by fmvoesa111.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Sep 2025 15:11:15 -0700 X-CSE-ConnectionGUID: U7Z0PuzVQG+S/h1srtg0qw== X-CSE-MsgGUID: FgrY/EXFSt6Og5D9fal8Lw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.18,260,1751266800"; d="scan'208";a="179265239" Received: from smoehrl-linux.amr.corp.intel.com (HELO agluck-desk3.intel.com) ([10.124.221.49]) by orviesa005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Sep 2025 15:11:14 -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 v10 27/28] x86/resctrl: Add debugfs files to show telemetry aggregator status Date: Fri, 12 Sep 2025 15:10:48 -0700 Message-ID: <20250912221053.11349-28-tony.luck@intel.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20250912221053.11349-1-tony.luck@intel.com> References: <20250912221053.11349-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" Each telemetry aggregator provides three status registers at the top end of MMIO space after all the per-RMID per-event counters: data_loss_count: This counts the number of times that this aggregator failed to accumulate a counter value supplied by a CPU core. data_loss_timestamp: This is a "timestamp" from a free running 25MHz uncore timer indicating when the most recent data loss occurred. last_update_timestamp: Another 25MHz timestamp indicating when the most recent counter update was successfully applied. Create files in /sys/kernel/debug/resctrl/info/PERF_PKG_MON/x86_64/ to display the value of each of these status registers for each aggregator in each enabled event group. The prefix for each file name describes the type of aggregator, which package it is located on, and an opaque instance number to provide a unique file name when there are multiple aggregators on a package. The suffix is one of the three strings listed above. An example name is: energy_pkg0_agg2_data_loss_count These files are removed along with all other debugfs entries by the call to debugfs_remove_recursive() in resctrl_exit(). Signed-off-by: Tony Luck --- arch/x86/kernel/cpu/resctrl/intel_aet.c | 51 +++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/arch/x86/kernel/cpu/resctrl/intel_aet.c b/arch/x86/kernel/cpu/= resctrl/intel_aet.c index f6afe862b9de..f84935c57b67 100644 --- a/arch/x86/kernel/cpu/resctrl/intel_aet.c +++ b/arch/x86/kernel/cpu/resctrl/intel_aet.c @@ -18,8 +18,11 @@ #include #include #include +#include +#include #include #include +#include #include #include #include @@ -33,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -184,9 +188,50 @@ static bool all_regions_have_sufficient_rmid(struct ev= ent_group *e, struct pmt_f return true; } =20 +static int status_read(void *priv, u64 *val) +{ + void __iomem *info =3D (void __iomem *)priv; + + *val =3D readq(info); + + return 0; +} + +DEFINE_SIMPLE_ATTRIBUTE(status_fops, status_read, NULL, "%llu\n"); + +static void make_status_files(struct dentry *dir, struct event_group *e, i= nt pkg, + int instance, void *info_end) +{ + char name[64]; + + sprintf(name, "%s_pkg%d_agg%d_data_loss_count", e->name, pkg, instance); + debugfs_create_file(name, 0400, dir, info_end - 24, &status_fops); + + sprintf(name, "%s_pkg%d_agg%d_data_loss_timestamp", e->name, pkg, instanc= e); + debugfs_create_file(name, 0400, dir, info_end - 16, &status_fops); + + sprintf(name, "%s_pkg%d_agg%d_last_update_timestamp", e->name, pkg, insta= nce); + debugfs_create_file(name, 0400, dir, info_end - 8, &status_fops); +} + +static void create_debug_event_status_files(struct dentry *dir, struct eve= nt_group *e, + struct pmt_feature_group *p) +{ + void *info_end; + + for (int i =3D 0; i < p->count; i++) { + if (!p->regions[i].addr) + continue; + info_end =3D (void __force *)p->regions[i].addr + e->mmio_size; + make_status_files(dir, e, p->regions[i].plat_info.package_id, + i, info_end); + } +} + static bool enable_events(struct event_group *e, struct pmt_feature_group = *p) { struct rdt_resource *r =3D &rdt_resources_all[RDT_RESOURCE_PERF_PKG].r_re= sctrl; + static struct dentry *infodir; bool usable_events =3D false; =20 /* Disable feature if insufficient RMIDs */ @@ -226,6 +271,12 @@ static bool enable_events(struct event_group *e, struc= t pmt_feature_group *p) resctrl_enable_mon_event(e->evts[j].id, true, e->evts[j].bin_bits, &e->evts[j]); =20 + if (!infodir) + infodir =3D resctrl_debugfs_mon_info_arch_mkdir(r); + + if (!IS_ERR_OR_NULL(infodir)) + create_debug_event_status_files(infodir, e, p); + pr_info("%s %s monitoring detected\n", r->name, e->name); =20 return true; --=20 2.51.0