From nobody Mon Dec 15 22:06:11 2025 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.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 30EE730504D for ; Wed, 10 Dec 2025 23:14:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765408495; cv=none; b=Jr8OrBWkEOhr2oEfnqgmiv35Q5LrgZMbrpKMDfdhX+aex2gs5vpGKEuwqTS31vNSt8GlO6N4mRP4FeB9mTJcIV8RM+6FWDqB3Ko734/ymL/LpJ/MqUn0lc0wdasOTlstWkWLB6cE5CwS16fnGjboynMpVbN7lKLPI10Yz8bbZnA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765408495; c=relaxed/simple; bh=Evr1NV6rXbpyXcI6IoQ/0FbzCNTJnINz0x6HvQO2+84=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=PxyGwCoMUey8qLRRyp7wleb9euxZN5WW75UbF2ZV6TgoXCMWVjZkyL99FZSdvtaf3l80HN1H2eQQzFjk9RSYcRjx7DjPQtwWaK6PAyTc9GokX5XM2A5UtbHVXelQRBCeKfDayw9CIdPnyoo+neu3QlgFLQLptZq+Y+mS9jfuPiM= 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=Da5UoTkR; arc=none smtp.client-ip=192.198.163.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="Da5UoTkR" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1765408491; x=1796944491; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Evr1NV6rXbpyXcI6IoQ/0FbzCNTJnINz0x6HvQO2+84=; b=Da5UoTkRYoQ6c2+GetmkdXO165Lhq6kMrps9sOnOMivxwob5i9gwBZ3Q fwSYKAn7xHRQqKZNvY0aaVoQSGCK+IPxsdsta77YnKghptaqXaJbiNWRu aQzjRqqJvLuSgsQ7+Imjy8oMjyxvPZIE/3q+q5V7QqWzymw0pmJ4Hdb/Q UK4CPVRKKgRlUGmg4v6Zm/j4Z0dNSgO1cIXZIVN+14hDfW5DVnzJQTanN zzOVZBx/rhIzWEXKVAhg8EUsHDyWlfyzDWbuz3jCj0b47XikK599DBntu tMoPPVj8lZPXQ4Tsh57Joc1JIqdJCZ8puOFtKXxFfiRu6glTIxtvFQavm g==; X-CSE-ConnectionGUID: Q3hfxt+iTZ2REc3aBSjl6g== X-CSE-MsgGUID: VptCQ4gNS1mO/64tUXEM0A== X-IronPort-AV: E=McAfee;i="6800,10657,11638"; a="69973585" X-IronPort-AV: E=Sophos;i="6.20,265,1758610800"; d="scan'208";a="69973585" Received: from orviesa002.jf.intel.com ([10.64.159.142]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Dec 2025 15:14:33 -0800 X-CSE-ConnectionGUID: KRJ5gVxITKmFL+CSr7cYeA== X-CSE-MsgGUID: 4eAe8muNTOatr3sYlXU24Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.20,265,1758610800"; d="scan'208";a="227297080" Received: from daliomra-mobl3.amr.corp.intel.com (HELO agluck-desk3.intel.com) ([10.124.221.254]) by orviesa002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Dec 2025 15:14:33 -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 v16 14/32] x86,fs/resctrl: Add and initialize a resource for package scope monitoring Date: Wed, 10 Dec 2025 15:13:53 -0800 Message-ID: <20251210231413.59102-15-tony.luck@intel.com> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20251210231413.59102-1-tony.luck@intel.com> References: <20251210231413.59102-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" Add a new PERF_PKG resource and introduce package level scope for monitoring telemetry events so that CPU hot plug notifiers can build domains at the package granularity. Use the physical package ID available via topology_physical_package_id() to identify the monitoring domains with package level scope. This enables user space to use: /sys/devices/system/cpu/cpuX/topology/physical_package_id to identify the monitoring domain a CPU is associated with. Signed-off-by: Tony Luck Reviewed-by: Reinette Chatre --- include/linux/resctrl.h | 2 ++ fs/resctrl/internal.h | 2 ++ arch/x86/kernel/cpu/resctrl/core.c | 10 ++++++++++ fs/resctrl/rdtgroup.c | 2 ++ 4 files changed, 16 insertions(+) diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h index dc148b7feb71..2a3613f27274 100644 --- a/include/linux/resctrl.h +++ b/include/linux/resctrl.h @@ -53,6 +53,7 @@ enum resctrl_res_level { RDT_RESOURCE_L2, RDT_RESOURCE_MBA, RDT_RESOURCE_SMBA, + RDT_RESOURCE_PERF_PKG, =20 /* Must be the last */ RDT_NUM_RESOURCES, @@ -270,6 +271,7 @@ enum resctrl_scope { RESCTRL_L2_CACHE =3D 2, RESCTRL_L3_CACHE =3D 3, RESCTRL_L3_NODE, + RESCTRL_PACKAGE, }; =20 /** diff --git a/fs/resctrl/internal.h b/fs/resctrl/internal.h index 14e5a9ed1fbd..0110d1175398 100644 --- a/fs/resctrl/internal.h +++ b/fs/resctrl/internal.h @@ -255,6 +255,8 @@ struct rdtgroup { =20 #define RFTYPE_ASSIGN_CONFIG BIT(11) =20 +#define RFTYPE_RES_PERF_PKG BIT(12) + #define RFTYPE_CTRL_INFO (RFTYPE_INFO | RFTYPE_CTRL) =20 #define RFTYPE_MON_INFO (RFTYPE_INFO | RFTYPE_MON) diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resct= rl/core.c index 2dd48b59ba9b..986b1303efb9 100644 --- a/arch/x86/kernel/cpu/resctrl/core.c +++ b/arch/x86/kernel/cpu/resctrl/core.c @@ -100,6 +100,14 @@ struct rdt_hw_resource rdt_resources_all[RDT_NUM_RESOU= RCES] =3D { .schema_fmt =3D RESCTRL_SCHEMA_RANGE, }, }, + [RDT_RESOURCE_PERF_PKG] =3D + { + .r_resctrl =3D { + .name =3D "PERF_PKG", + .mon_scope =3D RESCTRL_PACKAGE, + .mon_domains =3D mon_domain_init(RDT_RESOURCE_PERF_PKG), + }, + }, }; =20 u32 resctrl_arch_system_num_rmid_idx(void) @@ -440,6 +448,8 @@ static int get_domain_id_from_scope(int cpu, enum resct= rl_scope scope) return get_cpu_cacheinfo_id(cpu, scope); case RESCTRL_L3_NODE: return cpu_to_node(cpu); + case RESCTRL_PACKAGE: + return topology_physical_package_id(cpu); default: break; } diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c index b20d104ea0c9..4952ba6b8609 100644 --- a/fs/resctrl/rdtgroup.c +++ b/fs/resctrl/rdtgroup.c @@ -2395,6 +2395,8 @@ static unsigned long fflags_from_resource(struct rdt_= resource *r) case RDT_RESOURCE_MBA: case RDT_RESOURCE_SMBA: return RFTYPE_RES_MB; + case RDT_RESOURCE_PERF_PKG: + return RFTYPE_RES_PERF_PKG; } =20 return WARN_ON_ONCE(1); --=20 2.51.1