Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp3865288imw; Mon, 11 Jul 2022 18:11:49 -0700 (PDT) X-Google-Smtp-Source: AGRyM1tytXoVzTHD3WYMig16QtW2DNn/4eu4yMYHI7iAMvVMc0bGWLFTo/0m41MVOexNcXaEK1CT X-Received: by 2002:a17:907:2e01:b0:72b:7497:778 with SMTP id ig1-20020a1709072e0100b0072b74970778mr2504166ejc.530.1657588309497; Mon, 11 Jul 2022 18:11:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1657588309; cv=pass; d=google.com; s=arc-20160816; b=WmI+YvkSeqRDEyD249xmsyvawaF6TqDSbuNsmnLHo1nc/Risj9T6HhUH/p5N4CrD+c dYtXRWUvziSw4MDL0QBfEz1Y6MrZBeYU7P/enumjcKFkbICWiw8lPY/fepOm43egWIUw 3Y7nhSoyW/UkLoHNfmVgLldn2TC6M3CZjbzXgptBAN3u05XiDvKKlJ1oQDv9Lt0ka/62 zGl5d70uPW7giAVkUBjJjqOpE/7dAGW6hGNqBmp8J+eYXdJEIRaEimtzmkd0p/5bhnVQ +RIIHE2ctwZ6T++LBtmUYPYzupvyYPB2BFdTyjsQX/9ou2CSTQhQuY10HuS69p9qoIs/ uPdg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:importance:content-transfer-encoding :mime-version:subject:references:in-reply-to:message-id:cc:to:from :date:dkim-signature; bh=fhJVT85aTlBQWQb6yaeXraBInDSuiyuvEmq9JyUyXYE=; b=eVfwxtYFdcKnerxvlUBjW3WRSmo4+94cYt95CImIilGWDw5xUzUg30ERX7kpq1dmHS EPBzBJNc1uNVtItNeaTQmcSFKc4EgSBy1nj3aW7KyeycToy43Z10sZ8WdUplQItfoKuA rJ3RyP6cKtHESBsbd+Kob/p2TFbeoVn/UFge7hQZuCxIreuI0QUsxAr/JsfRZc9Ieiry UCumJbmdhRGg9lFA5yoifzPuFJj56kU9ZuayrXNSMTq293XqjNEkC/IJameYuaD7xNWX lQ2voYe8vwgF5RMImobtmelvglajOOqI9Er5K3FBkHwmyoHM0NqT3WW+OVy78fWFnyrN JAAA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.beauty header.s=zmail header.b=ht469zLC; arc=pass (i=1 spf=pass spfdomain=linux.beauty dkim=pass dkdomain=linux.beauty dmarc=pass fromdomain=linux.beauty>); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id yr10-20020a170907334a00b00711bc35fedfsi9695617ejb.957.2022.07.11.18.11.24; Mon, 11 Jul 2022 18:11:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.beauty header.s=zmail header.b=ht469zLC; arc=pass (i=1 spf=pass spfdomain=linux.beauty dkim=pass dkdomain=linux.beauty dmarc=pass fromdomain=linux.beauty>); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231990AbiGLAQy (ORCPT + 99 others); Mon, 11 Jul 2022 20:16:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50334 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231794AbiGLAQX (ORCPT ); Mon, 11 Jul 2022 20:16:23 -0400 Received: from sender4-op-o14.zoho.com (sender4-op-o14.zoho.com [136.143.188.14]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 43C0A31352; Mon, 11 Jul 2022 17:15:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657584897; cv=none; d=zohomail.com; s=zohoarc; b=bJmObJhUXPfREMqCN/WvVFaSBUz3AzVlTwIJKfvLDHoe1aG6K7Iqc4ovk/XOOtlgXLTGsjOwF4JoS8ZWQfquvAZ+nspaUKHGAabfjufMaeksl3J0Wma8w3FrjHTrYGL/azYM2wZr1L7giIUz5mvI/OeW1d/maBtAD4yGIyjVZIk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1657584897; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=fhJVT85aTlBQWQb6yaeXraBInDSuiyuvEmq9JyUyXYE=; b=HJXLnQdePfBzYS5gYvF2NWYq6Ar0h+zlTQeWYGDsmpy47vOMKQ1cguN2NJ3nOFpcdqRWJEYd0V0ewebpw87dq4EmRKZC1Mt1eEv6zcO0Hj50baqOiLSxitRYwkUC33qqZQ05ygR7jv4iKMRhZ2KOt7bR4+5Xp7O8A08iD42DfB0= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=linux.beauty; spf=pass smtp.mailfrom=me@linux.beauty; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1657584897; s=zmail; d=linux.beauty; i=me@linux.beauty; h=Date:Date:From:From:To:To:Cc:Cc:Message-ID:In-Reply-To:References:Subject:Subject:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-Id:Reply-To; bh=fhJVT85aTlBQWQb6yaeXraBInDSuiyuvEmq9JyUyXYE=; b=ht469zLCvWSqlKO3GMKF5L1p8SJlW6uMKUtxZUtAmkO/WlFcm1aMBSqQvNJ/dgUN vTxuNTnejwgRWnlF1T5TDGb3pDxejhjEgsaZYCNzMF3F/15bHdKcnGgUDFjdVU02U6D TZdqG93CB0fZCtau2mX8Ml/V9B1YS81TCUVheAU8= Received: from mail.zoho.com by mx.zohomail.com with SMTP id 1657584897026777.3647169706071; Mon, 11 Jul 2022 17:14:57 -0700 (PDT) Date: Tue, 12 Jul 2022 08:14:56 +0800 From: Li Chen To: "Christoph Hellwig" Cc: "Catalin Marinas" , "Will Deacon" , "Rob Herring" , "Frank Rowand" , "Andrew Morton" , "linux-arm-kernel" , "linux-kernel" , "devicetree" , "linux-mm" Message-ID: <181efc24bdd.108279419521615.7697137316951540027@linux.beauty> In-Reply-To: References: <20220711122459.13773-1-me@linux.beauty> <181ee01d384.b809bd01412268.496620746959082770@linux.beauty> Subject: Re: [PATCH 0/4] add struct page and Direct I/O support to reserved memory MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Importance: Medium User-Agent: Zoho Mail X-Mailer: Zoho Mail X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_RED 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 Hi Christoph, ---- On Tue, 12 Jul 2022 00:09:55 +0800 Christoph Hellwig wrote --- > On Tue, Jul 12, 2022 at 12:05:06AM +0800, Li Chen wrote: > > My use case has been stated in the cover letter, but our driver is not ready for upstream yet. > > Which means we can't review the use case. I'd suggest you come back > when you submit your driver. Totally agree, but we plan to start rewriting the code of our video driver in a long time, it has many legacy codes and I need to rewrite a lot of codes to migrate to v4l2. That's why I also submit a sample driver here: to make the review progress easier and don't need reviewers to read video driver codes. > > > With DMA allocator, we can access buffer in kernel space, not userspace, however, this patch > > Take a look at dma_mmap_* on how to map DMA coherent allocations to > usersapce. This is of course easily possible. > Yes, I know them. They take use of remap_pfn_range, which set VM_IO and VM_PFNMAP on vma, so dio is not possible with them. IIUC, if you want to expose the kernel's reserved memory to userspace, it doesn't matter whether the memory came from dma allocator or something else. The point is if they want to get better throughput, they can consider replacing their dma_mmap_* with my reserved_mem_memremap_pages + reserved_mem_dio_mmap. Regards, Li