Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp2252697pxk; Mon, 14 Sep 2020 08:29:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxe2PUfqJhPNYNla9iSvqh4C0LUiOoGIM7EPweWaX068XSqjvynLW9cElkpliS1d8yjQh7O X-Received: by 2002:a17:906:d7a2:: with SMTP id pk2mr15115144ejb.149.1600097362199; Mon, 14 Sep 2020 08:29:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600097362; cv=none; d=google.com; s=arc-20160816; b=wGPrnjLr8XdFW69yI28xGLd9Yqm+tLURSAoqdw40CpyL4qOcLggBOOB/Q9eT1Y3AaW 7cs76/7BNR6bt1Gy8T8FWPTMQ43XzP0qYl+zrf5zOgOqRZAOqG1FfzfMdA5ECpV277BX ijDraLZa4MHXaHgth5u743lDRDA3DpCg3nNv7QkVhPaxQX9fX8ubh8dseLUgt17YVRgY B/nSA5IZHGXkpKQGj2gkczbw/ixi/mXo3zrEV45PZIjkkmKZ6mvaNQ5VlePn/AhZ9Ua6 eFT5OeksSHhjLaaAdHx6L2xJ7q7+3/4L/jSws0rW0dcaKQRFx7eqQU297CofwWNq5YPY BxfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=7O2Rc307Jq8KkaDn7zbVItvtt/ecHc/too3yP9zxMNw=; b=GqOElzLAeyfdpf/OVrhFnp9vQFJpbkGkmm22FkjrNF36AeFDD65HCYx7e3oxu+v9r2 F2gJXTa9arTaEdnysIs6napyXDRoEsRk89MqWwY2uPprA1rrlge/Hj927CxTVUf6RYp5 k+ECipbZP+DOB8wIBJyIP6XB8Tn0KGQkRv2GFKR+C9c8u5E6cqipM8XPrejNsgkwuVK4 elUeitCuXRvOm8JvNOq42TGmNSMaYaEvMU81zjWJ3vYYzYNv4uBtpReV7OyFDFPIU4a0 bAKBUKlXp6tuxkV6rJapZa/BMQ+mZeRzFFkdb75pCpIhqK3aR9mqL8W00vtElLQkW2XB bF0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=M80c+D3B; 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 rh24si7333541ejb.283.2020.09.14.08.28.59; Mon, 14 Sep 2020 08:29:22 -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; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=M80c+D3B; 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 S1726189AbgINP2Q (ORCPT + 99 others); Mon, 14 Sep 2020 11:28:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725992AbgINP0o (ORCPT ); Mon, 14 Sep 2020 11:26:44 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CE965C06174A; Mon, 14 Sep 2020 08:26:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=7O2Rc307Jq8KkaDn7zbVItvtt/ecHc/too3yP9zxMNw=; b=M80c+D3BqJySppi+H3eNYCcnH/ gkfi1LX5tkOxqiYr7vGlDhimfScWmyFoD4H7IZc29yxj59fxiZw4CTf73qE/Frs6kv2D1VP9Z0cDk mxHwC6y23VXZp0GWVeuCJj/TuYsYfRbshYeLxTfn4NkxNbZt/mCYZDG48aAzhZnPSD26Tjx+8/mwu 2BX9yzKsoQKr11uV/Bwnigc9od3UdV8s2rG69+T+l2QU+9l3XPVzWYgBbLqR3TeV+3H8nv+hHYZRQ AbZDHlAxP767K2OWIVLYATsG32mlziFsc93sPs4pmGxH1oa7RFwa/hq19KGZWcLA7yuKXtQ9v35Ul oAwe3FdQ==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kHqN0-0004bK-27; Mon, 14 Sep 2020 15:26:18 +0000 Date: Mon, 14 Sep 2020 16:26:17 +0100 From: Matthew Wilcox To: Christoph Hellwig Cc: Mauro Carvalho Chehab , Thomas Bogendoerfer , "James E.J. Bottomley" , Joonyoung Shim , Seung-Woo Kim , Ben Skeggs , Marek Szyprowski , Tomasz Figa , 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: a saner API for allocating DMA addressable pages v2 Message-ID: <20200914152617.GR6583@casper.infradead.org> References: <20200914144433.1622958-1-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200914144433.1622958-1-hch@lst.de> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Sep 14, 2020 at 04:44:16PM +0200, Christoph Hellwig wrote: > I'm still a little unsure about the API naming, as alloc_pages sort of > implies a struct page return value, but we return a kernel virtual > address. Erm ... dma_alloc_pages() returns a struct page, so is this sentence stale? From patch 14: +struct page *dma_alloc_pages(struct device *dev, size_t size, + dma_addr_t *dma_handle, enum dma_data_direction dir, gfp_t gfp); > The other alternative would be to name the API > dma_alloc_noncoherent, but the whole non-coherent naming seems to put > people off. You say that like it's a bad thing. I think the problem is more that people don't understand what non-coherent means and think they're supporting it when they're not. dma_alloc_manual_flushing()? > As a follow up I plan to move the implementation of the > DMA_ATTR_NO_KERNEL_MAPPING flag over to this framework as well, given > that is also is a fundamentally non coherent allocation. The replacement > for that flag would then return a struct page, as it is allowed to > actually return pages without a kernel mapping as the name suggested > (although most of the time they will actually have a kernel mapping..) If the page doesn't have a kernel mapping, shouldn't it return a PFN or a phys_addr?