From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS, USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD81FC04EB8 for ; Tue, 4 Dec 2018 14:28:01 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7AEC0206B7 for ; Tue, 4 Dec 2018 14:28:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="QWdiwx+w" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7AEC0206B7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/zLMA4v96jcGeCimImFkPnKjo+gNW4mBVyX0A3yqPJk=; b=QWdiwx+wD1CtQa I89LE9jWb3kxWX786ZXpVUqUtBlRdQuGx+uUGMPGEzbADZMmZFQU+zA96+gyMobvyWAoQ0bOmx/Oy d4MNSnpzjB+d184JfR3VpKdmE3a5SA87x474/RrdN/pToOVICURSWNGB/yb/yWuTkZUTSp8Ngrmgn 8GFemcDekeVsXqIHwxkKtelDVRDTam/4RdygkzkHXKpEoe8gSe4w/NRURKRsg8c9lRF+PdoZU4Z3M pce3DzCVgO73Db2d20lgfaLYzeGu8xBXbShEd8r1jkrjfCbvp531G2Vs3E9sNe1d+T8iwz8kkZ6p7 sMRUXo2HoOX/LaW2yrFg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gUBfx-00056C-Sl; Tue, 04 Dec 2018 14:27:49 +0000 Received: from hch by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1gUBdi-0002rA-TS; Tue, 04 Dec 2018 14:25:30 +0000 Date: Tue, 4 Dec 2018 06:25:30 -0800 From: Christoph Hellwig To: Nicolas Boichat Subject: Re: [PATCH v3, RFC] iommu/io-pgtable-arm-v7s: Use page_frag to request DMA32 memory Message-ID: <20181204142530.GA2917@infradead.org> References: <20181204082300.95106-1-drinkcat@chromium.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20181204082300.95106-1-drinkcat@chromium.org> User-Agent: Mutt/1.9.2 (2017-12-15) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: hch@infradead.org, Michal Hocko , Tomasz Figa , Joerg Roedel , Will Deacon , linux-kernel@vger.kernel.org, Matthew Wilcox , Yong Wu , linux-mm@kvack.org, iommu@lists.linux-foundation.org, Vlastimil Babka , Matthias Brugger , yingjoe.chen@mediatek.com, Christoph Lameter , Robin Murphy , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Dec 04, 2018 at 04:23:00PM +0800, Nicolas Boichat wrote: > IOMMUs using ARMv7 short-descriptor format require page tables > (level 1 and 2) to be allocated within the first 4GB of RAM, even > on 64-bit systems. > > For level 1/2 tables, ensure GFP_DMA32 is used if CONFIG_ZONE_DMA32 > is defined (e.g. on arm64 platforms). > > For level 2 tables (1 KB), we use page_frag to allocate these pages, > as we cannot directly use kmalloc (no slab cache for GFP_DMA32) or > kmem_cache (mm/ code treats GFP_DMA32 as an invalid flag). > > One downside is that we only free the allocated page if all the > 4 fragments (4 IOMMU L2 tables) are freed, but given that we > usually only allocate limited number of IOMMU L2 tables, this > should not have too much impact on memory usage: In the absolute > worst case (4096 L2 page tables, each on their own 4K page), > we would use 16 MB of memory for 4 MB of L2 tables. I think this needs to be documemented in the code. That is move the explanation about into a comment in the code. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel