From nobody Thu Apr 9 15:07:05 2026 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.12]) (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 657583A16BD for ; Tue, 7 Apr 2026 16:02:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.12 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775577779; cv=none; b=FjejBHRCvvrl0bN8J8iLPFW8vIc3IaTVLMG6hdoUmd5CUPlCoF45uY1i4WQZyf/uXjg6ayA0E5hkGGvJVu9s/Ti54iKE7Hiw1/yXkikp6HlAx+HRfqpl2ANWhGeFnrG5TZEXYm4BhrsICNQ23IkzQHGNCI+9CftvKUX6K1WzbcU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775577779; c=relaxed/simple; bh=A21P6fI2hgZ/+eGK6RsbbZ/oeCdwqcvHzTT8GH5JBd0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uVgBHVT/hx4fHUQtstDCHcPGWUNZZY/LZyDMp0wO8EskliKHht9HOXCInY1YkYMtw9cYe5/8+VY1ySHGWjZgf9potTeXXFkNr4tBh2ob1lO5DTt7yZ+EpVt7b2wniIvNZt023tW6X/iGqyLeKE088pA4qTi3jLZCNJzTw7dr0QI= 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=BcN1Lnzw; arc=none smtp.client-ip=192.198.163.12 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="BcN1Lnzw" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1775577768; x=1807113768; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=A21P6fI2hgZ/+eGK6RsbbZ/oeCdwqcvHzTT8GH5JBd0=; b=BcN1LnzwNLbdE0F+yld65DZm59F/USndJ9qDI3QpbCoLhv5BhE8yYdwD 9pqUPvHc/PlK67X6ntkcmKaNC40dMSR+jJhGiLiztcPxtrEqdfPAoPWp+ DqSAZeQkSKq/mDoOQeIi8S7iyGYPOKNbYmZbRGGNYoMizDnJphAQ7QwI8 rBZpQSU3F+Ogu6SOX1NAGHLAXh6bf3jh/XgTKyOvpEa0ZCV48fBPpUPib Fs/tUwnrzx70kXxUs7DrZb9INO60UxdzsXKhrLuMhthhAgrDAWFpD4xKC +fAE0q9VqZcvhKCF9DmXWbU29hhifNDHLzMLuLgmVOdaVNmyhMsF6O224 w==; X-CSE-ConnectionGUID: DhXLlxanTP6spqrzcka1MA== X-CSE-MsgGUID: YxunRLnhRlqEZrwbZpjeVA== X-IronPort-AV: E=McAfee;i="6800,10657,11752"; a="80432698" X-IronPort-AV: E=Sophos;i="6.23,165,1770624000"; d="scan'208";a="80432698" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by fmvoesa106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Apr 2026 09:02:19 -0700 X-CSE-ConnectionGUID: NXCIx0clSHml5fMfsl7FJQ== X-CSE-MsgGUID: zKgZjHhOSMKramdnomWG9g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,165,1770624000"; d="scan'208";a="228119053" Received: from rchatre-desk1.jf.intel.com ([10.165.154.99]) by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Apr 2026 09:02:18 -0700 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 v3 08/13] fs/resctrl: Pass error reading event through to user space Date: Tue, 7 Apr 2026 09:02:05 -0700 Message-ID: <839082c54e02953f60706854cc0d250949b6d71d.1775576382.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 Reviewed-by: Ben Horgan --- Changes since v1: - Add Ben's RB tag. --- 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 8194fdfbea81..101b2911d582 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