Received: by 10.192.165.148 with SMTP id m20csp1621608imm; Sat, 28 Apr 2018 01:44:00 -0700 (PDT) X-Google-Smtp-Source: AB8JxZriPbfVT/rPeckissEB0hN4/NNqYohINjkVHqPsx6v7ryZ6YmY/7PuTjrJ1ky/Utt0YyGSf X-Received: by 2002:a17:902:a586:: with SMTP id az6-v6mr5275300plb.210.1524905039922; Sat, 28 Apr 2018 01:43:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524905039; cv=none; d=google.com; s=arc-20160816; b=ugZ2mdUl70hw1V8hP26qgwXgPtrT8/f+PCN3lmWHbkXXpm4nltedM+2m6tbqMFRXFU mlJ6Vnrodf/qaQgBJhkdj4QgL5+s3gNtUXrrNr3xigM/cb+fg7Xr+LyVDO0has5xxugg lbFj9exsl+8mOA13NxMfSib1URd/MrthocEtYDHga1IpM+zQQN0EKq2eNJ+rK+6SYDOT drqyX1Y4abAvMc+UqeTKY57YUOsIhZgfq/b8/GIENSeAKHIh6Iex0nRcietEdIueP+nf +ihjKqN6zVVXFUGl0J0g/PsezbJo+uFSf2XHCUWASUGT5VOUtm50p1j1Ilx5ikP2sZQU TIFQ== 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-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=I6O/1zPKNX5KtsnFY+LIstxJ0snutmoHfSlSTD24mAE=; b=npmipKUPAno3lPgvIxWC6DjowGko00fU1Crcphwm2IGok4RrQ32fP0Oao29lmavd6j R1tiDT1hF0B9nvUY4+2PKzSqCVKQeuW/g05VU8X7SBiTkP5rLPn6LrsBhM3NKSo2SmmE SFFXIN1rBezb0qWfdzI1lWz2c1z5/mAOeepXA2x0uMrrTadHQM4uK/f6hpGcTochGvM2 524RfeDdN/NGup/MVRha3e5f1NGHvs1cuu0M+Ftrl1fw1IUkCw3l4zr7icTkHW+g2VXo N7EFSV4w7EcGCnJVqbpq+g4lO5IVP0MMwvd8uWALOJ+AyJZzBxe9JMNIgEVs5AXME7+y CoGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=SYmfCjP4; 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 e4-v6si3115643pln.331.2018.04.28.01.43.44; Sat, 28 Apr 2018 01:43:59 -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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=SYmfCjP4; 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 S1759686AbeD1Imb (ORCPT + 99 others); Sat, 28 Apr 2018 04:42:31 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:43128 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759620AbeD1Im1 (ORCPT ); Sat, 28 Apr 2018 04:42:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.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:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=I6O/1zPKNX5KtsnFY+LIstxJ0snutmoHfSlSTD24mAE=; b=SYmfCjP4ysJYN4KgUEi5jdAuw 0TEhwR8dJmYdA1pTWmpzxMZLPSRC6GAmn20oyvSYDpDT/Tuf4Z3kd4AGNy+YxzhTOJJjEJLG2yrqc Fi/KjvbJkPPuKMlyuZg8jWIqa25oxyhaoDlR31N+NC5g5QaOyc82icqEjTj4btsulAYdqurFFVXvK Ssi8Z6eoDEwxUwOoK+LbC2b8rRdfARSwwJOg41SIR9FUZkt9OEuPSQZhmyhOh0n719qwPbTRY75JS 8qkgd2KEWKk2MSa+2Uwmr02fB8ozx4VaGmDPHfsVHaLpHPzmwoWaD7hM/3UbL5KMW6UAWUDxE0CrM yU8n3ASsQ==; Received: from hch by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1fCLQz-0005Ru-Rf; Sat, 28 Apr 2018 08:42:21 +0000 Date: Sat, 28 Apr 2018 01:42:21 -0700 From: Christoph Hellwig To: "Luis R. Rodriguez" Cc: Christoph Hellwig , linux-mm@kvack.org, mhocko@kernel.org, cl@linux.com, Jan Kara , matthew@wil.cx, x86@kernel.org, luto@amacapital.net, martin.petersen@oracle.com, jthumshirn@suse.de, broonie@kernel.org, Juergen Gross , linux-spi@vger.kernel.org, Joerg Roedel , linux-scsi@vger.kernel.org, Dan Carpenter , linux-kernel@vger.kernel.org, "lsf-pc@lists.linux-foundation.org" Subject: Re: [LSF/MM TOPIC NOTES] x86 ZONE_DMA love Message-ID: <20180428084221.GD31684@infradead.org> References: <20180426215406.GB27853@wotan.suse.de> <20180427053556.GB11339@infradead.org> <20180427161456.GD27853@wotan.suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180427161456.GD27853@wotan.suse.de> User-Agent: Mutt/1.9.2 (2017-12-15) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 27, 2018 at 04:14:56PM +0000, Luis R. Rodriguez wrote: > But curious, on a standard qemu x86_x64 KVM guest, which of the > drivers do we know for certain *are* being used from the ones > listed? On a KVM guest probably none. But not all the world is relatively sane and standardized VMs unfortunately. > > But even more importantly > > we have plenty driver using it through dma_alloc_* and a small DMA > > mask, and they are in use > > Do we have a list of users for x86 with a small DMA mask? > Or, given that I'm not aware of a tool to be able to look > for this in an easy way, would it be good to find out which > x86 drivers do have a small mask? Basically you'll have to grep for calls to dma_set_mask/ dma_set_coherent_mask/dma_set_mask_and_coherent and their pci_* wrappers with masks smaller 32-bit. Some use numeric values, some use DMA_BIT_MASK and various places uses local variables or struct members to parse them, so finding them will be a bit more work. Nothing a coccinell expert couldn't solve, though :) > > - we actually had a 4.16 regression due to them. > > Ah what commit was the culprit? Is that fixed already? If so what > commit? 66bdb147 ("swiotlb: Use dma_direct_supported() for swiotlb_ops") > > > SCSI is *severely* affected: > > > > Not really. We have unchecked_isa_dma to support about 4 drivers, > > Ah very neat: > > * CONFIG_CHR_DEV_OSST - "SCSI OnStream SC-x0 tape support" > * CONFIG_SCSI_ADVANSYS - "AdvanSys SCSI support" > * CONFIG_SCSI_AHA1542 - "Adaptec AHA1542 support" > * CONFIG_SCSI_ESAS2R - "ATTO Technology's ExpressSAS RAID adapter driver" > > > and less than a hand ful of drivers doing stupid things, which can > > be fixed easily, and just need a volunteer. > > Care to list what needs to be done? Can an eager beaver student do it? Drop the drivers, as in my branch I prepared a while ago would be easiest: http://git.infradead.org/users/hch/misc.git/shortlog/refs/heads/unchecked_isa_dma But unlike the other few aha1542 actually seems to have active users, or at least had recently. I'll need to send this out as a RFC, but don't really expect it to fly. If it doesn't we'll need to enhance swiotlb to support a ISA DMA pool in addition to current 32-bit DMA pool, and also convert aha1542 to use the DMA API. Not really student material. > > > That's the end of the review of all current explicit callers on x86. > > > > > > # dma_alloc_coherent_gfp_flags() and dma_generic_alloc_coherent() > > > > > > dma_alloc_coherent_gfp_flags() and dma_generic_alloc_coherent() set > > > GFP_DMA if if (dma_mask <= DMA_BIT_MASK(24)) > > > > All that code is long gone and replaced with dma-direct. Which still > > uses GFP_DMA based on the dma mask, though - see above. > > And that's mostly IOMMU code, on the alloc() dma_map_ops. It is the dma mapping API, which translates the dma mask to the right zone, and probably is the biggest user of ZONE_DMA in modern systems. Currently there are still various arch and iommu specific implementations of the allocator decisions, but I'm working to consolidate them into common code.