Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp672195imu; Thu, 22 Nov 2018 03:43:22 -0800 (PST) X-Google-Smtp-Source: AFSGD/Wf5nAb30k7jTYjtdb8f4sCa5avXoS30SHBfV/KBBQZcs/J9PoRxA44WwHuNtSR5CM2lIq4 X-Received: by 2002:a62:5f07:: with SMTP id t7mr5159080pfb.108.1542887002766; Thu, 22 Nov 2018 03:43:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542887002; cv=none; d=google.com; s=arc-20160816; b=eYy1qT693spRqi5vqn1qONkQfCaVnCmpVbskpfa4LhMINCHHm1f3qYXBGWQY6sZ3Fv b1trdq/23rAdFkng8LBr6/dj8RR2AE/+XS5ydodjUeyv6cS4Jb/D/qOuczzko8W2a/cd 18N9u0AmdQi143I5GlRNbake7c0WLjVAtYu38hs8MwQ7ZWkjLc1ZKtna4RoxqXM4j/2y g/7gcfAC3XvUJ6TOjNJOtmLg5iKIAxmeSL3170sn+7oFHvdbLHAFmNksFZu66GPVJwQm SYObB6Y0vFAxcGuiTSTB5oLr4g3AVtquunIgzdWNXgYQTC+lY5QJozee/vVLeRXLEQwF Cw9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=gY50ASSszLl+1vzvxGdI84lcKB+OUhBjBYlnXec7Dwc=; b=knkyLuf8mcMaLhs7v1aDp0sxuN7bO/lXicLOGABS9Zwswq6qsTYEqybeLvxQPEb8WP RD+g/RBWIohaOpQa0J/a5piYml0rGwY9R4jYfLxDhvRxA4qak0KDaOTPpgmD/V+Yv3Vz LjfBlicjU2gJAtbuHBCvF027IKmoyQfP1wSazPic/h9RLGY4P2rKie2vLpUAFkQSPQma KUoXJ+Ok01d5ArmHHF7lXigU/d84xzAjloIxDgY++LakDBH3Y0AezEIymhL+lNSykZTz wqIA+4yM93FWJ1ifJt6jBd8hkgTifetXZeOjNNHZKt1j9yd7nqwAh+3sUQewedgr2+j+ GvRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="l/Is0Bm7"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c132si37961923pga.597.2018.11.22.03.43.07; Thu, 22 Nov 2018 03:43:22 -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=pass header.i=@chromium.org header.s=google header.b="l/Is0Bm7"; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2403838AbeKVL5y (ORCPT + 99 others); Thu, 22 Nov 2018 06:57:54 -0500 Received: from mail-pl1-f196.google.com ([209.85.214.196]:38658 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728508AbeKVL5y (ORCPT ); Thu, 22 Nov 2018 06:57:54 -0500 Received: by mail-pl1-f196.google.com with SMTP id e5so7928286plb.5 for ; Wed, 21 Nov 2018 17:20:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=gY50ASSszLl+1vzvxGdI84lcKB+OUhBjBYlnXec7Dwc=; b=l/Is0Bm7fq1nYq4Ms2TcRuSPOZjKRBcviK6QkkHBvwP9c5O1X7jRhTTwhWpmAWKSWf +1hMIZR+GXyr0CjpjVQvnIimhANhO9D/+0n0EYxX0eYEGNkdDF1KpH4HjedpD1RM2zZe eehtdQmL/xS57WY8yrL776vlr7hJ7PMXmgS/Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=gY50ASSszLl+1vzvxGdI84lcKB+OUhBjBYlnXec7Dwc=; b=F1XVuIfZgkGAtJHFsg039WOoffsocRIqOG7Ehj6vhmlNby8IA55zLx3kKYLAKoSDGH I50rN8NxLieLiigi15+L3YZB4BgUf+YkB9A7j48/p8gxB8VyIdoY0+nlfOIJyT7aZ9XX 9OqwRyO0H7fiXUYptSGVQMfzJS2I6zk4YvRv90r4SHzhXqJ5EDhIhYkdXnRxBQ/z6V+S z8lK03Ya7L/TwBKQRAn0G1xPMmNRRNDRaZ3TdBw+cw8z8y2PmQof8MIckO2Hdc7X/E/h tLBxsnmKfybsdPR4xBwuYYNdEVnifIpLFFDPF9ltMiWk07p04RwDlobIlaj7hCoyB66R NCEg== X-Gm-Message-State: AA+aEWYhsS34JXduYLo6Fy+qKRWKrPGwvcIDNr91HlwhriYsj2MeF0K1 0ZAZFSlMis8e2tdwN29IlRm8Te4P475xEbhUWL9lbw== X-Received: by 2002:a63:4c04:: with SMTP id z4mr8240260pga.312.1542849657837; Wed, 21 Nov 2018 17:20:57 -0800 (PST) MIME-Version: 1.0 References: <20181111090341.120786-1-drinkcat@chromium.org> <20181111090341.120786-4-drinkcat@chromium.org> <20181121164638.GD24883@arm.com> <20181121180000.GU12932@dhcp22.suse.cz> In-Reply-To: <20181121180000.GU12932@dhcp22.suse.cz> From: Nicolas Boichat Date: Thu, 22 Nov 2018 09:20:46 +0800 Message-ID: Subject: Re: [PATCH v2 3/3] iommu/io-pgtable-arm-v7s: Request DMA32 memory, and improve debugging To: mhocko@kernel.org Cc: Will Deacon , Robin Murphy , Joerg Roedel , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Vlastimil Babka , Mel Gorman , Levin Alexander , Huaisheng Ye , Mike Rapoport , linux-arm Mailing List , iommu@lists.linux-foundation.org, lkml , linux-mm@kvack.org, Yong Wu , Matthias Brugger , Tomasz Figa , yingjoe.chen@mediatek.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 22, 2018 at 2:02 AM Michal Hocko wrote: > > On Wed 21-11-18 16:46:38, Will Deacon wrote: > > On Sun, Nov 11, 2018 at 05:03:41PM +0800, Nicolas Boichat wrote: > > > For level 1/2 pages, ensure GFP_DMA32 is used if CONFIG_ZONE_DMA32 > > > is defined (e.g. on arm64 platforms). > > > > > > For level 2 pages, allocate a slab cache in SLAB_CACHE_DMA32. > > > > > > Also, print an error when the physical address does not fit in > > > 32-bit, to make debugging easier in the future. > > > > > > Fixes: ad67f5a6545f ("arm64: replace ZONE_DMA with ZONE_DMA32") > > > Signed-off-by: Nicolas Boichat > > > --- > > > > > > Changes since v1: > > > - Changed approach to use SLAB_CACHE_DMA32 added by the previous > > > commit. > > > - Use DMA or DMA32 depending on the architecture (DMA for arm, > > > DMA32 for arm64). > > > > > > drivers/iommu/io-pgtable-arm-v7s.c | 20 ++++++++++++++++---- > > > 1 file changed, 16 insertions(+), 4 deletions(-) > > > > > > diff --git a/drivers/iommu/io-pgtable-arm-v7s.c b/drivers/iommu/io-pgtable-arm-v7s.c > > > index 445c3bde04800c..996f7b6d00b44a 100644 > > > --- a/drivers/iommu/io-pgtable-arm-v7s.c > > > +++ b/drivers/iommu/io-pgtable-arm-v7s.c > > > @@ -161,6 +161,14 @@ > > > > > > #define ARM_V7S_TCR_PD1 BIT(5) > > > > > > +#ifdef CONFIG_ZONE_DMA32 > > > +#define ARM_V7S_TABLE_GFP_DMA GFP_DMA32 > > > +#define ARM_V7S_TABLE_SLAB_CACHE SLAB_CACHE_DMA32 > > > +#else > > > +#define ARM_V7S_TABLE_GFP_DMA GFP_DMA > > > +#define ARM_V7S_TABLE_SLAB_CACHE SLAB_CACHE_DMA > > > +#endif > > > > It's a bit grotty that GFP_DMA32 doesn't just map to GFP_DMA on 32-bit > > architectures, since then we wouldn't need this #ifdeffery afaict. > > But GFP_DMA32 should map to GFP_KERNEL on 32b, no? Or what exactly is > going on in here? GFP_DMA32 will fail due to check_slab_flags (aka GFP_SLAB_BUG_MASK before patch 1/3 of this series)... But yes, it may be neater if there was transparent remapping of GFP_DMA32/SLAB_CACHE_DMA32 to GFP_DMA/SLAB_CACHE_DMA on 32-bit arch... > -- > Michal Hocko > SUSE Labs