Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3214976imm; Fri, 25 May 2018 01:36:12 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpkHKTS9wy9gdSHM7uu+nB8tL6rg1N4MfVF1A8lNEihzZwzHO0PvHQxmGy1JewHKl/1nuxv X-Received: by 2002:a62:4c53:: with SMTP id z80-v6mr1590076pfa.181.1527237372844; Fri, 25 May 2018 01:36:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527237372; cv=none; d=google.com; s=arc-20160816; b=tbvh8PhfP2qz+2/XnC7dKk5DHJ2nHeUWE+3ypWg58xHPBeB1gyGJaZrqSiTzCmp+/F OBZvF9JzeSpjNCQ2N720dS8H90wnI0GrAegwHJMOULhHxKq6XF+DTBxK65FaEI8eaA6f aryyhqitWKdL6mTb6WDQMInQHz3ACPB7ip/Zwiy2SIYUwrRqVtsZc0JGXVVokwZpR97o k/GNeKwpZEoZi72+GokTAkKSc35bwb0RojGJbMuJIAUhgp1d6u/Nsatl4HNH+xOa/att N5vYCcjaFPA7a9P23sz0oD/gpykshwjCre+xoWvSaYDs2CsZU+aw9flmpspO18f3VD/z urNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=rzJm3nuyBdTdcdDMVvAZw4viFYXFpEJcGoRmLQGEMtc=; b=Yq6MllxkntzfWgrIFPHy4PHj4jkB1U5dfBSWm13EBZQeyPo4hHx0vX12dDAh80S3Nu 1mzitBTJD7R3crz8mNyywWx3HTg4X2UxILNdBGCTrEFzg0dJ4YPHHEexzNz09KqLOPXP Y8na0ma5OE9dyQ7WHyTzzK6JHDBmrCaC4gsxu+CLit/NMa0FmuDHfj9/D+A8p8D8Wy2j Dy7DC1d51gjuhwcEM+7zA1DgIciTqeyC8xrZP9BRlpzqhWqqOvWa6OUKUm0Qje8rZfDQ sSobxVUjdXtfK0UR96uC7BI+qh56wpLL83jULqcqjcyWe8+3d5GEHyNwC/bnJJ0sH2+t V9Xg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ay12-v6si23169834plb.139.2018.05.25.01.35.58; Fri, 25 May 2018 01:36:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965078AbeEYIfp (ORCPT + 99 others); Fri, 25 May 2018 04:35:45 -0400 Received: from verein.lst.de ([213.95.11.211]:35595 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964800AbeEYIfm (ORCPT ); Fri, 25 May 2018 04:35:42 -0400 Received: by newverein.lst.de (Postfix, from userid 2407) id C038868E41; Fri, 25 May 2018 10:41:20 +0200 (CEST) Date: Fri, 25 May 2018 10:41:20 +0200 From: Christoph Hellwig To: christian.koenig@amd.com Cc: Michel =?iso-8859-1?Q?D=E4nzer?= , Christoph Hellwig , iommu@lists.linux-foundation.org, Linux Kernel Mailing List , dri-devel , Konrad Rzeszutek Wilk Subject: Re: [PATCH] swiotlb: Fix inversed DMA_ATTR_NO_WARN test Message-ID: <20180525084120.GA19063@lst.de> References: <20180501132411.2311-1-michel@daenzer.net> <786ca83f-45c4-264b-2aef-d84fb18d3d28@gmail.com> <20180502124151.GA22857@lst.de> <1066dfa2-2f78-815d-c65a-9d09eb35458c@daenzer.net> <20180502162145.GA26787@lst.de> <1cbc4e10-96e6-c222-fb1a-fd7847be5755@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1cbc4e10-96e6-c222-fb1a-fd7847be5755@gmail.com> User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 22, 2018 at 03:13:58PM +0200, Christian K?nig wrote: > Am 02.05.2018 um 18:59 schrieb Michel D?nzer: >> On 2018-05-02 06:21 PM, Christoph Hellwig wrote: >>> On Wed, May 02, 2018 at 04:31:09PM +0200, Michel D?nzer wrote: >>>>> No. __GFP_NOWARN (and gfp_t flags in general) are the wrong interface >>>>> for dma allocations and just cause problems. I actually plan to >>>>> get rid of the gfp_t argument in dma_alloc_attrs sooner, and only >>>>> allow either GFP_KERNEL or GFP_DMA passed in dma_alloc_coherent. >>>> How about GFP_TRANSHUGE_LIGHT? TTM uses that to opportunistically >>>> allocate huge pages (GFP_TRANSHUGE can result in unacceptably long >>>> delays with memory pressure). >>> Well, that is exactly what I don't want drivers to do - same for >>> __GFP_COMP in some drm code. This very much assumes the page allocator >>> is used to back dma allocations, which very often it actually isn't, and >>> any use of magic gfp flags creates a tight coupling of consumers with a >>> specific implementation. >>> >>> In general I can't think of a good reason not to actually use >>> GFP_TRANSHUGE_LIGHT by default in the dma allocator unless >>> DMA_ATTR_ALLOC_SINGLE_PAGES is set. Can you prepare a patch for that? >> I'm afraid I'll have to leave that to somebody else. > > Coming back to this topic once more, sorry for the delay but busy as usual > :) > > What exactly do you mean with "dma allocator" here? The TTM allocator using > the dma_alloc_coherent calls? Or the swiotlb implementation of the calls? dma allocatr in this case: backends for dma_alloc_coherent/ dma_alloc_attrs. Most importantly dma_direct_alloc. But while we're at it I can't actually see any GFP_TRANSHUGE_LIGHT usage in TTM, just plain old GFP_TRANSHUGE.