From nobody Tue Mar 3 05:11:12 2026 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) (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 A881E366DB7 for ; Mon, 2 Mar 2026 18:46:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772477194; cv=none; b=EZwUIrVF5t27jsr9ibKbYYJERmjKzHWC9i3W7uhbrFAspIe5Pg/Jt56pCN6F6woNkffc/64E6p3EnI4uPzlq2WEHMyYwpT9KirrZNjUnjz5YgwtH6dQKF2P+fz86OvzUuh+XXrQk5BepGYPAFM06UYioVr5+NXRqL2y5jf/pRX4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772477194; c=relaxed/simple; bh=dWQkMySV2jYd0tvpllHLWFB4pHJJvS5dZ9FwHlCFYDI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=T1Mie6YGVWubU6JdVzNAb74gFo5L1CcSPAF4EvItpRJ7caVALyK+R0N3HcK2gvB+3XFzxPRn3PzlFeqbK1KLcXKTCLOWvap5k8fvoGzu/fC/dzT/jAIFLL4+N+ad1bgyH/q7fR0klpxPOo0hgS6xC/NxHSIIGmS7bsK8ck/sBI4= 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=MeDWd75d; arc=none smtp.client-ip=192.198.163.11 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="MeDWd75d" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1772477191; x=1804013191; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=dWQkMySV2jYd0tvpllHLWFB4pHJJvS5dZ9FwHlCFYDI=; b=MeDWd75dkKvd9eWGoC/D2ZGnX40x6LRzCclFvDTWY3T148afpM6nU2SJ qN/QXKap3WeupXFAd/48kTCFF2OtoDBTnSwe1uD6efBxhvJ+ltNKR6R8X Nb5AOBeilDLv0CcQzgANI5+z30+MTU6wJgPsnbnNvWy4zc1T3GzKHv2NZ 0f8mbPOYWxzkCmiQM8XwglCLSkqXXHv0FbH4b8gai9E+v4WcU3Ufumj8O D8OFhshrydq7BEs7c2gGpLtEhxHpmAM31dN1fyEH3dSqRl1MIbNIA+YAF Jb37wZyf7nFkiVrT1J8Toi9wjS2gvVv1LKGt/1e1yDqHLHGPuT2cV/I2T Q==; X-CSE-ConnectionGUID: 1771VldMQIeZPBv/CRU3Lg== X-CSE-MsgGUID: DkclRhGBTme/cQO43pR0Tw== X-IronPort-AV: E=McAfee;i="6800,10657,11717"; a="84135476" X-IronPort-AV: E=Sophos;i="6.21,320,1763452800"; d="scan'208";a="84135476" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Mar 2026 10:46:26 -0800 X-CSE-ConnectionGUID: 64mwtmaoQHWPDdNYmebMbw== X-CSE-MsgGUID: r4CXWXiVRtuVf3SPHYe7Sw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.21,320,1763452800"; d="scan'208";a="255604092" Received: from rchatre-desk1.jf.intel.com ([10.165.154.99]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Mar 2026 10:46:26 -0800 From: Reinette Chatre To: tony.luck@intel.com, james.morse@arm.com, Dave.Martin@arm.com, babu.moger@amd.com, bp@alien8.de, tglx@linutronix.de, dave.hansen@linux.intel.com Cc: x86@kernel.org, hpa@zytor.com, ben.horgan@arm.com, fustini@kernel.org, fenghuay@nvidia.com, peternewman@google.com, linux-kernel@vger.kernel.org, patches@lists.linux.dev, reinette.chatre@intel.com Subject: [PATCH 06/11] fs/resctrl: Pass error reading event through to user space Date: Mon, 2 Mar 2026 10:46:12 -0800 Message-ID: <6ceb56817d137bee96a5e4508657bf9080cb4acf.1772476561.git.reinette.chatre@intel.com> X-Mailer: git-send-email 2.50.1 In-Reply-To: References: 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" Reading of event data is managed through populating a struct rmid_read with properties of event needing to be read. This data is dispatched to an appropriate CPU and upon completion any error can be found in rmid_read::er= r, or on success the event data will be in rmid_read::val. rmid_read::err is not updated in the unlikely scenario that the reading of the event was dispatched to a wrong CPU. If this ever occurs due to a bug in resctrl the user space read will return "success" but the data reported will be invalid. Ensure accurate error reporting so that if there may be an issue with how resctrl picks a CPU it could be learned with an error to user space instead of silent failure. Signed-off-by: Reinette Chatre --- fs/resctrl/monitor.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fs/resctrl/monitor.c b/fs/resctrl/monitor.c index 421c70f96426..f1a08fdbdd61 100644 --- a/fs/resctrl/monitor.c +++ b/fs/resctrl/monitor.c @@ -453,8 +453,10 @@ static int __l3_mon_event_count(struct rdtgroup *rdtgr= p, struct rmid_read *rr) } =20 /* Reading a single domain, must be on a CPU in that domain. */ - if (!cpumask_test_cpu(cpu, &d->hdr.cpu_mask)) + if (!cpumask_test_cpu(cpu, &d->hdr.cpu_mask)) { + rr->err =3D -EIO; return -EINVAL; + } if (rr->is_mbm_cntr) rr->err =3D resctrl_arch_cntr_read(rr->r, d, closid, rmid, cntr_id, rr->evt->evtid, &tval); @@ -491,8 +493,10 @@ static int __l3_mon_event_count_sum(struct rdtgroup *r= dtgrp, struct rmid_read *r } =20 /* Summing domains that share a cache, must be on a CPU for that cache. */ - if (!cpumask_test_cpu(cpu, &rr->ci->shared_cpu_map)) + if (!cpumask_test_cpu(cpu, &rr->ci->shared_cpu_map)) { + rr->err =3D -EIO; return -EINVAL; + } =20 /* * Legacy files must report the sum of an event across all --=20 2.50.1