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=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 C95B8C83000 for ; Tue, 28 Apr 2020 16:03:03 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B0F7B20575 for ; Tue, 28 Apr 2020 16:03:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728350AbgD1QDC (ORCPT ); Tue, 28 Apr 2020 12:03:02 -0400 Received: from foss.arm.com ([217.140.110.172]:54716 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727920AbgD1QDC (ORCPT ); Tue, 28 Apr 2020 12:03:02 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 11FB530E; Tue, 28 Apr 2020 09:03:02 -0700 (PDT) Received: from [10.57.33.170] (unknown [10.57.33.170]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0EE773F305; Tue, 28 Apr 2020 09:02:59 -0700 (PDT) Subject: Re: [RFC 00/17] DRM: fix struct sg_table nents vs. orig_nents misuse To: Christoph Hellwig , Marek Szyprowski , dri-devel@lists.freedesktop.org, iommu@lists.linux-foundation.org, linaro-mm-sig@lists.linaro.org, linux-kernel@vger.kernel.org, Bartlomiej Zolnierkiewicz , Sumit Semwal , Benjamin Gaignard , intel-gfx@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, amd-gfx@lists.freedesktop.org, David Airlie References: <20200428132005.21424-1-m.szyprowski@samsung.com> <20200428140257.GA3433@lst.de> <20200428153202.GY3456981@phenom.ffwll.local> From: Robin Murphy Message-ID: Date: Tue, 28 Apr 2020 17:02:58 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200428153202.GY3456981@phenom.ffwll.local> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-04-28 4:32 pm, Daniel Vetter wrote: > On Tue, Apr 28, 2020 at 04:02:57PM +0200, Christoph Hellwig wrote: >> On Tue, Apr 28, 2020 at 03:19:48PM +0200, Marek Szyprowski wrote: >>> 1. introduce a dma_{map,sync,unmap}_sgtable() wrappers, which will use >>> a proper sg_table entries and call respective DMA-mapping functions >>> and adapt current code to it >> >> That sounds reasonable to me. Those could be pretty trivial wrappers. >> >>> >>> >>> 2. rename nents and orig_nents to nr_pages, nr_dmas to clearly state >>> which one refers to which part of the scatterlist; I'm open for >>> other names for those entries >> >> nr_cpu_ents and nr_dma_ents might be better names, but it still would be >> a whole lot of churn for little gain. I think just good wrappers like >> suggested above might be more helpful. > > I guess long-term we could aim for both? I.e. roll out better wrappers > first, once that's soaked through the tree, rename the last offenders. Yes, that's what I was thinking too - most of these uses are just passing them in and out of the DMA APIs, and thus would be subsumed into the wrappers anyway, then in the relatively few remaining places where the table is actually iterated for one reason or the other, renaming would stand to help review and maintenance in terms of making it far more obvious when the implementation and the intent don't match. Robin. 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=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 3A533C83000 for ; Tue, 28 Apr 2020 16:03:07 +0000 (UTC) Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F2219206D8 for ; Tue, 28 Apr 2020 16:03:06 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F2219206D8 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=iommu-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id B6E148803E; Tue, 28 Apr 2020 16:03:06 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jxE3Xfg0xAFt; Tue, 28 Apr 2020 16:03:05 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by hemlock.osuosl.org (Postfix) with ESMTP id 8EAD78757D; Tue, 28 Apr 2020 16:03:05 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 7519EC0864; Tue, 28 Apr 2020 16:03:05 +0000 (UTC) Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id 694DDC0172 for ; Tue, 28 Apr 2020 16:03:04 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 31EAC20459 for ; Tue, 28 Apr 2020 16:03:04 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id JYT4w+1NC4Vp for ; Tue, 28 Apr 2020 16:03:02 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by silver.osuosl.org (Postfix) with ESMTP id CF4B22042D for ; Tue, 28 Apr 2020 16:03:02 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 11FB530E; Tue, 28 Apr 2020 09:03:02 -0700 (PDT) Received: from [10.57.33.170] (unknown [10.57.33.170]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0EE773F305; Tue, 28 Apr 2020 09:02:59 -0700 (PDT) Subject: Re: [RFC 00/17] DRM: fix struct sg_table nents vs. orig_nents misuse To: Christoph Hellwig , Marek Szyprowski , dri-devel@lists.freedesktop.org, iommu@lists.linux-foundation.org, linaro-mm-sig@lists.linaro.org, linux-kernel@vger.kernel.org, Bartlomiej Zolnierkiewicz , Sumit Semwal , Benjamin Gaignard , intel-gfx@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, amd-gfx@lists.freedesktop.org, David Airlie References: <20200428132005.21424-1-m.szyprowski@samsung.com> <20200428140257.GA3433@lst.de> <20200428153202.GY3456981@phenom.ffwll.local> From: Robin Murphy Message-ID: Date: Tue, 28 Apr 2020 17:02:58 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200428153202.GY3456981@phenom.ffwll.local> Content-Language: en-GB X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" On 2020-04-28 4:32 pm, Daniel Vetter wrote: > On Tue, Apr 28, 2020 at 04:02:57PM +0200, Christoph Hellwig wrote: >> On Tue, Apr 28, 2020 at 03:19:48PM +0200, Marek Szyprowski wrote: >>> 1. introduce a dma_{map,sync,unmap}_sgtable() wrappers, which will use >>> a proper sg_table entries and call respective DMA-mapping functions >>> and adapt current code to it >> >> That sounds reasonable to me. Those could be pretty trivial wrappers. >> >>> >>> >>> 2. rename nents and orig_nents to nr_pages, nr_dmas to clearly state >>> which one refers to which part of the scatterlist; I'm open for >>> other names for those entries >> >> nr_cpu_ents and nr_dma_ents might be better names, but it still would be >> a whole lot of churn for little gain. I think just good wrappers like >> suggested above might be more helpful. > > I guess long-term we could aim for both? I.e. roll out better wrappers > first, once that's soaked through the tree, rename the last offenders. Yes, that's what I was thinking too - most of these uses are just passing them in and out of the DMA APIs, and thus would be subsumed into the wrappers anyway, then in the relatively few remaining places where the table is actually iterated for one reason or the other, renaming would stand to help review and maintenance in terms of making it far more obvious when the implementation and the intent don't match. Robin. _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu 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=-2.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 804E7C83001 for ; Tue, 28 Apr 2020 16:03:11 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4432820575 for ; Tue, 28 Apr 2020 16:03:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ckH3+4UG" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4432820575 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:To:Subject:Reply-To:Cc:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=9kHz89whetgFoeqcXYv4UESaw6qVDJuGYOlZcZ+MKcU=; b=ckH3+4UGz5SNnHFbdsoRBKX3+ byovZKhHm0EkfObzvp5MKku5aGC8BTA2pVtlpN2w0F/v+SnpR/LsmtFm4QsgKxPATHMsNzfxfP8zG eXWlAXSLYHyCSOZdHehGWBfGJcP14xOslbOYhrKuSnAp/eXU29CnMytcjPDNR/r1qgt8rLsREh1oy AGl/HatPRQtLZMxMTP8Qt8IgVbbhVLBsQDqt0vHFl0J9+0ZOOQYSDA/jJ/Uvv7y9l2zrYMhrLK/Lu Pm4A326wjxfefT/4Rfr93dhUvrWTSadfCyb44sMpPHDu9/Gw6GRCsXKNUsOWV9G/3Pnz1uR3AYJ4f k0I1Lmd4w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jTShP-0008GS-Tm; Tue, 28 Apr 2020 16:03:07 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jTShM-0008FM-Qf for linux-arm-kernel@lists.infradead.org; Tue, 28 Apr 2020 16:03:06 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 11FB530E; Tue, 28 Apr 2020 09:03:02 -0700 (PDT) Received: from [10.57.33.170] (unknown [10.57.33.170]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0EE773F305; Tue, 28 Apr 2020 09:02:59 -0700 (PDT) Subject: Re: [RFC 00/17] DRM: fix struct sg_table nents vs. orig_nents misuse To: Christoph Hellwig , Marek Szyprowski , dri-devel@lists.freedesktop.org, iommu@lists.linux-foundation.org, linaro-mm-sig@lists.linaro.org, linux-kernel@vger.kernel.org, Bartlomiej Zolnierkiewicz , Sumit Semwal , Benjamin Gaignard , intel-gfx@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, amd-gfx@lists.freedesktop.org, David Airlie References: <20200428132005.21424-1-m.szyprowski@samsung.com> <20200428140257.GA3433@lst.de> <20200428153202.GY3456981@phenom.ffwll.local> From: Robin Murphy Message-ID: Date: Tue, 28 Apr 2020 17:02:58 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200428153202.GY3456981@phenom.ffwll.local> Content-Language: en-GB X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200428_090304_905091_1D0C4CE7 X-CRM114-Status: GOOD ( 13.60 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2020-04-28 4:32 pm, Daniel Vetter wrote: > On Tue, Apr 28, 2020 at 04:02:57PM +0200, Christoph Hellwig wrote: >> On Tue, Apr 28, 2020 at 03:19:48PM +0200, Marek Szyprowski wrote: >>> 1. introduce a dma_{map,sync,unmap}_sgtable() wrappers, which will use >>> a proper sg_table entries and call respective DMA-mapping functions >>> and adapt current code to it >> >> That sounds reasonable to me. Those could be pretty trivial wrappers. >> >>> >>> >>> 2. rename nents and orig_nents to nr_pages, nr_dmas to clearly state >>> which one refers to which part of the scatterlist; I'm open for >>> other names for those entries >> >> nr_cpu_ents and nr_dma_ents might be better names, but it still would be >> a whole lot of churn for little gain. I think just good wrappers like >> suggested above might be more helpful. > > I guess long-term we could aim for both? I.e. roll out better wrappers > first, once that's soaked through the tree, rename the last offenders. Yes, that's what I was thinking too - most of these uses are just passing them in and out of the DMA APIs, and thus would be subsumed into the wrappers anyway, then in the relatively few remaining places where the table is actually iterated for one reason or the other, renaming would stand to help review and maintenance in terms of making it far more obvious when the implementation and the intent don't match. Robin. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 3FBE4C83001 for ; Tue, 28 Apr 2020 16:03:05 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 1534820575 for ; Tue, 28 Apr 2020 16:03:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1534820575 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 84D9A6E843; Tue, 28 Apr 2020 16:03:04 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by gabe.freedesktop.org (Postfix) with ESMTP id 99A556E82D; Tue, 28 Apr 2020 16:03:02 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 11FB530E; Tue, 28 Apr 2020 09:03:02 -0700 (PDT) Received: from [10.57.33.170] (unknown [10.57.33.170]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0EE773F305; Tue, 28 Apr 2020 09:02:59 -0700 (PDT) Subject: Re: [RFC 00/17] DRM: fix struct sg_table nents vs. orig_nents misuse To: Christoph Hellwig , Marek Szyprowski , dri-devel@lists.freedesktop.org, iommu@lists.linux-foundation.org, linaro-mm-sig@lists.linaro.org, linux-kernel@vger.kernel.org, Bartlomiej Zolnierkiewicz , Sumit Semwal , Benjamin Gaignard , intel-gfx@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, amd-gfx@lists.freedesktop.org, David Airlie References: <20200428132005.21424-1-m.szyprowski@samsung.com> <20200428140257.GA3433@lst.de> <20200428153202.GY3456981@phenom.ffwll.local> From: Robin Murphy Message-ID: Date: Tue, 28 Apr 2020 17:02:58 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200428153202.GY3456981@phenom.ffwll.local> Content-Language: en-GB 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: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On 2020-04-28 4:32 pm, Daniel Vetter wrote: > On Tue, Apr 28, 2020 at 04:02:57PM +0200, Christoph Hellwig wrote: >> On Tue, Apr 28, 2020 at 03:19:48PM +0200, Marek Szyprowski wrote: >>> 1. introduce a dma_{map,sync,unmap}_sgtable() wrappers, which will use >>> a proper sg_table entries and call respective DMA-mapping functions >>> and adapt current code to it >> >> That sounds reasonable to me. Those could be pretty trivial wrappers. >> >>> >>> >>> 2. rename nents and orig_nents to nr_pages, nr_dmas to clearly state >>> which one refers to which part of the scatterlist; I'm open for >>> other names for those entries >> >> nr_cpu_ents and nr_dma_ents might be better names, but it still would be >> a whole lot of churn for little gain. I think just good wrappers like >> suggested above might be more helpful. > > I guess long-term we could aim for both? I.e. roll out better wrappers > first, once that's soaked through the tree, rename the last offenders. Yes, that's what I was thinking too - most of these uses are just passing them in and out of the DMA APIs, and thus would be subsumed into the wrappers anyway, then in the relatively few remaining places where the table is actually iterated for one reason or the other, renaming would stand to help review and maintenance in terms of making it far more obvious when the implementation and the intent don't match. Robin. _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel 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=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no 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 32B19C83009 for ; Tue, 28 Apr 2020 18:04:58 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 0AB22206A1 for ; Tue, 28 Apr 2020 18:04:57 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0AB22206A1 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 831A66E8C8; Tue, 28 Apr 2020 18:04:56 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by gabe.freedesktop.org (Postfix) with ESMTP id 99A556E82D; Tue, 28 Apr 2020 16:03:02 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 11FB530E; Tue, 28 Apr 2020 09:03:02 -0700 (PDT) Received: from [10.57.33.170] (unknown [10.57.33.170]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0EE773F305; Tue, 28 Apr 2020 09:02:59 -0700 (PDT) To: Christoph Hellwig , Marek Szyprowski , dri-devel@lists.freedesktop.org, iommu@lists.linux-foundation.org, linaro-mm-sig@lists.linaro.org, linux-kernel@vger.kernel.org, Bartlomiej Zolnierkiewicz , Sumit Semwal , Benjamin Gaignard , intel-gfx@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, amd-gfx@lists.freedesktop.org, David Airlie References: <20200428132005.21424-1-m.szyprowski@samsung.com> <20200428140257.GA3433@lst.de> <20200428153202.GY3456981@phenom.ffwll.local> From: Robin Murphy Message-ID: Date: Tue, 28 Apr 2020 17:02:58 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200428153202.GY3456981@phenom.ffwll.local> Content-Language: en-GB X-Mailman-Approved-At: Tue, 28 Apr 2020 18:04:52 +0000 Subject: Re: [Intel-gfx] [RFC 00/17] DRM: fix struct sg_table nents vs. orig_nents misuse X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On 2020-04-28 4:32 pm, Daniel Vetter wrote: > On Tue, Apr 28, 2020 at 04:02:57PM +0200, Christoph Hellwig wrote: >> On Tue, Apr 28, 2020 at 03:19:48PM +0200, Marek Szyprowski wrote: >>> 1. introduce a dma_{map,sync,unmap}_sgtable() wrappers, which will use >>> a proper sg_table entries and call respective DMA-mapping functions >>> and adapt current code to it >> >> That sounds reasonable to me. Those could be pretty trivial wrappers. >> >>> >>> >>> 2. rename nents and orig_nents to nr_pages, nr_dmas to clearly state >>> which one refers to which part of the scatterlist; I'm open for >>> other names for those entries >> >> nr_cpu_ents and nr_dma_ents might be better names, but it still would be >> a whole lot of churn for little gain. I think just good wrappers like >> suggested above might be more helpful. > > I guess long-term we could aim for both? I.e. roll out better wrappers > first, once that's soaked through the tree, rename the last offenders. Yes, that's what I was thinking too - most of these uses are just passing them in and out of the DMA APIs, and thus would be subsumed into the wrappers anyway, then in the relatively few remaining places where the table is actually iterated for one reason or the other, renaming would stand to help review and maintenance in terms of making it far more obvious when the implementation and the intent don't match. Robin. _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx 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=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no 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 4DC2EC83001 for ; Tue, 28 Apr 2020 16:12:02 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 2895E206E2 for ; Tue, 28 Apr 2020 16:12:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2895E206E2 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=amd-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CB38C6E839; Tue, 28 Apr 2020 16:12:01 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by gabe.freedesktop.org (Postfix) with ESMTP id 99A556E82D; Tue, 28 Apr 2020 16:03:02 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 11FB530E; Tue, 28 Apr 2020 09:03:02 -0700 (PDT) Received: from [10.57.33.170] (unknown [10.57.33.170]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0EE773F305; Tue, 28 Apr 2020 09:02:59 -0700 (PDT) Subject: Re: [RFC 00/17] DRM: fix struct sg_table nents vs. orig_nents misuse To: Christoph Hellwig , Marek Szyprowski , dri-devel@lists.freedesktop.org, iommu@lists.linux-foundation.org, linaro-mm-sig@lists.linaro.org, linux-kernel@vger.kernel.org, Bartlomiej Zolnierkiewicz , Sumit Semwal , Benjamin Gaignard , intel-gfx@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, amd-gfx@lists.freedesktop.org, David Airlie References: <20200428132005.21424-1-m.szyprowski@samsung.com> <20200428140257.GA3433@lst.de> <20200428153202.GY3456981@phenom.ffwll.local> From: Robin Murphy Message-ID: Date: Tue, 28 Apr 2020 17:02:58 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200428153202.GY3456981@phenom.ffwll.local> Content-Language: en-GB X-Mailman-Approved-At: Tue, 28 Apr 2020 16:12:00 +0000 X-BeenThere: amd-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion list for AMD gfx List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: amd-gfx-bounces@lists.freedesktop.org Sender: "amd-gfx" On 2020-04-28 4:32 pm, Daniel Vetter wrote: > On Tue, Apr 28, 2020 at 04:02:57PM +0200, Christoph Hellwig wrote: >> On Tue, Apr 28, 2020 at 03:19:48PM +0200, Marek Szyprowski wrote: >>> 1. introduce a dma_{map,sync,unmap}_sgtable() wrappers, which will use >>> a proper sg_table entries and call respective DMA-mapping functions >>> and adapt current code to it >> >> That sounds reasonable to me. Those could be pretty trivial wrappers. >> >>> >>> >>> 2. rename nents and orig_nents to nr_pages, nr_dmas to clearly state >>> which one refers to which part of the scatterlist; I'm open for >>> other names for those entries >> >> nr_cpu_ents and nr_dma_ents might be better names, but it still would be >> a whole lot of churn for little gain. I think just good wrappers like >> suggested above might be more helpful. > > I guess long-term we could aim for both? I.e. roll out better wrappers > first, once that's soaked through the tree, rename the last offenders. Yes, that's what I was thinking too - most of these uses are just passing them in and out of the DMA APIs, and thus would be subsumed into the wrappers anyway, then in the relatively few remaining places where the table is actually iterated for one reason or the other, renaming would stand to help review and maintenance in terms of making it far more obvious when the implementation and the intent don't match. Robin. _______________________________________________ amd-gfx mailing list amd-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/amd-gfx