Re: [PATCH 3/5] dma-direct: refine dma_direct_alloc zone selection

2018-09-28 Thread Christoph Hellwig
On Fri, Sep 28, 2018 at 10:06:48AM +1000, Benjamin Herrenschmidt wrote: > On Thu, 2018-09-27 at 15:49 +0200, Christoph Hellwig wrote: > > On Thu, Sep 27, 2018 at 11:45:15AM +1000, Benjamin Herrenschmidt wrote: > > > I'm not sure this is entirely right. > > > > > > Let's say the mask is 30 bits. Yo

Re: [PATCH 3/5] dma-direct: refine dma_direct_alloc zone selection

2018-09-27 Thread Benjamin Herrenschmidt
On Thu, 2018-09-27 at 15:49 +0200, Christoph Hellwig wrote: > On Thu, Sep 27, 2018 at 11:45:15AM +1000, Benjamin Herrenschmidt wrote: > > I'm not sure this is entirely right. > > > > Let's say the mask is 30 bits. You will return GFP_DMA32, which will > > fail if you allocate something above 1G (w

[PATCH 3/5] dma-direct: refine dma_direct_alloc zone selection

2018-09-27 Thread Christoph Hellwig
We need to take the DMA offset and encryption bit into account when selecting a zone. User the opportunity to factor out the zone selection into a helper for reuse. Signed-off-by: Christoph Hellwig Reviewed-by: Robin Murphy --- kernel/dma/direct.c | 31 +-- 1 file c

Re: [PATCH 3/5] dma-direct: refine dma_direct_alloc zone selection

2018-09-27 Thread Christoph Hellwig
On Thu, Sep 27, 2018 at 04:38:31PM +0100, Robin Murphy wrote: > On 27/09/18 16:30, Christoph Hellwig wrote: >> On Thu, Sep 27, 2018 at 03:30:20PM +0100, Robin Murphy wrote: +static gfp_t __dma_direct_optimal_gfp_mask(struct device *dev, u64 dma_mask, + u64 *phys_mask) >>>

Re: [PATCH 3/5] dma-direct: refine dma_direct_alloc zone selection

2018-09-27 Thread Robin Murphy
On 27/09/18 16:30, Christoph Hellwig wrote: On Thu, Sep 27, 2018 at 03:30:20PM +0100, Robin Murphy wrote: +static gfp_t __dma_direct_optimal_gfp_mask(struct device *dev, u64 dma_mask, + u64 *phys_mask) +{ + if (force_dma_unencrypted()) + *phys_mask = __dma_to

Re: [PATCH 3/5] dma-direct: refine dma_direct_alloc zone selection

2018-09-27 Thread Christoph Hellwig
On Thu, Sep 27, 2018 at 03:30:20PM +0100, Robin Murphy wrote: >> +static gfp_t __dma_direct_optimal_gfp_mask(struct device *dev, u64 >> dma_mask, >> +u64 *phys_mask) >> +{ >> +if (force_dma_unencrypted()) >> +*phys_mask = __dma_to_phys(dev, dma_mask); >> +else >>

Re: [PATCH 3/5] dma-direct: refine dma_direct_alloc zone selection

2018-09-27 Thread Robin Murphy
On 20/09/18 19:52, Christoph Hellwig wrote: We need to take the DMA offset and encryption bit into account when selecting a zone. User the opportunity to factor out the zone selection into a helper for reuse. Signed-off-by: Christoph Hellwig --- kernel/dma/direct.c | 31 +

Re: [PATCH 3/5] dma-direct: refine dma_direct_alloc zone selection

2018-09-27 Thread Christoph Hellwig
On Thu, Sep 27, 2018 at 11:45:15AM +1000, Benjamin Herrenschmidt wrote: > I'm not sure this is entirely right. > > Let's say the mask is 30 bits. You will return GFP_DMA32, which will > fail if you allocate something above 1G (which is legit for > ZONE_DMA32). And then we will try GFP_DMA further

Re: [PATCH 3/5] dma-direct: refine dma_direct_alloc zone selection

2018-09-26 Thread Benjamin Herrenschmidt
On Thu, 2018-09-20 at 20:52 +0200, Christoph Hellwig wrote: > +static gfp_t __dma_direct_optimal_gfp_mask(struct device *dev, u64 dma_mask, > + u64 *phys_mask) > +{ > + if (force_dma_unencrypted()) > + *phys_mask = __dma_to_phys(dev, dma_mask); > + else > +

[PATCH 3/5] dma-direct: refine dma_direct_alloc zone selection

2018-09-20 Thread Christoph Hellwig
We need to take the DMA offset and encryption bit into account when selecting a zone. User the opportunity to factor out the zone selection into a helper for reuse. Signed-off-by: Christoph Hellwig --- kernel/dma/direct.c | 31 +-- 1 file changed, 21 insertions(+), 1