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=-5.3 required=3.0 tests=BAYES_00, 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 10992C4741F for ; Sat, 26 Sep 2020 14:14:38 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3EBFA2168B for ; Sat, 26 Sep 2020 14:14:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3EBFA2168B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id BA86A8E0003; Sat, 26 Sep 2020 10:14:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B7CF98E0001; Sat, 26 Sep 2020 10:14:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ABAC48E0003; Sat, 26 Sep 2020 10:14:36 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0134.hostedemail.com [216.40.44.134]) by kanga.kvack.org (Postfix) with ESMTP id 95C9D8E0001 for ; Sat, 26 Sep 2020 10:14:36 -0400 (EDT) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 5D111180AD804 for ; Sat, 26 Sep 2020 14:14:36 +0000 (UTC) X-FDA: 77305408152.06.thumb84_2c0ebf327170 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin06.hostedemail.com (Postfix) with ESMTP id 376E6100DAA00 for ; Sat, 26 Sep 2020 14:14:36 +0000 (UTC) X-HE-Tag: thumb84_2c0ebf327170 X-Filterd-Recvd-Size: 2948 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by imf30.hostedemail.com (Postfix) with ESMTP for ; Sat, 26 Sep 2020 14:14:35 +0000 (UTC) Received: by verein.lst.de (Postfix, from userid 2407) id 6B5EE68B05; Sat, 26 Sep 2020 16:14:29 +0200 (CEST) Date: Sat, 26 Sep 2020 16:14:28 +0200 From: Christoph Hellwig To: Tomasz Figa Cc: Christoph Hellwig , Mauro Carvalho Chehab , Thomas Bogendoerfer , "James E.J. Bottomley" , Joonyoung Shim , Seung-Woo Kim , Ben Skeggs , Marek Szyprowski , Matt Porter , iommu@lists.linux-foundation.org, Stefan Richter , linux1394-devel@lists.sourceforge.net, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linux-samsung-soc@vger.kernel.org, nouveau@lists.freedesktop.org, netdev@vger.kernel.org, linux-scsi@vger.kernel.org, linux-mm@kvack.org, alsa-devel@alsa-project.org Subject: Re: [PATCH 17/18] dma-iommu: implement ->alloc_noncoherent Message-ID: <20200926141428.GB10379@lst.de> References: <20200915155122.1768241-1-hch@lst.de> <20200915155122.1768241-18-hch@lst.de> <20200925184622.GB3607091@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200925184622.GB3607091@chromium.org> User-Agent: Mutt/1.5.17 (2007-11-01) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, Sep 25, 2020 at 06:46:22PM +0000, Tomasz Figa wrote: > > +static void *iommu_dma_alloc_noncoherent(struct device *dev, size_t size, > > + dma_addr_t *handle, enum dma_data_direction dir, gfp_t gfp) > > +{ > > + if (!gfpflags_allow_blocking(gfp)) { > > + struct page *page; > > + > > + page = dma_common_alloc_pages(dev, size, handle, dir, gfp); > > + if (!page) > > + return NULL; > > + return page_address(page); > > + } > > + > > + return iommu_dma_alloc_remap(dev, size, handle, gfp | __GFP_ZERO, > > + PAGE_KERNEL, 0); > > iommu_dma_alloc_remap() makes use of the DMA_ATTR_ALLOC_SINGLE_PAGES attribute > to optimize the allocations for devices which don't care about how contiguous > the backing memory is. Do you think we could add an attrs argument to this > function and pass it there? > > As ARM is being moved to the common iommu-dma layer as well, we'll probably > make use of the argument to support the DMA_ATTR_NO_KERNEL_MAPPING attribute to > conserve the vmalloc area. We could probably at it. However I wonder why this is something the drivers should care about. Isn't this really something that should be a kernel-wide policy for a given system?