From nobody Sat Apr 4 06:09:48 2026 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) (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 13E6B3246E8 for ; Fri, 20 Mar 2026 22:04:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.9 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774044243; cv=none; b=o7rSAaXmn5FC/1v55Bjr7svtpAS8c3A5JnGvzk2A+VyGErzxrLpDoaT4C0Vk/UER6VEAc9nPK2yNg+lk0SUn+KDf+e3HUYhKRazb94A2mBenvTpXN8+qU7a0JzAKjpq7xEBfGZvMMHNaKaXJYfF/SqAnpqPdBbpbw2YA1Ejr+MI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774044243; c=relaxed/simple; bh=A21P6fI2hgZ/+eGK6RsbbZ/oeCdwqcvHzTT8GH5JBd0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gfdrlbjOfoZFqGFbfC+LneGqI4oPKWFAtRqqwIDCnXlz9XnUeehQWvvAkHsH+oEJHE/xwkb0Ue5fijrlRaRjXeg0vaz8CW9N4qcY/nzDwb9JqpsATTPvwbmvKky6pjLokH0cb9LrMUhmWRiHmOQ6XgI8392oSc3OSye0SfWkbyk= 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=XEI1Py5G; arc=none smtp.client-ip=198.175.65.9 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="XEI1Py5G" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1774044240; x=1805580240; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=A21P6fI2hgZ/+eGK6RsbbZ/oeCdwqcvHzTT8GH5JBd0=; b=XEI1Py5G5yZ0dhpUEiSXJD70MGwIBFvbnlF5/XJEhfCX3mpJoTJDqyrS o+RjbX7rFWfhWeO9JEK65iiq0+/ni/7QfQ8JCtVZBsA8wBgXkmBhrU1cw XelTVIyoS3nn+ZmA9QWh12bCtEkMT6QSwKdu53C5jhCSgqqBOkIENaIHE UmRGK/QNbr4SnXQSRk4ABcQQEZdvZwa3wROoES1kztl+2kOSduIc+CDgy EssKXnkX6hJqHpFX/WGJPIO2HbfujjMmqp2sBSGe7XKD9pppZWz7G0p+X 4DuHBU/ST7n/0/6uFiIzJjpbi1jaaUztCHL4eDk+PaF5Xwn3bXlQWq/7s Q==; X-CSE-ConnectionGUID: 4rad7jH8RHWooIMj3kLgng== X-CSE-MsgGUID: itlD1X9XTgiwh6neLW6i7g== X-IronPort-AV: E=McAfee;i="6800,10657,11735"; a="97758408" X-IronPort-AV: E=Sophos;i="6.23,132,1770624000"; d="scan'208";a="97758408" Received: from fmviesa003.fm.intel.com ([10.60.135.143]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Mar 2026 15:03:55 -0700 X-CSE-ConnectionGUID: e4cAP81TTAiJddZq0V4Bjg== X-CSE-MsgGUID: TzSsMQ1jRQulBuQ+wuk3tg== X-ExtLoop1: 1 Received: from rchatre-desk1.jf.intel.com ([10.165.154.99]) by fmviesa003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Mar 2026 15:03:55 -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 v2 08/14] fs/resctrl: Pass error reading event through to user space Date: Fri, 20 Mar 2026 15:03:18 -0700 Message-ID: <38f8735190251f75e2e8b33861cc86135aefb748.1774043709.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