From nobody Mon Feb 9 01:11:50 2026 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) (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 CF03126ED20; Wed, 22 Oct 2025 13:58:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.189 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761141485; cv=none; b=GpyYm78O1vNxiPTG/lXysOy5+ysp44NpGXowAH6avtqfOrxTl7pjTUwjXOep2zHDldUkhITsoDYP5FP2VgXvmED7fnZVD+fyGTWIY7GjznfVUj2/i77Pxcq5pw5AZjVH0WvUMkaDdFylbEjaiHU7pKnShtLB7chXQkQeIMDDAiY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761141485; c=relaxed/simple; bh=JT5aKwM0EBYZEgnaxnSZYP8/pGxWk8u1Z6pbRgS/E+0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=CbXNaLWjQa24ygD7ezBySPGnkDTar8jh3NsA8GvCyoLH4Yr2OF5UVVkSIGK4T2OcDcBSKBpuglRd3TxtwgU/bzL8flhGkVPhgO3cHi19LLqALMk1BIm/AoSdVz81gK8WOhZ/pNPEYgJpQhoCLaV+pgVYNQ8ajJohWq1euDfeQ1w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=h-partners.com; arc=none smtp.client-ip=45.249.212.189 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=h-partners.com Received: from mail.maildlp.com (unknown [172.19.163.48]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4cs9BD26RTzJsbZ; Wed, 22 Oct 2025 21:34:28 +0800 (CST) Received: from kwepemf100008.china.huawei.com (unknown [7.202.181.222]) by mail.maildlp.com (Postfix) with ESMTPS id CDDD018006C; Wed, 22 Oct 2025 21:39:19 +0800 (CST) Received: from huawei.com (10.50.87.109) by kwepemf100008.china.huawei.com (7.202.181.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Wed, 22 Oct 2025 21:39:18 +0800 From: Zeng Heng To: CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH mpam mpam/snapshot/v6.14-rc1] arm64/mpam: Fix MBWU monitor overflow handling Date: Wed, 22 Oct 2025 21:39:13 +0800 Message-ID: <20251022133913.629859-1-zengheng4@huawei.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20251017185645.26604-25-james.morse@arm.com> References: <20251017185645.26604-25-james.morse@arm.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 X-ClientProxiedBy: kwepems100001.china.huawei.com (7.221.188.238) To kwepemf100008.china.huawei.com (7.202.181.222) Content-Type: text/plain; charset="utf-8" Bandwidth counters need to run continuously to correctly reflect the bandwidth. When reading the previously configured MSMON_CFG_MBWU_CTL, software must recognize that the MSMON_CFG_x_CTL_OFLOW_STATUS bit may have been set by hardware because of the counter overflow. The existing logic incorrectly treats this bit as an indication that the monitor configuration has been changed and consequently zeros the MBWU statistics by mistake. Also fix the handling of overflow amount calculation. There's no need to subtract mbwu_state->prev_val when calculating overflow_val. Signed-off-by: Zeng Heng --- drivers/resctrl/mpam_devices.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/resctrl/mpam_devices.c b/drivers/resctrl/mpam_devices.c index 0dd048279e02..06f3ec9887d2 100644 --- a/drivers/resctrl/mpam_devices.c +++ b/drivers/resctrl/mpam_devices.c @@ -1101,7 +1101,8 @@ static void __ris_msmon_read(void *arg) clean_msmon_ctl_val(&cur_ctl); gen_msmon_ctl_flt_vals(m, &ctl_val, &flt_val); config_mismatch =3D cur_flt !=3D flt_val || - cur_ctl !=3D (ctl_val | MSMON_CFG_x_CTL_EN); + (cur_ctl & ~MSMON_CFG_x_CTL_OFLOW_STATUS) !=3D + (ctl_val | MSMON_CFG_x_CTL_EN); =20 if (config_mismatch || reset_on_next_read) write_msmon_ctl_flt_vals(m, ctl_val, flt_val); @@ -1138,8 +1139,9 @@ static void __ris_msmon_read(void *arg) mbwu_state =3D &ris->mbwu_state[ctx->mon]; =20 /* Add any pre-overflow value to the mbwu_state->val */ - if (mbwu_state->prev_val > now) - overflow_val =3D mpam_msmon_overflow_val(m->type) - mbwu_state->prev_va= l; + if (mbwu_state->prev_val > now && + (cur_ctl & MSMON_CFG_x_CTL_OFLOW_STATUS)) + overflow_val =3D mpam_msmon_overflow_val(ris); =20 mbwu_state->prev_val =3D now; mbwu_state->correction +=3D overflow_val; --=20 2.25.1