From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4195C11F6A for ; Wed, 30 Jun 2021 11:17:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A073F613EE for ; Wed, 30 Jun 2021 11:17:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234248AbhF3LTa (ORCPT ); Wed, 30 Jun 2021 07:19:30 -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.