From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 8342326B0B6; Tue, 8 Apr 2025 12:47:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744116465; cv=none; b=goHe06pe49L4UnyTReEFH1cZON6DJZqyoG/c2Kzs1F2MdzsLQ530D2iFdu7focwINFJJI4QXsvzWLpgQKli0OHjJW2vo9ZzKYfa7D+NCZhnvH3SFfpSuQVUDsIFeMXgwFOZ/B0vWI6zynVnACvQNuHynLCMaKpIAdSXniIcI7KA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744116465; c=relaxed/simple; bh=cd8JW0ew1/nWwhZzby8YYQftE5kiH/mmQtseAzxUyik=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=N5Vo3cu0xMxgOPMk9+xORewHVSQ/8QtBwTnSkQJuMSjM2Sh6+X/JqHqjqlTKATeAL6EljiQgVdDNAXvbnJogRVNW6lIs9L95qr5lpl+pjmRTPfxBP70AIV/hRNL1tLABY8bPerssQjwfjnI/xFvdv3aA/bL5LZZEek8Tre+D2aY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=ATkFRXho; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="ATkFRXho" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D3633C4CEE5; Tue, 8 Apr 2025 12:47:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1744116465; bh=cd8JW0ew1/nWwhZzby8YYQftE5kiH/mmQtseAzxUyik=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ATkFRXhoC1328GIbem2NRtzaURGsGjoI7zJBlmaAAdD2M+hgtP564o/rDGwcEJDZd cnDG6wt7iurCgDXKkvJ4qp6hM2w0pBWyZXrMYoDhShAXAjfjjoS1z3gqYxpPySBHX/ 3IRX2obIjNQPgM6m5BKXVm8tfD2It7BJ7bmKNQJo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Chiara Meiohas , Michael Guralnik , Leon Romanovsky , Sasha Levin Subject: [PATCH 6.12 133/423] RDMA/mlx5: Fix calculation of total invalidated pages Date: Tue, 8 Apr 2025 12:47:39 +0200 Message-ID: <20250408104848.824975397@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250408104845.675475678@linuxfoundation.org> References: <20250408104845.675475678@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Chiara Meiohas [ Upstream commit 79195147644653ebffadece31a42181e4c48c07d ] When invalidating an address range in mlx5, there is an optimization to do UMR operations in chunks. Previously, the invalidation counter was incorrectly updated for the same indexes within a chunk. Now, the invalidation counter is updated only when a chunk is complete and mlx5r_umr_update_xlt() is called. This ensures that the counter accurately represents the number of pages invalidated using UMR. Fixes: a3de94e3d61e ("IB/mlx5: Introduce ODP diagnostic counters") Signed-off-by: Chiara Meiohas Reviewed-by: Michael Guralnik Link: https://patch.msgid.link/560deb2433318e5947282b070c915f3c81fef77f.1741875692.git.leon@kernel.org Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin --- drivers/infiniband/hw/mlx5/odp.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/infiniband/hw/mlx5/odp.c b/drivers/infiniband/hw/mlx5/odp.c index b4e2a6f9cb9c3..e158d5b1ab17b 100644 --- a/drivers/infiniband/hw/mlx5/odp.c +++ b/drivers/infiniband/hw/mlx5/odp.c @@ -309,9 +309,6 @@ static bool mlx5_ib_invalidate_range(struct mmu_interval_notifier *mni, blk_start_idx = idx; in_block = 1; } - - /* Count page invalidations */ - invalidations += idx - blk_start_idx + 1; } else { u64 umr_offset = idx & umr_block_mask; @@ -321,14 +318,19 @@ static bool mlx5_ib_invalidate_range(struct mmu_interval_notifier *mni, MLX5_IB_UPD_XLT_ZAP | MLX5_IB_UPD_XLT_ATOMIC); in_block = 0; + /* Count page invalidations */ + invalidations += idx - blk_start_idx + 1; } } } - if (in_block) + if (in_block) { mlx5r_umr_update_xlt(mr, blk_start_idx, idx - blk_start_idx + 1, 0, MLX5_IB_UPD_XLT_ZAP | MLX5_IB_UPD_XLT_ATOMIC); + /* Count page invalidations */ + invalidations += idx - blk_start_idx + 1; + } mlx5_update_odp_stats(mr, invalidations, invalidations); -- 2.39.5