Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1851403pxk; Sat, 26 Sep 2020 07:16:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwAsZ5uEcuT+ALIzr27BaAP+tCwQ+pDpBSS6tYVUQAIgkDYlVoiXby8q39vmsOQLFKM6Pl8 X-Received: by 2002:a17:906:c2d2:: with SMTP id ch18mr7964501ejb.79.1601129766726; Sat, 26 Sep 2020 07:16:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601129766; cv=none; d=google.com; s=arc-20160816; b=MrB1YO9PmjSoReaZZUtUOsyCJgupfYR0aSQ+1cTjlejWhMTQSBLyMd/xL/8JvSuISW YlBEWHBuS5yAUv6tyGkdi+JgFLLsm4s6bbqqPzQ7oZ8Q72fHRROjMqj8AaUjapZuIYfk RX+v3zuVzbb7IOTtxPRm6e2myvsdRm3PTHMBlY+UmV+cjDAYJIy6zUqpUhJCKRrTFEYP ULCdKduFvlSLgpnSX41AOs6xgVvor9ruitS/yl463+5J/DJo5PwtnFOZpQKWYyE6xmp6 Sc90JJyT9E5H3Fq6ASlKSZlN8msTDrzpv8Nk1QkXBrwhTNUeI4l0ccaF+n4w61X0Td7F sjUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=vpf+OO+ZNeJRLZoLBIBOe71S+Mg/uFqUewJDMvGm+uI=; b=Zbwru4YFo64dyHxMjtUwPM3jO/Q0ULLqZP+30Soa7dSIQuwO/ADEw10cEgvHCIyylW rtz7kJVbS5OYrFkBCvgeCqusYrGcJbst2cKHy8BiD93A+r+LZa5G35D1VeFDAaDDWIW5 TLTc0wVzVIjP2iMQpJlu/MgyxAUDG0c9QmH1Wo4ZJPn9ibeEAJ4hrzfCHHhsrHskR6Xh 4BhpR+VshPX1dqi9lvW9OLIFsMo3Iw9vM+mdJc9YklxXYpoYNZjjBGRtIxi81fgJedNK oXdg/2ggHUVgXs+l0bX20TqAV+XlT856ugxMurmr+jE3+dSC78NSxdE99Pv3U027/n4G ffFA== 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 i22si4060261edy.183.2020.09.26.07.15.43; Sat, 26 Sep 2020 07:16:06 -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 S1729391AbgIZOOh (ORCPT + 99 others); Sat, 26 Sep 2020 10:14:37 -0400 Received: from verein.lst.de ([213.95.11.211]:59292 "EHLO verein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726210AbgIZOOh (ORCPT ); Sat, 26 Sep 2020 10:14:37 -0400 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) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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?