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 9F9961F472A; Tue, 3 Dec 2024 15:20:59 +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=1733239259; cv=none; b=I7fLyhnDltWHOdj/tkPSu5QJFKpBBpX18riVDggmr8n+7Esl74HK+FSHXpS+0pTSa9v+xL0wbt7M0bd1s+651k5Jv+S0COSUVamuBNEE+pu5GepYVDK0yRqto357l7SvmtWuaFeKVvNhcQld/SXN1mmbJs6bVwCBiBylYay4ifc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733239259; c=relaxed/simple; bh=oL1hjq8W5qmYzYGEqmgCiBHRUVyU1i317m+IV/ycF7E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=et9Y/AafrfFiVzhyzLVP5/kkJdZRAwxXh/ZcjAbRkF/9ybmAElIUfAtpJj1B0f8zsb2HJAxiRyrY43W+EbffF1JfMf1O+Z5szxW44gk36e9H5g1KshD6KNpJZveiev72i092RDiigSCp0pcO+uB0JwuXLFDQhFKX4el0znM1PaM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=sW6AhV78; 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="sW6AhV78" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 536CFC4CECF; Tue, 3 Dec 2024 15:20:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1733239259; bh=oL1hjq8W5qmYzYGEqmgCiBHRUVyU1i317m+IV/ycF7E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=sW6AhV78NPPZVnbRo/EK7bbik2pjpK25klaxu2rm91cSu7c3IevEIxShKt+CfB5Oe y81mSj0dNzuT1eAas2dTA+8DKErxoWnBAIMYEittaJQH4DaLOl3+0McutbIY6wWRdi iZL6NvY0tbifiqPmW1Jk++ElwetU1RmTguQCv5JE= 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.11 553/817] vdpa/mlx5: Fix suboptimal range on iotlb iteration Date: Tue, 3 Dec 2024 15:42:05 +0100 Message-ID: <20241203144017.498007344@linuxfoundation.org> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20241203143955.605130076@linuxfoundation.org> References: <20241203143955.605130076@linuxfoundation.org> User-Agent: quilt/0.67 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.11-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 f1da0b7e08e9e..906b39f2c4be4 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