Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp225727pxv; Wed, 30 Jun 2021 04:17:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyxoAzn2OGV2/Hw8/DyKeSXYq5u8fE21J8Segb/Izn2fBkh6/MziTyBj3G78maHWvmQ4ygj X-Received: by 2002:a02:5d0a:: with SMTP id w10mr8288550jaa.82.1625051862253; Wed, 30 Jun 2021 04:17:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625051862; cv=none; d=google.com; s=arc-20160816; b=H/mt6SJhFWDsZdLmGVhyfXRX09AduwWThKOkBQy66b37pot87XqfHNJFXVwWvSmCXC cea8ImxW+gHshx0KQJ2Obkl80aWHshOZRwjO9EHA8rgMjjImbftjpnwaC1YGzGdbe7aO fh0ryFVCNeCVmRfF1sJaJbweehuKcwR+WblDnJas6yqZT+l1rHA7U+g29m5MtTPE/nRE KFUuY0vml3DbjY7FriGa+dhaMsUsSI/tJEJTH0gOw2W8PzssgLuSxdsfcXKNzDZZCAg4 yYzJITKAXlrO+8ookEfjCLiQvQ4evD+rl+ONAE3NKjo1pJvbJR2KOMlFxochiGUTl7YJ yl4Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=5eqF8DjzZwCej+MSLIWb8bGIQujlVduif3ZrKhBPoG0=; b=ix6klw5QRysMZcUQTc/fOMMwawdELWfWxXLjC3G1uQ7c2rgxksjiQ8oP/AWRrEN7ip MoqRoCFhRAAY7kI4vSTfx5zV/fNG/I/vVUOXvpRVYOJRoH+csh1efujdlQ78EmAMU+gb 0D3iGWYXjJN13q/Xwy/psY0/7ckm4i/00pA5AorBPc1misvc7EYEg7v9DbGUpy552c0S cV8Y0sYqMEoK4+zUSvbEVyU/cvnOe8MzqTWuCaAnsgBmiAFbJyHkQuiq3QNE6o5/vyr5 NC4TUVLir3pve+7yiMJ886mbUlyWLIbpgCgG6H0mjae/kH6z6bFUjedNWtV3CMsdKiQU X9ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LrE5xBZG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d1si21990597ila.19.2021.06.30.04.17.28; Wed, 30 Jun 2021 04:17:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LrE5xBZG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234213AbhF3LT3 (ORCPT + 99 others); Wed, 30 Jun 2021 07:19:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:52112 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233706AbhF3LT2 (ORCPT ); Wed, 30 Jun 2021 07:19:28 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 71FDC61416; Wed, 30 Jun 2021 11:16:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625051819; bh=gUK7CVS8e2cXpIkn5P9a80Ni/fjjiEdxLr686zwbYwo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=LrE5xBZGvBzxMMDr7xPpC0LgFueWQu9wnpPgxKFozVNI8/77In5i8c/hdO5MtVNMC RVEOP5F5mHswSXrFPMxFi7/iAel9d4oGLGucGIc7r9FEpoKRJZcQ2HVWGjvG5VU69Q c6cjOrpWuI+1VjsBTf1qKdsQQ3D4afJAQrbf/4rqnfptmLydhn4PAhaWaB9I/Tsbdp ldRiKGTkwLmboPAvmvH0tfaKael5yebU5xrM108RV5xDelyF1SYVwz4c8V7MQGY2LB okwz61hRCid9ECCu5DhsCWAgdpyNIkdX0wBxVdoeQjrUMcUxYe1uL0oLn267Ja83oM bDJsfPF7DHZvg== Date: Wed, 30 Jun 2021 14:16:56 +0300 From: Leon Romanovsky To: Marek Szyprowski Cc: Doug Ledford , Jason Gunthorpe , Maor Gottlieb , Dennis Dalessandro , linux-kernel@vger.kernel.org, linux-rdma@vger.kernel.org, Mike Marciniszyn , Yishai Hadas , Zhu Yanjun , Christoph Hellwig , Robin Murphy , "iommu@lists.linux-foundation.org" , Bartlomiej Zolnierkiewicz Subject: Re: [PATCH rdma-next v1 1/2] lib/scatterlist: Fix wrong update of orig_nents Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 30, 2021 at 01:12:26PM +0200, Marek Szyprowski wrote: > Hi Leon, > > On 29.06.2021 10:40, Leon Romanovsky wrote: > > From: Maor Gottlieb > > > > orig_nents should represent the number of entries with pages, > > but __sg_alloc_table_from_pages sets orig_nents as the number of > > total entries in the table. This is wrong when the API is used for > > dynamic allocation where not all the table entries are mapped with > > pages. It wasn't observed until now, since RDMA umem who uses this > > API in the dynamic form doesn't use orig_nents implicit or explicit > > by the scatterlist APIs. > > > > Fix it by: > > 1. Set orig_nents as number of entries with pages also in > > __sg_alloc_table_from_pages. > > 2. Add a new field total_nents to reflect the total number of entries > > in the table. This is required for the release flow (sg_free_table). > > This filed should be used internally only by scatterlist. > > > > Fixes: 07da1223ec93 ("lib/scatterlist: Add support in dynamic allocation of SG table from pages") > > Signed-off-by: Maor Gottlieb > > Signed-off-by: Leon Romanovsky <...> > For now I would suggest to revert this change. Thanks for the report, we will drop this patch.