linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm: xen: mm: use __GPF_DMA32 for arm64
@ 2019-07-09  8:22 Peng Fan
  2019-07-23  3:21 ` Peng Fan
  2019-08-27 12:23 ` Robin Murphy
  0 siblings, 2 replies; 8+ messages in thread
From: Peng Fan @ 2019-07-09  8:22 UTC (permalink / raw)
  To: sstabellini, linux
  Cc: dl-linux-imx, xen-devel, linux-arm-kernel, linux-kernel,
	Peng Fan, van.freenix

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.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
---
 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;
 			break;
 		}
 	}
-- 
2.16.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* RE: [PATCH] arm: xen: mm: use __GPF_DMA32 for arm64
  2019-07-09  8:22 [PATCH] arm: xen: mm: use __GPF_DMA32 for arm64 Peng Fan
@ 2019-07-23  3:21 ` Peng Fan
  2019-08-27  9:27   ` Peng Fan
  2019-08-27 12:23 ` Robin Murphy
  1 sibling, 1 reply; 8+ messages in thread
From: Peng Fan @ 2019-07-23  3:21 UTC (permalink / raw)
  To: sstabellini, linux
  Cc: dl-linux-imx, xen-devel, linux-arm-kernel, linux-kernel, van.freenix

Hi Russell, Stefano

> Subject: [PATCH] arm: xen: mm: use __GPF_DMA32 for arm64

Any comments?

> 
> 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.
> 
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
>  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;
>  			break;
>  		}
>  	}

Thanks,
Peng.

> --
> 2.16.4


^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH] arm: xen: mm: use __GPF_DMA32 for arm64
  2019-07-23  3:21 ` Peng Fan
@ 2019-08-27  9:27   ` Peng Fan
  2019-08-27  9:45     ` Russell King - ARM Linux admin
  0 siblings, 1 reply; 8+ messages in thread
From: Peng Fan @ 2019-08-27  9:27 UTC (permalink / raw)
  To: sstabellini, linux, julien.grall
  Cc: dl-linux-imx, xen-devel, linux-arm-kernel, linux-kernel, van.freenix

Ping again..

+Julien

> Subject: RE: [PATCH] arm: xen: mm: use __GPF_DMA32 for arm64
> 
> Hi Russell, Stefano
> 
> > Subject: [PATCH] arm: xen: mm: use __GPF_DMA32 for arm64
> 
> Any comments?
> 
> >
> > 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.
> >
> > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> > ---
> >  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;
> >  			break;
> >  		}
> >  	}
> 
> Thanks,
> Peng.

Thanks,
Peng.

> 
> > --
> > 2.16.4


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] arm: xen: mm: use __GPF_DMA32 for arm64
  2019-08-27  9:27   ` Peng Fan
@ 2019-08-27  9:45     ` Russell King - ARM Linux admin
  0 siblings, 0 replies; 8+ messages in thread
From: Russell King - ARM Linux admin @ 2019-08-27  9:45 UTC (permalink / raw)
  To: Peng Fan
  Cc: sstabellini, julien.grall, van.freenix, xen-devel, dl-linux-imx,
	linux-arm-kernel, linux-kernel

You need to find someone who is interested in Xen on 32-bit ARM, and
who knows this code - and therefore what impact your change causes.
That isn't me, sorry.

On Tue, Aug 27, 2019 at 09:27:53AM +0000, Peng Fan wrote:
> Ping again..
> 
> +Julien
> 
> > Subject: RE: [PATCH] arm: xen: mm: use __GPF_DMA32 for arm64
> > 
> > Hi Russell, Stefano
> > 
> > > Subject: [PATCH] arm: xen: mm: use __GPF_DMA32 for arm64
> > 
> > Any comments?
> > 
> > >
> > > 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.
> > >
> > > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> > > ---
> > >  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;
> > >  			break;
> > >  		}
> > >  	}
> > 
> > Thanks,
> > Peng.
> 
> Thanks,
> Peng.
> 
> > 
> > > --
> > > 2.16.4
> 
> 
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 12.1Mbps down 622kbps up
According to speedtest.net: 11.9Mbps down 500kbps up

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] arm: xen: mm: use __GPF_DMA32 for arm64
  2019-07-09  8:22 [PATCH] arm: xen: mm: use __GPF_DMA32 for arm64 Peng Fan
  2019-07-23  3:21 ` Peng Fan
@ 2019-08-27 12:23 ` Robin Murphy
  2019-08-28  1:48   ` Peng Fan
  1 sibling, 1 reply; 8+ messages in thread
From: Robin Murphy @ 2019-08-27 12:23 UTC (permalink / raw)
  To: Peng Fan, sstabellini, linux
  Cc: linux-kernel, dl-linux-imx, van.freenix, xen-devel, linux-arm-kernel

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.
> 
> Signed-off-by: Peng Fan <peng.fan@nxp.com>
> ---
>   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.

Robin.

[1] 
https://lore.kernel.org/linux-arm-kernel/20190820145821.27214-1-nsaenzjulienne@suse.de/

>   			break;
>   		}
>   	}
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH] arm: xen: mm: use __GPF_DMA32 for arm64
  2019-08-27 12:23 ` Robin Murphy
@ 2019-08-28  1:48   ` Peng Fan
  2019-08-28 18:09     ` Stefano Stabellini
  0 siblings, 1 reply; 8+ messages in thread
From: Peng Fan @ 2019-08-28  1:48 UTC (permalink / raw)
  To: Robin Murphy, sstabellini, linux
  Cc: linux-kernel, dl-linux-imx, van.freenix, xen-devel, linux-arm-kernel

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.
> >
> > Signed-off-by: Peng Fan <peng.fan@nxp.com>
> > ---
> >   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;
                }
        }

Thanks,
Peng.

> 
> Robin.
> 
> [1]
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flore.ke
> rnel.org%2Flinux-arm-kernel%2F20190820145821.27214-1-nsaenzjulienne%
> 40suse.de%2F&amp;data=02%7C01%7Cpeng.fan%40nxp.com%7C5d2a641b1
> e3f449562f908d72ae95d85%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0
> %7C0%7C637025054169859035&amp;sdata=1ZPGH0gZnvgmlMpX7VrjUNME
> XbEjiv4%2FZ9pYwTQTWxY%3D&amp;reserved=0
> 
> >   			break;
> >   		}
> >   	}
> >

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* RE: [PATCH] arm: xen: mm: use __GPF_DMA32 for arm64
  2019-08-28  1:48   ` Peng Fan
@ 2019-08-28 18:09     ` Stefano Stabellini
  2019-08-29  2:46       ` Peng Fan
  0 siblings, 1 reply; 8+ messages in thread
From: Stefano Stabellini @ 2019-08-28 18:09 UTC (permalink / raw)
  To: Peng Fan
  Cc: Robin Murphy, sstabellini, linux, linux-kernel, dl-linux-imx,
	van.freenix, xen-devel, linux-arm-kernel

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 <peng.fan@nxp.com>
> > > ---
> > >   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.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH] arm: xen: mm: use __GPF_DMA32 for arm64
  2019-08-28 18:09     ` Stefano Stabellini
@ 2019-08-29  2:46       ` Peng Fan
  0 siblings, 0 replies; 8+ messages in thread
From: Peng Fan @ 2019-08-29  2:46 UTC (permalink / raw)
  To: Stefano Stabellini
  Cc: Robin Murphy, linux, linux-kernel, dl-linux-imx, van.freenix,
	xen-devel, linux-arm-kernel

Hi Stefano,

> Subject: RE: [PATCH] arm: xen: mm: use __GPF_DMA32 for arm64
> 
> 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 <peng.fan@nxp.com>
> > > > ---
> > > >   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.

Thanks for your suggestion. I'll use this in V2.

Thanks,
Peng.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-08-29  2:46 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-09  8:22 [PATCH] arm: xen: mm: use __GPF_DMA32 for arm64 Peng Fan
2019-07-23  3:21 ` Peng Fan
2019-08-27  9:27   ` Peng Fan
2019-08-27  9:45     ` Russell King - ARM Linux admin
2019-08-27 12:23 ` Robin Murphy
2019-08-28  1:48   ` Peng Fan
2019-08-28 18:09     ` Stefano Stabellini
2019-08-29  2:46       ` Peng Fan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).