Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1241525 > unrolled thread

Re: [PATCH 1/2] dmaengine: hdmac: factorise memset descriptor allocation

Started byVinod Koul <vinod.koul@intel.com>
First post2015-10-07 16:00 +0200
Last post2015-10-09 17:30 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 1/2] dmaengine: hdmac: factorise memset descriptor  allocation Vinod Koul <vinod.koul@intel.com> - 2015-10-07 16:00 +0200
    Re: [PATCH 1/2] dmaengine: hdmac: factorise memset descriptor  allocation Maxime Ripard <maxime.ripard@free-electrons.com> - 2015-10-07 19:40 +0200
      Re: [PATCH 1/2] dmaengine: hdmac: factorise memset descriptor  allocation Vinod Koul <vinod.koul@intel.com> - 2015-10-09 17:30 +0200

#1241525 — Re: [PATCH 1/2] dmaengine: hdmac: factorise memset descriptor allocation

FromVinod Koul <vinod.koul@intel.com>
Date2015-10-07 16:00 +0200
SubjectRe: [PATCH 1/2] dmaengine: hdmac: factorise memset descriptor allocation
Message-ID<qgXqb-6Da-29@gated-at.bofh.it>
On Thu, Oct 01, 2015 at 04:52:37PM +0200, Maxime Ripard wrote:

> +static struct at_desc *atc_create_memset_desc(struct dma_chan *chan,
> +					      dma_addr_t psrc,
> +					      dma_addr_t pdst,
> +					      size_t len)
> +{
> +	struct at_dma_chan *atchan = to_at_dma_chan(chan);
> +	struct at_desc *desc;
> +	size_t xfer_count;
> +
> +	u32 ctrla = ATC_SRC_WIDTH(2) |
> +		ATC_DST_WIDTH(2);

why is this over two lines :)

> +	u32 ctrlb = ATC_DEFAULT_CTRLB | ATC_IEN |
> +		ATC_SRC_ADDR_MODE_FIXED |
> +		ATC_DST_ADDR_MODE_INCR |
> +		ATC_FC_MEM2MEM;
> +
> +	xfer_count = len >> 2;
> +	if (xfer_count > ATC_BTSIZE_MAX) {
> +		dev_err(chan2dev(chan), "%s: buffer is too big\n",
> +			__func__);
> +		return NULL;
> +	}

This is fine, but this is driver limitation. We should really split the
txn to multiple descriptors here..

> @@ -914,46 +953,26 @@ atc_prep_dma_memset(struct dma_chan *chan, dma_addr_t dest, int value,
>  		return NULL;
>  	}
>  
> -	xfer_count = len >> 2;
> -	if (xfer_count > ATC_BTSIZE_MAX) {
> -		dev_err(chan2dev(chan), "%s: buffer is too big\n",
> +	vaddr = dma_pool_alloc(atdma->memset_pool, GFP_ATOMIC, &paddr);

Mostly people use _zalloc variant, any reason why you don't want that

-- 
~Vinod
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1241707

FromMaxime Ripard <maxime.ripard@free-electrons.com>
Date2015-10-07 19:40 +0200
Message-ID<qh0R4-3eS-7@gated-at.bofh.it>
In reply to#1241525

[Multipart message — attachments visible in raw view] — view raw

Hi Vinod,

On Wed, Oct 07, 2015 at 02:54:13PM +0100, Vinod Koul wrote:
> On Thu, Oct 01, 2015 at 04:52:37PM +0200, Maxime Ripard wrote:
> 
> > +static struct at_desc *atc_create_memset_desc(struct dma_chan *chan,
> > +					      dma_addr_t psrc,
> > +					      dma_addr_t pdst,
> > +					      size_t len)
> > +{
> > +	struct at_dma_chan *atchan = to_at_dma_chan(chan);
> > +	struct at_desc *desc;
> > +	size_t xfer_count;
> > +
> > +	u32 ctrla = ATC_SRC_WIDTH(2) |
> > +		ATC_DST_WIDTH(2);
> 
> why is this over two lines :)
> 
> > +	u32 ctrlb = ATC_DEFAULT_CTRLB | ATC_IEN |
> > +		ATC_SRC_ADDR_MODE_FIXED |
> > +		ATC_DST_ADDR_MODE_INCR |
> > +		ATC_FC_MEM2MEM;
> > +
> > +	xfer_count = len >> 2;
> > +	if (xfer_count > ATC_BTSIZE_MAX) {
> > +		dev_err(chan2dev(chan), "%s: buffer is too big\n",
> > +			__func__);
> > +		return NULL;
> > +	}
> 
> This is fine, but this is driver limitation. We should really split the
> txn to multiple descriptors here..

Both these things are actually just copy from the previous code.

I can probably fix the first style issue in this patch, but splitting
the memset descriptors should go in a separate patch.

> 
> > @@ -914,46 +953,26 @@ atc_prep_dma_memset(struct dma_chan *chan, dma_addr_t dest, int value,
> >  		return NULL;
> >  	}
> >  
> > -	xfer_count = len >> 2;
> > -	if (xfer_count > ATC_BTSIZE_MAX) {
> > -		dev_err(chan2dev(chan), "%s: buffer is too big\n",
> > +	vaddr = dma_pool_alloc(atdma->memset_pool, GFP_ATOMIC, &paddr);
> 
> Mostly people use _zalloc variant, any reason why you don't want that

Not necessarily, but I don't need zeroed memory either, since I
overwrite the content right after the allocation.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

[toc] | [prev] | [next] | [standalone]


#1243470

FromVinod Koul <vinod.koul@intel.com>
Date2015-10-09 17:30 +0200
Message-ID<qhHMm-63K-25@gated-at.bofh.it>
In reply to#1241707
On Wed, Oct 07, 2015 at 06:33:17PM +0100, Maxime Ripard wrote:
> > This is fine, but this is driver limitation. We should really split the
> > txn to multiple descriptors here..
> 
> Both these things are actually just copy from the previous code.
> 
> I can probably fix the first style issue in this patch, but splitting
> the memset descriptors should go in a separate patch.

That sounds fine

-- 
~Vinod
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web