From nobody Wed Oct 8 16:43:48 2025 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.19]) (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 495D42F0E48 for ; Thu, 26 Jun 2025 16:50:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750956610; cv=none; b=HtIxds6rwe+jZgavK3C66LP8rPINtV9o+/0w/3XgDzEkrW27quY7S22nh7CPNmI7HsgiIVyraw8T+N+csBLTns3hrRtgZHiQR/728ob2/tFXvvTTaomD5SbE6uBSAuCQcv8xReyg5pXnRQe2hQOQHNaJnuL+Wav7VhU+iuNKoQc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1750956610; c=relaxed/simple; bh=ayovP20mi/znsK/boH38Se+1pDhyqJNehHC/uWhLjhk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=V5jX3lm/7vy7njCrixFZ+kuwbGeuCXiKAQ4aV08bQb1uHzId081Hpk1bJbsIkjLZRwZTI0KGXHrS9SlzrhzK3YMv7GGJWFO7/5jJB2AE13kekcsQptKi0fK9BLb1zU5tsCi9JH32CqOIAUNHsz+FTgWNPQ8Ip2MnsEi0PAfstGg= 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=e+2RBnNq; arc=none smtp.client-ip=198.175.65.19 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="e+2RBnNq" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1750956609; x=1782492609; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ayovP20mi/znsK/boH38Se+1pDhyqJNehHC/uWhLjhk=; b=e+2RBnNqKtFdJ0oczIxbWJOED5LUac0TPQzV3kqR7Q5ULPLwlvRU9F6r KZv7v+3E/zV/FaPVfWTMWO/1mjh1MNzXaAoNMH4fjDwfPEsFUq1odcFZl LjML0EX5jtGbf8kXm4IPSxpbO2pRelT5SQJuITLUHtKUagWPEI6qEvbE1 NpJV42uk1+gm2c54uJaVM+IMZWi3cvqkwHdNK6YrqwymtrgBUAZukoMv2 zfMv0K0wc3xpL0aP3Apjy0ztrnCSiAVLVK/U8TJvUhzvFOmHja8o2D0gs TH3ns07ZamsjqhQsmSGJY2TBB9O09LtuG/uKP/tbUX4qGLX0g5LHUcBA+ w==; X-CSE-ConnectionGUID: tRNIufMAT2ipLr5XMdZqHw== X-CSE-MsgGUID: kQcg9lDqR8GR871X/ocDIw== X-IronPort-AV: E=McAfee;i="6800,10657,11476"; a="53136502" X-IronPort-AV: E=Sophos;i="6.16,268,1744095600"; d="scan'208";a="53136502" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by orvoesa111.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jun 2025 09:50:02 -0700 X-CSE-ConnectionGUID: cYCKgVy6RruREJKtSvIZsQ== X-CSE-MsgGUID: RueXSY+iQme+eFvROiv0pA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.16,268,1744095600"; d="scan'208";a="153069290" Received: from agluck-desk3.sc.intel.com ([172.25.103.51]) by orviesa008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jun 2025 09:50:01 -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 v6 23/30] x86/resctrl: Handle domain creation/deletion for RDT_RESOURCE_PERF_PKG Date: Thu, 26 Jun 2025 09:49:32 -0700 Message-ID: <20250626164941.106341-24-tony.luck@intel.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250626164941.106341-1-tony.luck@intel.com> References: <20250626164941.106341-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" The L3 resource has several requirements for domains. There are structures that hold the 64-bit values of counters, and elements to keep track of the overflow and limbo threads. None of these are needed for the PERF_PKG resource. The hardware counters are wide enough that they do not wrap around for decades. Define a new rdt_perf_pkg_mon_domain structure which just consists of the standard rdt_domain_hdr to keep track of domain id and CPU mask. Change domain_add_cpu_mon(), domain_remove_cpu_mon(), resctrl_offline_mon_domain(), and resctrl_online_mon_domain() to check resource type and perform only the operations needed for domains in the PERF_PKG resource. Signed-off-by: Tony Luck --- arch/x86/kernel/cpu/resctrl/core.c | 41 ++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resct= rl/core.c index f3144fe918dd..f857f92e7b8b 100644 --- a/arch/x86/kernel/cpu/resctrl/core.c +++ b/arch/x86/kernel/cpu/resctrl/core.c @@ -547,6 +547,38 @@ static void l3_mon_domain_setup(int cpu, int id, struc= t rdt_resource *r, struct } } =20 +/** + * struct rdt_perf_pkg_mon_domain - CPUs sharing an Intel-PMT-scoped resct= rl monitor resource + * @hdr: common header for different domain types + */ +struct rdt_perf_pkg_mon_domain { + struct rdt_domain_hdr hdr; +}; + +static void setup_intel_aet_mon_domain(int cpu, int id, struct rdt_resourc= e *r, + struct list_head *add_pos) +{ + struct rdt_perf_pkg_mon_domain *d; + int err; + + d =3D kzalloc_node(sizeof(*d), GFP_KERNEL, cpu_to_node(cpu)); + if (!d) + return; + + d->hdr.id =3D id; + d->hdr.type =3D RESCTRL_MON_DOMAIN; + d->hdr.rid =3D r->rid; + cpumask_set_cpu(cpu, &d->hdr.cpu_mask); + list_add_tail_rcu(&d->hdr.list, add_pos); + + err =3D resctrl_online_mon_domain(r, &d->hdr); + if (err) { + list_del_rcu(&d->hdr.list); + synchronize_rcu(); + kfree(d); + } +} + static void domain_add_cpu_mon(int cpu, struct rdt_resource *r) { int id =3D get_domain_id_from_scope(cpu, r->mon_scope); @@ -574,6 +606,9 @@ static void domain_add_cpu_mon(int cpu, struct rdt_reso= urce *r) case RDT_RESOURCE_L3: l3_mon_domain_setup(cpu, id, r, add_pos); break; + case RDT_RESOURCE_PERF_PKG: + setup_intel_aet_mon_domain(cpu, id, r, add_pos); + break; default: WARN_ON_ONCE(1); } @@ -670,6 +705,12 @@ static void domain_remove_cpu_mon(int cpu, struct rdt_= resource *r) synchronize_rcu(); l3_mon_domain_free(hw_dom); break; + case RDT_RESOURCE_PERF_PKG: + resctrl_offline_mon_domain(r, hdr); + list_del_rcu(&hdr->list); + synchronize_rcu(); + kfree(container_of(hdr, struct rdt_perf_pkg_mon_domain, hdr)); + break; default: pr_warn_once("Unknown resource rid=3D%d\n", r->rid); break; --=20 2.49.0