Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1209056ybl; Wed, 28 Aug 2019 11:11:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqwRstVawXhtZbV0Sd47zqb8HBIim8/HoGCyOvQCCVgNfDxG9wnWmTOtaKk35J7iNEeMbJ4B X-Received: by 2002:a17:902:e48d:: with SMTP id cj13mr5539848plb.177.1567015887096; Wed, 28 Aug 2019 11:11:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567015887; cv=none; d=google.com; s=arc-20160816; b=m/qXoPqfVQUxYsBePX+u8+K6TKjymxNv4LsTyeF8WABjDDNT6O21NmopCepCochaaS 9cRp4c5Yk1pV5pAjHLqZ6ntNQdG0NsuWKh6pWWcH4AyDrzK2G918TOGRG5JJ1BIg38mE li3oS1nMSSQ24rGoGYdQ6R6gEP53+XpyVMv4tZ2nt2JNNkt3JhOFUGCaqhhea9+wohpJ vdpmhcTPZTkc0MU0/vG7uAlfVrLVZ15AciHu9wzL+GxvfPsjTDTmmZbeSZsJrIgrYHod MgLJpWsFcmEnQsMV3Wg5ECjfiOcP7mc9Se38wyK3rlIu+AC2E6WzRjo2cRUtOG76sMwt Oi2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature; bh=LIo2AJxCgfe47Ko0+TVhTXH5dDVB9qmvGNYRQuzLr+c=; b=Xc9bg6RGDDeVElXtLq7O5ISb0ghHCOP0oCy2rSdptnF81MfEII+sPcJaoGyiy39drm FtPFnENJGwP3ykZPbnKO7z6/WkspW3V3ezjrIG0lJOmF9ZCxPA0J33pZCe/m6dYd5bRh INk+DRD3Mv9VzdTsAoeEnQip7nmLf/771J05zW/ztc0r+0awX+tX3HDvwQ2Dca9kDpDk QZ1Kg1ZgCycnVHjx6zgSXY3oXEEbfK1ud4ZKTBHI3yxzSKXTqyHHTmvXIQ7TF40FvGwz 3HIBi7q8Ggh6333E8EGb/M0K1eWMff7t178k5o8i0jFsetoCEsyg6FY88YifblKryKT5 2/ZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=SPT3DChX; 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q2si9107pjq.31.2019.08.28.11.11.11; Wed, 28 Aug 2019 11:11:27 -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=pass header.i=@kernel.org header.s=default header.b=SPT3DChX; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726877AbfH1SJt (ORCPT + 99 others); Wed, 28 Aug 2019 14:09:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:51990 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726554AbfH1SJs (ORCPT ); Wed, 28 Aug 2019 14:09:48 -0400 Received: from localhost (c-67-164-102-47.hsd1.ca.comcast.net [67.164.102.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0953F2053B; Wed, 28 Aug 2019 18:09:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567015787; bh=pEW7d4+ki1j7cGrysUa/rs6+n6aWIK6WXN6/tbYAFzs=; h=Date:From:To:cc:Subject:In-Reply-To:References:From; b=SPT3DChX1H83A9Qle/0AqSTbAk6v+FbOYww2pgDUZeRbOYCEyK/D4OEH5eWuzjVuC xDRQFHaR+yKsCIOSiA8B8PhK8UDu1KCgDFfj4b4ahORsC/TvPnQROWaAKyTMWTCALu t81UTiYo2w495kttG20MKcBuBREwFON4EDlYJMPY= Date: Wed, 28 Aug 2019 11:09:46 -0700 (PDT) From: Stefano Stabellini X-X-Sender: sstabellini@sstabellini-ThinkPad-T480s To: Peng Fan cc: Robin Murphy , "sstabellini@kernel.org" , "linux@armlinux.org.uk" , "linux-kernel@vger.kernel.org" , dl-linux-imx , "van.freenix@gmail.com" , "xen-devel@lists.xenproject.org" , "linux-arm-kernel@lists.infradead.org" Subject: RE: [PATCH] arm: xen: mm: use __GPF_DMA32 for arm64 In-Reply-To: Message-ID: References: <20190709083729.11135-1-peng.fan@nxp.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 28 Aug 2019, Peng Fan wrote: > Hi Robin, > > > Subject: Re: [PATCH] arm: xen: mm: use __GPF_DMA32 for arm64 > > > > On 09/07/2019 09:22, Peng Fan wrote: > > > arm64 shares some code under arch/arm/xen, including mm.c. > > > However ZONE_DMA is removed by commit > > > ad67f5a6545("arm64: replace ZONE_DMA with ZONE_DMA32"). > > > So to ARM64, need use __GFP_DMA32. Hi Peng, Sorry for being so late in replying, this email got lost in the noise. > > > Signed-off-by: Peng Fan > > > --- > > > arch/arm/xen/mm.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/arch/arm/xen/mm.c b/arch/arm/xen/mm.c index > > > e1d44b903dfc..a95e76d18bf9 100644 > > > --- a/arch/arm/xen/mm.c > > > +++ b/arch/arm/xen/mm.c > > > @@ -27,7 +27,7 @@ unsigned long xen_get_swiotlb_free_pages(unsigned > > > int order) > > > > > > for_each_memblock(memory, reg) { > > > if (reg->base < (phys_addr_t)0xffffffff) { > > > - flags |= __GFP_DMA; > > > + flags |= __GFP_DMA | __GFP_DMA32; > > > > Given the definition of GFP_ZONE_BAD, I'm not sure this combination of flags > > is strictly valid, but rather is implicitly reliant on only one of those zones ever > > actually existing. As such, it seems liable to blow up if the plans to add > > ZONE_DMA to arm64[1] go ahead. > > How about this, or do you have any suggestions? > diff --git a/arch/arm/xen/mm.c b/arch/arm/xen/mm.c > index d33b77e9add3..f61c29a4430f 100644 > --- a/arch/arm/xen/mm.c > +++ b/arch/arm/xen/mm.c > @@ -28,7 +28,11 @@ unsigned long xen_get_swiotlb_free_pages(unsigned int order) > > for_each_memblock(memory, reg) { > if (reg->base < (phys_addr_t)0xffffffff) { > +#ifdef CONFIG_ARM64 > + flags |= __GFP_DMA32; > +#else > flags |= __GFP_DMA; > +#endif > break; > } > } Yes I think this is the way to go, but we are trying not to add any #ifdef CONFIG_ARM64 under arch/arm. Maybe you could introduce a static inline function to set GFP_DMA: static inline void xen_set_gfp_dma(gfp_t *flags) it could be implemented under arch/arm/include/asm/xen/page.h for arm and under arch/arm64/include/asm/xen/page.h for arm64 using __GFP_DMA for the former and __GFP_DMA32 for the latter.