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 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D9431FD2D74 for ; Tue, 10 Mar 2026 12:59:58 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3717D10E289; Tue, 10 Mar 2026 12:59:58 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; secure) header.d=ziepe.ca header.i=@ziepe.ca header.b="mAQrWpyJ"; dkim-atps=neutral Received: from mail-qt1-f181.google.com (mail-qt1-f181.google.com [209.85.160.181]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3391F10E289 for ; Tue, 10 Mar 2026 12:59:56 +0000 (UTC) Received: by mail-qt1-f181.google.com with SMTP id d75a77b69052e-5090c27d3f6so29310051cf.0 for ; Tue, 10 Mar 2026 05:59:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1773147595; x=1773752395; darn=lists.freedesktop.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=IdfZ1gAzWMaWG4bFpHCyz70rMMacJ2An+it0IXdc3OE=; b=mAQrWpyJZIEzoZTWIDTyZbQMcs2s0SEldONAZE3aw+2pAebcMjkvFYwRNz61MTZnD1 Ccj8jjRHrFgKEib+R0Q/7arA1tQyZa8HLnMHM/7SDOvxTo6pVQUiYkgvZkipmtt8dO4z qX5x48x01jdPCY3wI5p2qJR+wRSEcMEyLDCazhsxXyShW0wWGouheTFTH6nkg99FrX/S U18ge3koQfz6z5veIs/XVnBzUsYPAB/wWZRAM1ug8sye8KqCBfVNhSfqgy7uP+uCwcRK w+BoW5g94cno8cTBKGGZru8y0S3tZXyDVYbLQfDcOtazYvRzoGL16TDexNKHZV89z3Y2 Sthw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1773147595; x=1773752395; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=IdfZ1gAzWMaWG4bFpHCyz70rMMacJ2An+it0IXdc3OE=; b=CNDrNdnh2FokAkeWrexV1HNUwK06FngYaYhcWSrzgqOCF7Tj/3BrWgM7uhVyseD+Mf Eyftuzfkk6ZiZjnR9Vg3f/tLa4DIzwCcNwGGMZUbdypa7QrjaVYep/0zAItoZPg4YSPK Oh8drMxBUwPn12cjE4EV2rjksW/d4T/oUh8MlSpvruaOz35PcpIqTcYW2jITINi29di1 V51Tn/L29iepcbxFwXi92b9VVHom0McoyZqD33DAhRKYe3MkzYU6LpjnM6p3ApAuiptv DnzuhfIxwzLOh6RpRGi952dlroH4+C4/SU11UkP0wdvQ8LdYVu0YSf7OEV/vAT26LrNP WEpg== X-Forwarded-Encrypted: i=1; AJvYcCU5xjQFiPDz+x+ORQhh1Xtlpm+u5foY0PHoeMLkTxB1+qqa3EEzbiyelEWotFIVI0aDE2Vj43AC0u8=@lists.freedesktop.org X-Gm-Message-State: AOJu0YwEIY90DFIDY8ICV75Qb9CHMV1qJaGDR3TvO7viUYpruGR/Q3UI FSZtRkdmL7/WAZidmUpSaSf7qYBv8xFHjHf4V2A/35gfx0K+jopHRbdsLPgGSTyMrOE= X-Gm-Gg: ATEYQzzQZCqxOBubSGS5jmbciVD7WXhtKhEqK6huFR9dV3gHP9T+mM9xMjAm9cVVBPs tfg3Pg0ntAv0C4JoJU/YR7RJQl5UIeuTNFxQqb5jm1k1zpWSMtrbbp0qhHdfo74J7TsBQvAW701 IdRpuuflCbZogHiC5p/8ZWqSjAvulDHbdjoDFVZDpW1jcN4IX8LJ/HkMD8mFbytQDRf5r5RaZxb LfmjiMgE7RwGk8ZKtpPN0bT73eWj+FfwwsBtHeR+FqT4R5c4iNTEOO9VpoLjwBogxzgV8BCy0kn wFdRL0CpGRP+5xCHGRun2zNDPJMav34WJI2OrIKASDH4/JnLav8fEbvc387gFzVKxjOEsCRPqmM QfzhdIcP9AKhu3iatWMCN4nJrzNpqoYDhSQxcXnPb8UmHVQQqfEWQlWFkmfyiNDrlsZ7QO2vMo3 OKzFUwzief4OxPKhP6vZHOMylnpIDV1Kd7Potw2qJnqJEFohCXW0spytcUo3Yrvgh7t/CFFt+Fn ggZ/NJ+ X-Received: by 2002:a05:622a:1aa1:b0:509:1b34:5350 with SMTP id d75a77b69052e-5091b34579dmr86614331cf.27.1773147595190; Tue, 10 Mar 2026 05:59:55 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-142-162-112-119.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.162.112.119]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-508fd904d51sm77155411cf.4.2026.03.10.05.59.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Mar 2026 05:59:54 -0700 (PDT) Received: from jgg by wakko with local (Exim 4.97) (envelope-from ) id 1vzwgj-00000005Uqh-3i7S; Tue, 10 Mar 2026 09:59:53 -0300 Date: Tue, 10 Mar 2026 09:59:53 -0300 From: Jason Gunthorpe To: "Kasireddy, Vivek" Cc: Julian Orth , Andrew Morton , "Deak, Imre" , Sakari Ailus , Thomas Hellstrom , "linux-kernel@vger.kernel.org" , Gerd Hoffmann , Sumit Semwal , Christian =?utf-8?B?S8O2bmln?= , "dri-devel@lists.freedesktop.org" , "linux-media@vger.kernel.org" , "linaro-mm-sig@lists.linaro.org" Subject: Re: [PATCH] lib/scatterlist: fix sg_page_count and sg_dma_page_count Message-ID: <20260310125953.GS1687929@ziepe.ca> References: <20260308-scatterlist-v1-1-39c4566b0bba@gmail.com> <20260308180826.GG1687929@ziepe.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Tue, Mar 10, 2026 at 05:49:23AM +0000, Kasireddy, Vivek wrote: > There are a couple of reasons why we got rid of the pages array: > - Back then, there was some confusion about whether a struct page would > exist or not for tail pages when HVO is enabled. Regardless, there was also > a concern about exposing tail pages outside hugetlb code. The existing code relies on struct page for the vmap: for (pg = 0; pg < ubuf->pagecount; pg++) pages[pg] = folio_page(ubuf->folios[pg], ubuf->offsets[pg] >> PAGE_SHIFT); Tail pages always exist, they are required by many interfaces. > - And, we also wanted to prepare for a future where struct page would not > exist anymore, so, it made sense to just use folios only. If you can 100% stick with whole folios then great, but we don't have the APIs for that cases udmabuf needs right now. Most likely we'd expect to use phys_addr_t for scatterlist and direct full folio for vmap. Neither is helped by the datastructure in udmabuf. Jason