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 B2A13239BB3; Thu, 12 Dec 2024 16:11:36 +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=1734019896; cv=none; b=TS4QLdnrUaWE6lJKGIFAemlRTpWlP9NJupbYs/oc+y362gy2lcR2iq72UZC4ZGr1wQ7niiYyI4sCqh+mFQs/qYMtJ8/BkCsXrCkaCNm/gK9Q6Ph9tytTQCs4kk7RwXFQH3RoO2ilxJlGrJJF/D5jFgWpxL032Wc1nRzhPe4XerY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734019896; c=relaxed/simple; bh=LnzWhiq09mY6/AAc/B8wqfC1lb2AOwDRDPxMIF/9//A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Vtm7i6mGNVbp/TIdr10edwXPLBbOg45aSRrGljQXq+dI4voJ6KsC3IG6dClzeJY6+wLsuHXK10HU0PIFvwOehdfA8Y9aJS7cTrtBU0brS4TyxyEwEqvF+LdmV174WQaOVfkijmxFERxecFpuEkx9BStUv8K3cdUrScXEdGqYt2g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=YiCoez64; 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="YiCoez64" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E1DB9C4CECE; Thu, 12 Dec 2024 16:11:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1734019896; bh=LnzWhiq09mY6/AAc/B8wqfC1lb2AOwDRDPxMIF/9//A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YiCoez64b+g5QwhiZ9krjMBgOGDMQ8JrBQtFFmr/fqAq4VQnNL1ADUK0nMyhsWe8z cLNNEV5fgm6zEPpoFshVMW++3O//rmdipzEsvFxBwmevK5oMu9TWT9VX4fMye75tHS TuKP5S1cJh7WQ3QxsYc6YX4MZ0qMePmIyKIfEwQY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Si-Wei Liu , Dragos Tatulea , "Michael S. Tsirkin" , Jason Wang , Sasha Levin Subject: [PATCH 6.1 296/772] vdpa/mlx5: Fix suboptimal range on iotlb iteration Date: Thu, 12 Dec 2024 15:54:01 +0100 Message-ID: <20241212144402.136796657@linuxfoundation.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241212144349.797589255@linuxfoundation.org> References: <20241212144349.797589255@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Si-Wei Liu [ Upstream commit 35025963326e44d8bced3eecd42d2f040f4f0024 ] The starting iova address to iterate iotlb map entry within a range was set to an irrelevant value when passing to the itree_next() iterator, although luckily it doesn't affect the outcome of finding out the granule of the smallest iotlb map size. Fix the code to make it consistent with the following for-loop. Fixes: 94abbccdf291 ("vdpa/mlx5: Add shared memory registration code") Signed-off-by: Si-Wei Liu Signed-off-by: Dragos Tatulea Message-Id: <20241021134040.975221-3-dtatulea@nvidia.com> Signed-off-by: Michael S. Tsirkin Acked-by: Jason Wang Signed-off-by: Sasha Levin --- drivers/vdpa/mlx5/core/mr.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/vdpa/mlx5/core/mr.c b/drivers/vdpa/mlx5/core/mr.c index 4f0a2edc2333d..b6ac21b0322d7 100644 --- a/drivers/vdpa/mlx5/core/mr.c +++ b/drivers/vdpa/mlx5/core/mr.c @@ -227,7 +227,6 @@ static int map_direct_mr(struct mlx5_vdpa_dev *mvdev, struct mlx5_vdpa_direct_mr unsigned long lgcd = 0; int log_entity_size; unsigned long size; - u64 start = 0; int err; struct page *pg; unsigned int nsg; @@ -238,10 +237,9 @@ static int map_direct_mr(struct mlx5_vdpa_dev *mvdev, struct mlx5_vdpa_direct_mr struct device *dma = mvdev->vdev.dma_dev; for (map = vhost_iotlb_itree_first(iotlb, mr->start, mr->end - 1); - map; map = vhost_iotlb_itree_next(map, start, mr->end - 1)) { + map; map = vhost_iotlb_itree_next(map, mr->start, mr->end - 1)) { size = maplen(map, mr); lgcd = gcd(lgcd, size); - start += size; } log_entity_size = ilog2(lgcd); -- 2.43.0