Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp8448543imu; Tue, 4 Dec 2018 08:31:25 -0800 (PST) X-Google-Smtp-Source: AFSGD/UuV66iqN6pPR396UbpXIxGEM/op9n3whI9Zr22fwBtauVz/efP7U1LCPkEl1c1HQp5+IB/ X-Received: by 2002:a63:6f0d:: with SMTP id k13mr17137564pgc.42.1543941085758; Tue, 04 Dec 2018 08:31:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543941085; cv=none; d=google.com; s=arc-20160816; b=LDaZa5qbMxYKMkja8jU5qvbKq4GUahBD2LS1LxmfjXTq2FH5vhAuqoXGmk4S6aYVYC 41BBPyVO/B7XAHIsXQxICXbBJZqKCxP1J3Wi0orh3n4AIa7FgLH4wMBxlnsdSRc/j5ef lK2hlTG4yqEd9tm3OFxWCUU/cw7xe3hUe/TbDPCrJ05oTsKIibF+/c/ewaMjEBZgDhTI J0+3MOLW/o5UEisDaZLcSQgohYgaZTd4saNYkYI5vaXjTc9kaMxwq74UUyG9Pdt1dXDA IHjICoMwVBBAKdz8TNIKZNbGSCmV3VYuC7UXXVxcPcTFSh0wl4xN7kUZq4Z2DFom64+h Selg== 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; bh=8CVFA+ZGu/FJE60vNUaVB1ODJYXROnM1zp1451JUDzI=; b=Z2A9lcdlabYMjkeiD82O8HQlTeN3URSPetKLGAwPhxlyQXN9I5mtf+7AbGi3Q8xR/Y SNPaX9y9SD4sSVkptze3KFEUSbt8iYBbiUXL8PBkkcSpktN7pBeU8BsgFb+mkIag4ivr 2QbwYc2z0M64v/QfHA4IBNqj7DSXHsH/EDEC+SSYvjBBUCvGu5OlR2VcLasYI4K71zDf +qc/yZAJMdItjr3qIiqEt7IMM5gDK9CAk69oHPUWhO0hDuNOTLxEurDlaAIP5Y23LaI1 WsTMSKGino7xsgvCzdcl+UEPMu5snfuFTG5GXBxe3uq4EiVkqYZp3hEDP7QhFxQNZM++ S8CQ== 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 d8si14293396pgl.386.2018.12.04.08.30.54; Tue, 04 Dec 2018 08:31:25 -0800 (PST) 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 S1726963AbeLDQ20 (ORCPT + 99 others); Tue, 4 Dec 2018 11:28:26 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:36382 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726151AbeLDQ2Z (ORCPT ); Tue, 4 Dec 2018 11:28:25 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CA797A78; Tue, 4 Dec 2018 08:28:24 -0800 (PST) Received: from edgewater-inn.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 984D83F614; Tue, 4 Dec 2018 08:28:24 -0800 (PST) Received: by edgewater-inn.cambridge.arm.com (Postfix, from userid 1000) id 022F71AE0BA0; Tue, 4 Dec 2018 16:28:44 +0000 (GMT) Date: Tue, 4 Dec 2018 16:28:44 +0000 From: Will Deacon To: Nicolas Boichat Cc: Robin Murphy , Christoph Lameter , Vlastimil Babka , Michal Hocko , Matthias Brugger , hch@infradead.org, Matthew Wilcox , Joerg Roedel , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Mel Gorman , Levin Alexander , Huaisheng Ye , Mike Rapoport , linux-arm Mailing List , iommu@lists.linux-foundation.org, lkml , linux-mm@kvack.org, Yong Wu , Tomasz Figa , yingjoe.chen@mediatek.com, Hsin-Yi Wang , Daniel Kurtz Subject: Re: [PATCH v2 0/3] iommu/io-pgtable-arm-v7s: Use DMA32 zone for page tables Message-ID: <20181204162844.GA8169@arm.com> References: <20181111090341.120786-1-drinkcat@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 04, 2018 at 05:37:13PM +0800, Nicolas Boichat wrote: > On Sun, Nov 11, 2018 at 5:04 PM Nicolas Boichat wrote: > > > > This is a follow-up to the discussion in [1], to make sure that the page > > tables allocated by iommu/io-pgtable-arm-v7s are contained within 32-bit > > physical address space. > > > > [1] https://lists.linuxfoundation.org/pipermail/iommu/2018-November/030876.html > > Hi everyone, > > Let's try to summarize here. > > First, we confirmed that this is a regression, and IOMMU errors happen > on 4.19 and linux-next/master on MT8173 (elm, Acer Chromebook R13). > The issue most likely starts from ad67f5a6545f ("arm64: replace > ZONE_DMA with ZONE_DMA32"), i.e. 4.15, and presumably breaks a number > of Mediatek platforms (and maybe others?). > > We have a few options here: > 1. This series [2], that adds support for GFP_DMA32 slab caches, > _without_ adding kmalloc caches (since there are no users of > kmalloc(..., GFP_DMA32)). I think I've addressed all the comments on > the 3 patches, and AFAICT this solution works fine. > 2. genalloc. That works, but unless we preallocate 4MB for L2 tables > (which is wasteful as we usually only need a handful of L2 tables), > we'll need changes in the core (use GFP_ATOMIC) to allow allocating on > demand, and as it stands we'd have no way to shrink the allocation. > 3. page_frag [3]. That works fine, and the code is quite simple. One > drawback is that fragments in partially freed pages cannot be reused > (from limited experiments, I see that IOMMU L2 tables are rarely > freed, so it's unlikely a whole page would get freed). But given the > low number of L2 tables, maybe we can live with that. > > I think 2 is out. Any preference between 1 and 3? I think 1 makes > better use of the memory, so that'd be my preference. But I'm probably > missing something. FWIW, I'm open to any solution at this point, since I'd like to see this regression fixed. (1) does sound better longer-term, but (3) looks pretty much ready to do afaict. Will