Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp1731276rdh; Tue, 26 Sep 2023 01:32:54 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGus3TMe2jC2cTGbh1UKZawRq5XEA0F8sjJWnadZBWo1Khx/CPkrkB2VOJDLoEgWTOdpqzI X-Received: by 2002:a05:6358:881f:b0:143:8eb4:cf36 with SMTP id hv31-20020a056358881f00b001438eb4cf36mr9774417rwb.5.1695717174086; Tue, 26 Sep 2023 01:32:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695717174; cv=none; d=google.com; s=arc-20160816; b=uEVhVrAqIH8JIMJ3pvdipRCFGRNBq9lN0RvKUAtQVhGjhvyveKeVfu3Z2ymhH9WnVe 3yGA7l1tpaobjmC8HvbgjZGhPoWk9zXz65JJ0fAlSsYNTcQKxeZBVfsq3ZxFHsU2eumI 1pO4AUNuzPbudJR+F7hsMh+IABBz0yAzui6uAhXWiiIyN3gGt6jvGrE2PGRbBhsgeMPF k08MOQAlaKnU9BiF1CWkt/hZHFc3Vl7D8fGCuDbtKdWksZl4CipiWbW0ETB/Gc7p8etO vOwJ5X1hodQQeXNWvfnKhdfvhFv9FuVgBHGYyHvwWclH0Y5ZEzYaPyUZbryfazx+0cvR 9gNw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=kEmUFHiG+v20bYhhm+ItJ56i66yiTkn4iVTdKluq+yg=; fh=CmbLQMLhJ4m/wheaE9zjp8PV3iQNdbnp6NuPXCitHCY=; b=rIsoMjo1UK/D5b/AsyUwg5UU6S8nzhVvqziYOqIB3R4qFPdPX3ENSIvddGiEmSn8yJ 4BwVF0mEdFclu6Wm1s9ApLxsr4iUONdvliNjR9tD00gDELTObyfe0BdtOQh588mcnwls GpsjvQJb9s0YZx/O71Tq1kcmrcvIrz6h2Jjvr0fAHRb3zcfv6NYylW1XFktE25ncfu7l wBTgxCXPTF73EKv3woYH8mNQCBjZ9PpiO/wZt4GlIU0GNahKW7RI2HxqxGAfY/NAVOIq Tf5DdpC6QFnK5jlRcN42kIvqAKnqmCTPajvnU6LYXi4kk+IQLA468meJwNPR9cXm8rv9 Qf1w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id h12-20020a056a00230c00b0068ff741579fsi12716822pfh.318.2023.09.26.01.32.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 01:32:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 08649801F754; Tue, 26 Sep 2023 01:21:29 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233850AbjIZIV3 (ORCPT + 99 others); Tue, 26 Sep 2023 04:21:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229685AbjIZIV2 (ORCPT ); Tue, 26 Sep 2023 04:21:28 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 7FE2EB4; Tue, 26 Sep 2023 01:21:21 -0700 (PDT) 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 555E2DA7; Tue, 26 Sep 2023 01:21:59 -0700 (PDT) Received: from [10.57.0.188] (unknown [10.57.0.188]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C900C3F5A1; Tue, 26 Sep 2023 01:21:19 -0700 (PDT) Message-ID: <4d0f3de5-1d34-d998-cb55-7ce7bfaf3f49@arm.com> Date: Tue, 26 Sep 2023 09:21:15 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Subject: Re: [PATCH] MA-21654 Use dma_alloc_pages in vb2_dma_sg_alloc_compacted Content-Language: en-GB To: Christoph Hellwig Cc: Tomasz Figa , Fang Hui , m.szyprowski@samsung.com, mchehab@kernel.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, anle.pan@nxp.com, xuegang.liu@nxp.com References: <20230914145812.12851-1-hui.fang@nxp.com> <353919fd-932e-5d81-6ac5-7b51117366cd@arm.com> <20230926065143.GB5606@lst.de> From: Robin Murphy In-Reply-To: <20230926065143.GB5606@lst.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 26 Sep 2023 01:21:30 -0700 (PDT) On 2023-09-26 07:51, Christoph Hellwig wrote: > On Wed, Sep 20, 2023 at 05:54:26PM +0100, Robin Murphy wrote: >> As I mentioned before, I think it might make the most sense to make the >> whole thing into a "proper" dma_alloc_sgtable() function, which can then be >> used with dma_sync_sgtable_*() as dma_alloc_pages() is used with >> dma_sync_single_*() (and then dma_alloc_noncontiguous() clearly falls as >> the special in-between case). > > Why not just use dma_alloc_noncontiguous if the caller wants an sgtable > anyway? Because we don't need the restriction of the allocation being DMA-contiguous (and thus having to fall back to physically-contiguous in the absence of an IOMMU). That's what vb2_dma_contig already does, whereas IIUC vb2_dma_sg is for devices which can handle genuine scatter-gather DMA (and so are less likely to have an IOMMU, and more likely to need the best shot at piecing together large allocations). Thanks, Robin.