Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp832061imu; Thu, 22 Nov 2018 06:05:56 -0800 (PST) X-Google-Smtp-Source: AFSGD/Vzi8gaO/2UxIW9KItHSXJNWxVXT2t4IIiLR0Mle+4M8nqkibA8okE1leZDd8t6oGhHrFLl X-Received: by 2002:a17:902:b40d:: with SMTP id x13mr724813plr.237.1542895556079; Thu, 22 Nov 2018 06:05:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542895556; cv=none; d=google.com; s=arc-20160816; b=YeljIMOjwowR/tsZgU9D/B4v7m+Zu/pMtN3DpTjCd+8wxzmo5mvbbFOVnAfU6dDSMC +9KwVd0LPAWjEMXm+PMxTFMwfyVUXqDMTMS7lBgUkZ9w7TSf3A7E6J/08fpJxNi17iZ8 es0mhp9d/f3nl1JzhjqW9S8Vc1fmXB3b9SOGuXqW5JcK3D4AJqLkXbWkXZt1Bp70/WRc 730hqY0JpB3yxnESOknjJiZKBG6ctTrF7mFpEwEDUTt0myO5WLAYL4TIOs/+M79xqLqn Rlmo+DKnf1BfAY90CY8JcCcFi78CzsvUCOoP/YsEr+1v2aHwTi3tIdEBSI8iDRXpOIXN YY1g== 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; bh=uJWuAiR0aKRNZpOKfCGpaBuWs/uQvQUdDOIk9CUm6n8=; b=Uplw1xl7AvOeYKcW7h7kq7KqLea+iBvi81jydOfGIhu0sAqEpHTAWsdq3/7vokm7Pr JhhCAZkkOXdhJqQcKLKUm/17oq/RGZEWvX6xfdUAT0qsAh/JFRRyUrEHuEKbjrTsoOTf vtpFwTE3wB/BJpB8iu2ZIevCUqx/ruEhrLDg1rXJPNntrT4ouHmu8CxE4RhLVVmcOGms kU1i5BL007vq1P11dZ8OJUDDS3lJyrzN1SNvIYUN0lXQTjjG/mmXBkLXPap1epPdyoaO pH56On+IZ5GXtsE6G3z0UYtoSRdl2WHAHh9Zpqbilm+b7m9SYj+VJD2FgwVu5Uzgg7CV 9MKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=dI+r2Nk4; 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 s5si39072517pgl.481.2018.11.22.06.05.40; Thu, 22 Nov 2018 06:05:56 -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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=dI+r2Nk4; 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 S2391670AbeKVNNZ (ORCPT + 99 others); Thu, 22 Nov 2018 08:13:25 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:49958 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730127AbeKVNNY (ORCPT ); Thu, 22 Nov 2018 08:13:24 -0500 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=uJWuAiR0aKRNZpOKfCGpaBuWs/uQvQUdDOIk9CUm6n8=; b=dI+r2Nk4sjX8zZvgbHgK9wAnZ +tqq0iMlROZfVnDu9JCx/FwEMIXsBhRXd9FNRRaQCmeIiUAzwp5lKpyYvHTWS7vfhErVc4e8xNze3 v9yY/HmqR7BP4IgLv68s0gUQu2VScIH+/+704DjLZwse6b08RicTufFhDGzDAVKM281zdn+/JapU/ Ut+oBCUJcBS4XTD5BhIotY4RBQxAa3rysAHIPHySXq5ApDwxSI08lz0BQHRGTuGg7hdzp2hMy22/i zPsfjuaQhvxpLt44XpTE2FCz5mg1UxjT9dPBYnquC3ASSZBaXLLzX7tMNu/VfdjC8S1VovulXd9na ySYvofg6A==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1gPeqU-0007gP-KM; Thu, 22 Nov 2018 02:35:58 +0000 Date: Wed, 21 Nov 2018 18:35:58 -0800 From: Matthew Wilcox To: Robin Murphy Cc: Christopher Lameter , Nicolas Boichat , Will Deacon , Joerg Roedel , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Vlastimil Babka , Michal Hocko , Mel Gorman , Levin Alexander , Huaisheng Ye , Mike Rapoport , linux-arm-kernel@lists.infradead.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Yong Wu , Matthias Brugger , Tomasz Figa , yingjoe.chen@mediatek.com Subject: Re: [PATCH v2 0/3] iommu/io-pgtable-arm-v7s: Use DMA32 zone for page tables Message-ID: <20181122023558.GO3065@bombadil.infradead.org> References: <20181111090341.120786-1-drinkcat@chromium.org> <0100016737801f14-84f1265d-4577-4dcf-ad57-90dbc8e0a78f-000000@email.amazonses.com> <20181121213853.GL3065@bombadil.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 21, 2018 at 10:26:26PM +0000, Robin Murphy wrote: > These are IOMMU page tables, rather than CPU ones, so we're already well > outside arch code - indeed the original motivation of io-pgtable was to be > entirely independent of the p*d types and arch-specific MM code (this Armv7 > short-descriptor format is already "non-native" when used by drivers in an > arm64 kernel). There was quite a lot of explanation missing from this patch description! > There are various efficiency reasons for using regular kernel memory instead > of coherent DMA allocations - for the most part it works well, we just have > the odd corner case like this one where the 32-bit format gets used on > 64-bit systems such that the tables themselves still need to be allocated > below 4GB (although the final output address can point at higher memory by > virtue of the IOMMU in question not implementing permissions and repurposing > some of those PTE fields as extra address bits). > > TBH, if this DMA32 stuff is going to be contentious we could possibly just > rip out the offending kmem_cache - it seemed like good practice for the > use-case, but provided kzalloc(SZ_1K, gfp | GFP_DMA32) can be relied upon to > give the same 1KB alignment and chance of succeeding as the equivalent > kmem_cache_alloc(), then we could quite easily make do with that instead. I think you should look at using the page_frag allocator here. You can use whatever GFP_DMA flags you like.