diff mbox

[v4.4-rc8] dmaengine: ioatdma: Squelch framesize warnings

Message ID 1452190050-11296-1-git-send-email-tim.gardner@canonical.com (mailing list archive)
State Changes Requested
Headers show

Commit Message

Tim Gardner Jan. 7, 2016, 6:07 p.m. UTC
From: Tim Gardner <tim.gardner@canonical.com>

  CC [M]  drivers/dma/ioat/prep.o
drivers/dma/ioat/prep.c: In function 'ioat_prep_pqxor':
drivers/dma/ioat/prep.c:682:1: warning: the frame size of 1048 bytes is larger than 1024 bytes [-Wframe-larger-than=]
 }
 ^
drivers/dma/ioat/prep.c: In function 'ioat_prep_pqxor_val':
drivers/dma/ioat/prep.c:714:1: warning: the frame size of 1048 bytes is larger than 1024 bytes [-Wframe-larger-than=]
 }

gcc version 5.3.1 20151219 (Ubuntu 5.3.1-4ubuntu1)

Cc: Vinod Koul <vinod.koul@intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Dave Jiang <dave.jiang@intel.com>
Cc: Prarit Bhargava <prarit@redhat.com>
Cc: Nicholas Mc Guire <der.herr@hofr.at>
Cc: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
---
 drivers/dma/ioat/prep.c | 30 ++++++++++++++++++++++--------
 1 file changed, 22 insertions(+), 8 deletions(-)

Comments

Dan Williams Jan. 7, 2016, 7:45 p.m. UTC | #1
On Thu, Jan 7, 2016 at 10:07 AM,  <tim.gardner@canonical.com> wrote:
> From: Tim Gardner <tim.gardner@canonical.com>
>
>   CC [M]  drivers/dma/ioat/prep.o
> drivers/dma/ioat/prep.c: In function 'ioat_prep_pqxor':
> drivers/dma/ioat/prep.c:682:1: warning: the frame size of 1048 bytes is larger than 1024 bytes [-Wframe-larger-than=]
>  }
>  ^
> drivers/dma/ioat/prep.c: In function 'ioat_prep_pqxor_val':
> drivers/dma/ioat/prep.c:714:1: warning: the frame size of 1048 bytes is larger than 1024 bytes [-Wframe-larger-than=]
>  }
>
> gcc version 5.3.1 20151219 (Ubuntu 5.3.1-4ubuntu1)
>
> Cc: Vinod Koul <vinod.koul@intel.com>
> Cc: Dan Williams <dan.j.williams@intel.com>
> Cc: Dave Jiang <dave.jiang@intel.com>
> Cc: Prarit Bhargava <prarit@redhat.com>
> Cc: Nicholas Mc Guire <der.herr@hofr.at>
> Cc: Jarkko Nikula <jarkko.nikula@linux.intel.com>
> Signed-off-by: Tim Gardner <tim.gardner@canonical.com>
> ---
>  drivers/dma/ioat/prep.c | 30 ++++++++++++++++++++++--------
>  1 file changed, 22 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/dma/ioat/prep.c b/drivers/dma/ioat/prep.c
> index 6bb4a13..ff62763 100644
> --- a/drivers/dma/ioat/prep.c
> +++ b/drivers/dma/ioat/prep.c
> @@ -655,30 +655,41 @@ ioat_prep_pq_val(struct dma_chan *chan, dma_addr_t *pq, dma_addr_t *src,
>                                      flags);
>  }
>
> +static char *ioat_alloc_scf(unsigned int src_cnt)
> +{
> +       if (!src_cnt || src_cnt > MAX_SCF)
> +               return NULL;
> +
> +       return kzalloc(src_cnt, GFP_KERNEL);

We can't do GFP_KERNEL here since prep_pqxor might be called from
non-sleeping contexts, and I don't want to incur this overhead to
every dma operation.

Instead, let's replace this with a static alloc_percpu() allocation
that gets referenced under get_cpu() (preempt disable).
--
To unsubscribe from this list: send the line "unsubscribe dmaengine" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/dma/ioat/prep.c b/drivers/dma/ioat/prep.c
index 6bb4a13..ff62763 100644
--- a/drivers/dma/ioat/prep.c
+++ b/drivers/dma/ioat/prep.c
@@ -655,30 +655,41 @@  ioat_prep_pq_val(struct dma_chan *chan, dma_addr_t *pq, dma_addr_t *src,
 				     flags);
 }
 
+static char *ioat_alloc_scf(unsigned int src_cnt)
+{
+	if (!src_cnt || src_cnt > MAX_SCF)
+		return NULL;
+
+	return kzalloc(src_cnt, GFP_KERNEL);
+}
+
 struct dma_async_tx_descriptor *
 ioat_prep_pqxor(struct dma_chan *chan, dma_addr_t dst, dma_addr_t *src,
 		 unsigned int src_cnt, size_t len, unsigned long flags)
 {
-	unsigned char scf[MAX_SCF];
+	unsigned char *scf;
 	dma_addr_t pq[2];
 	struct ioatdma_chan *ioat_chan = to_ioat_chan(chan);
+	struct dma_async_tx_descriptor *desc;
 
 	if (test_bit(IOAT_CHAN_DOWN, &ioat_chan->state))
 		return NULL;
 
-	if (src_cnt > MAX_SCF)
+	scf = ioat_alloc_scf(src_cnt);
+	if (!scf)
 		return NULL;
 
-	memset(scf, 0, src_cnt);
 	pq[0] = dst;
 	flags |= DMA_PREP_PQ_DISABLE_Q;
 	pq[1] = dst; /* specify valid address for disabled result */
 
-	return src_cnt_flags(src_cnt, flags) > 8 ?
+	desc = src_cnt_flags(src_cnt, flags) > 8 ?
 		__ioat_prep_pq16_lock(chan, NULL, pq, src, src_cnt, scf, len,
 				       flags) :
 		__ioat_prep_pq_lock(chan, NULL, pq, src, src_cnt, scf, len,
 				     flags);
+	kfree(scf);
+	return desc;
 }
 
 struct dma_async_tx_descriptor *
@@ -686,14 +697,16 @@  ioat_prep_pqxor_val(struct dma_chan *chan, dma_addr_t *src,
 		     unsigned int src_cnt, size_t len,
 		     enum sum_check_flags *result, unsigned long flags)
 {
-	unsigned char scf[MAX_SCF];
+	unsigned char *scf;
 	dma_addr_t pq[2];
 	struct ioatdma_chan *ioat_chan = to_ioat_chan(chan);
+	struct dma_async_tx_descriptor *desc;
 
 	if (test_bit(IOAT_CHAN_DOWN, &ioat_chan->state))
 		return NULL;
 
-	if (src_cnt > MAX_SCF)
+	scf = ioat_alloc_scf(src_cnt);
+	if (!scf)
 		return NULL;
 
 	/* the cleanup routine only sets bits on validate failure, it
@@ -701,16 +714,17 @@  ioat_prep_pqxor_val(struct dma_chan *chan, dma_addr_t *src,
 	 */
 	*result = 0;
 
-	memset(scf, 0, src_cnt);
 	pq[0] = src[0];
 	flags |= DMA_PREP_PQ_DISABLE_Q;
 	pq[1] = pq[0]; /* specify valid address for disabled result */
 
-	return src_cnt_flags(src_cnt, flags) > 8 ?
+	desc = src_cnt_flags(src_cnt, flags) > 8 ?
 		__ioat_prep_pq16_lock(chan, result, pq, &src[1], src_cnt - 1,
 				       scf, len, flags) :
 		__ioat_prep_pq_lock(chan, result, pq, &src[1], src_cnt - 1,
 				     scf, len, flags);
+	kfree(scf);
+	return desc;
 }
 
 struct dma_async_tx_descriptor *