[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH V2] arm: xen: mm: use __GPF_DMA32 for arm64


  • To: Peng Fan <peng.fan@xxxxxxx>, "sstabellini@xxxxxxxxxx" <sstabellini@xxxxxxxxxx>, "linux@xxxxxxxxxxxxxxx" <linux@xxxxxxxxxxxxxxx>, Catalin Marinas <Catalin.Marinas@xxxxxxx>, "will@xxxxxxxxxx" <will@xxxxxxxxxx>, Robin Murphy <Robin.Murphy@xxxxxxx>
  • From: Julien Grall <Julien.Grall@xxxxxxx>
  • Date: Fri, 30 Aug 2019 08:39:40 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UGT9YH9p6azSMowrxmSwm6trTNZbQTAk5yiLmTrmUiU=; b=D+ZM4jwFHyxjqTX6iGt8vQVolUei0wd/qb/CJka2/3/hYH+zf2i+8L/o6+tAKrbwhhdD2T2CExr3vnRoJEMHoaQk5nZXRtAhOZDiSG9R8l1PA3nTPalvSxE+QzIUwvboOsvLP0hUYIyVD3To4xaQYzB1sokmePwMHmpDo1FMnAwjuBaq2H2iPofaJZ6rP7KnW2ah0Ymy8obuRrTGZn+tip+Vkt0BWhS/T1stlLLg161yhHsgIi/VWo1zNhScjiUgwVRZJ9QjeLY2ThoM+UjJ50MXpSFPz71jn2UQNN9TgIDTpWgOSmtXV5FsHdWbXYBjoBonVSrliGsPsxlAVbabOQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lW9Vy/Y4eDxjZ2/nSlHIPZ1ZMS0Jv39La0yfAXaIcFhKZrmp4lIQnoLScbxkuNCwur0Y3M5ZgVDT86paxOvy2M5Pks7seWaIqHQp1g4n8mnUZLcLg76/aqeKlyyQZTp9EGfgiy4lKus5KHG3RncniwWmZcmCrtQVVFhPQ3D2pEjLHRJzWCO6qOTBZ7zG67wYkcb5bl5J2cxdd7q85U1pyMmHai3rzpERA5pKGjPGQfpLroqLXlfUvxrbtpDGUr22d5m/Zz3Du559kAFF9Zgro4+c1I0ph0UQi1+JgkW2sU0WU1trjw5yUsYl9VRaP7O5rup7hGMcpDjyH1CC+66AIQ==
  • Authentication-results: spf=temperror (sender IP is 63.35.35.123) smtp.mailfrom=arm.com; lists.xenproject.org; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; lists.xenproject.org; dmarc=temperror action=none header.from=arm.com;
  • Authentication-results-original: spf=none (sender IP is ) smtp.mailfrom=Julien.Grall@xxxxxxx;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, nd <nd@xxxxxxx>, dl-linux-imx <linux-imx@xxxxxxx>, "linux-arm-kernel@xxxxxxxxxxxxxxxxxxx" <linux-arm-kernel@xxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Fri, 30 Aug 2019 08:40:07 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: True
  • Original-authentication-results: spf=none (sender IP is ) smtp.mailfrom=Julien.Grall@xxxxxxx;
  • Thread-index: AQHVXtqjidV/KwEkYkeguLx++Vlcn6cTXzGA
  • Thread-topic: [PATCH V2] arm: xen: mm: use __GPF_DMA32 for arm64

Hi Peng,

On 30/08/2019 04:28, Peng Fan wrote:
> From: Peng Fan <peng.fan@xxxxxxx>
> 
> 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 introduce xen_set_gfp_dma for arm32/arm64 and using __GFP_DMA
> for the former and __GFP_DMA32 for the latter.
> 
> Signed-off-by: Peng Fan <peng.fan@xxxxxxx>
> ---
> 
> V2:
>   Follow suggestion from Stefano,
>   introduce static inline void xen_set_gfp_dma(gfp_t *flags) for arm32/arm64, 
> and
>   for arm64 using __GFP_DMA for the former and __GFP_DMA32 for the latter.
> 
>   arch/arm/include/asm/xen/page.h   | 5 +++++
>   arch/arm/xen/mm.c                 | 2 +-
>   arch/arm64/include/asm/xen/page.h | 5 +++++
>   3 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/include/asm/xen/page.h b/arch/arm/include/asm/xen/page.h
> index 31bbc803cecb..d08309c45e6c 100644
> --- a/arch/arm/include/asm/xen/page.h
> +++ b/arch/arm/include/asm/xen/page.h
> @@ -1 +1,6 @@
>   #include <xen/arm/page.h>
> +
> +static inline void xen_set_gfp_dma(gfp_t *flags)
> +{
> +     *flags |= __GFP_DMA;
> +}
> diff --git a/arch/arm/xen/mm.c b/arch/arm/xen/mm.c
> index d33b77e9add3..828f49dc95f9 100644
> --- a/arch/arm/xen/mm.c
> +++ b/arch/arm/xen/mm.c
> @@ -28,7 +28,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;
> +                     xen_set_gfp_dma(&flags);

The name of the helper is quite misleading, this is specific to swiotlb 
yet it gives the impression it can be used everywhere. The helper will 
actually set the flags in order to allocate memory below 4GB.

Also, I saw an e-mail suggesting that __GFP_DMA may be used on Arm64. So 
a user may think using xen_set_gfp_dma() will set _GFP_DMA and not 
_GFP_DMA32.

I know duplication is not great but it feels that duplicating the full 
function (or only the allocation part) would be the best. This would 
require to introduce a new file mm{32,64}.c in the respective arch 
directory.

Cheers,

-- 
Julien Grall
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.