Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp578219ybj; Tue, 5 May 2020 04:12:14 -0700 (PDT) X-Google-Smtp-Source: APiQypKT9Cf2kva+ERdvw/HK6SW7MKLPuySqoUjqIaZTSe3BwEksnlSnYdMVrqOjiO/9BaHFPYlN X-Received: by 2002:a05:6402:6cb:: with SMTP id n11mr2115671edy.210.1588677134552; Tue, 05 May 2020 04:12:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588677134; cv=none; d=google.com; s=arc-20160816; b=1FX0+irsu+05CPF4/4qDxeBAoWSlAZaPU+4YaJ0psdj5k5tEKzWyz4bwRaAE28Td61 hXsswsgflhWLJYCxYsR0Rh+CQ7qOrNLCPsYLCrlXAv6ykd7Dd0yWMSyLUQG5TClCqmvv U0/WSEchzCY3CSIip9IYNyx1D1dHlR7Ut/umRUJc18E4Y6IaHyqIC14BzV4So0KF9tTZ r97toqjWE9sgIuSS64XiTCVTuY6zWglHmlJUTm3rQvn1RwbOTx8av+MRFkFKGrK7py7/ /gnAP1XKMnPG/mY0Sb7Ag9DySP7SWm8C0azNsy+veDhlOzzuVvp5tigC33Oa6yZwnQum jKyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=1WewOTJFMwxSNfDbDq+EpeJ6A1/ME0oXgAUmeJoO//E=; b=Ucs+RZDKtDFKtE/JXfMtGEnrWGleVsTWWYXvSD+6HXzpc2JFk7UOvl6y96jvYXaL8f R5qrJdclepTuUqPBfdZtB6tQvqsbkC8RdefznN2jPTkj0oSgJra02qbTrEiEnwBkxwIo mHX/MWyRktngEkNXKuOOYTWDhnHcaPkn2h2+dOGkCOUvmkiZdRPbHhkMe71SfN3vX1Jk 2JCL9zHIP6qAhp4PdWXAwCUrFqtTaxU+36VM4TQ4QXA1Vy3E8aBvPnAWSoFhcN5zD0+v NJZYuQtAeenxmlwFRWuR96Aqn1DulkBxUgL7Vg8x4CRDybtXxJmot7yCMMo6jmGZ8T8I Iwfw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id nb6si960919ejb.255.2020.05.05.04.11.50; Tue, 05 May 2020 04:12:14 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728768AbgEELJx (ORCPT + 99 others); Tue, 5 May 2020 07:09:53 -0400 Received: from verein.lst.de ([213.95.11.211]:34758 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728756AbgEELJx (ORCPT ); Tue, 5 May 2020 07:09:53 -0400 Received: by verein.lst.de (Postfix, from userid 2407) id 4A89768C4E; Tue, 5 May 2020 13:09:50 +0200 (CEST) Date: Tue, 5 May 2020 13:09:50 +0200 From: Christoph Hellwig To: Marek Szyprowski Cc: Christoph Hellwig , dri-devel@lists.freedesktop.org, iommu@lists.linux-foundation.org, linaro-mm-sig@lists.linaro.org, linux-kernel@vger.kernel.org, Robin Murphy , Bartlomiej Zolnierkiewicz , linux-arm-kernel@lists.infradead.org, David Airlie , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Subject: Re: [PATCH v3 02/25] drm: core: fix common struct sg_table related issues Message-ID: <20200505110950.GA19067@lst.de> References: <20200505083926.28503-1-m.szyprowski@samsung.com> <20200505084614.30424-1-m.szyprowski@samsung.com> <20200505084614.30424-2-m.szyprowski@samsung.com> <20200505101508.GA14860@lst.de> <5dd1cb55-accb-0dc6-4ca5-90c57cd19527@samsung.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5dd1cb55-accb-0dc6-4ca5-90c57cd19527@samsung.com> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 05, 2020 at 12:51:58PM +0200, Marek Szyprowski wrote: > Hi Christoph, > > On 05.05.2020 12:15, Christoph Hellwig wrote: > >> - for_each_sg_page(st->sgl, &sg_iter, st->nents, 0) > >> + for_each_sg_page(st->sgl, &sg_iter, st->orig_nents, 0) > > Would it make sense to also add a for_each_sgtable_page helper that > > hides the use of orig_nents? To be used like: > > > > for_each_sgtable_page(st, &sg_iter, 0) { > > We would need two helpers: > > for_each_sgtable_cpu_page() and for_each_sgtable_dma_page(). > > I considered them, but then I found that there are already > for_each_sg_page(), for_each_sg_dma_page() and various special iterators > like sg_page_iter, sg_dma_page_iter and sg_mapping_iter. Too bad that > they are almost not used, at least in the DRM subsystem. I wonder if it > make sense to apply them or simply provide the two above mentioned > wrappers? None of the helpers helps with passing the right parameters from the sg_table. So in doube we'd need wrappers for all of the above, or none..