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

From: Dan Williams
Date: Thu Jan 07 2016 - 14:45:20 EST


On Thu, Jan 7, 2016 at 10:07 AM, <tim.gardner@xxxxxxxxxxxxx> wrote:
> From: Tim Gardner <tim.gardner@xxxxxxxxxxxxx>
>
> 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@xxxxxxxxx>
> Cc: Dan Williams <dan.j.williams@xxxxxxxxx>
> Cc: Dave Jiang <dave.jiang@xxxxxxxxx>
> Cc: Prarit Bhargava <prarit@xxxxxxxxxx>
> Cc: Nicholas Mc Guire <der.herr@xxxxxxx>
> Cc: Jarkko Nikula <jarkko.nikula@xxxxxxxxxxxxxxx>
> Signed-off-by: Tim Gardner <tim.gardner@xxxxxxxxxxxxx>
> ---
> 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).