* [PATCH v4.4-rc8] dmaengine: ioatdma: Squelch framesize warnings
@ 2016-01-07 18:07 tim.gardner
2016-01-07 19:45 ` Dan Williams
2016-01-08 13:35 ` [PATCH v4.4-rc8 v2] " tim.gardner
0 siblings, 2 replies; 9+ messages in thread
From: tim.gardner @ 2016-01-07 18:07 UTC (permalink / raw)
To: dmaengine, linux-kernel
Cc: Tim Gardner, Vinod Koul, Dan Williams, Dave Jiang,
Prarit Bhargava, Nicholas Mc Guire, Jarkko Nikula
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);
+}
+
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 *
--
1.9.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v4.4-rc8] dmaengine: ioatdma: Squelch framesize warnings
2016-01-07 18:07 [PATCH v4.4-rc8] dmaengine: ioatdma: Squelch framesize warnings tim.gardner
@ 2016-01-07 19:45 ` Dan Williams
2016-01-08 13:35 ` [PATCH v4.4-rc8 v2] " tim.gardner
1 sibling, 0 replies; 9+ messages in thread
From: Dan Williams @ 2016-01-07 19:45 UTC (permalink / raw)
To: Tim Gardner
Cc: dmaengine, linux-kernel, Vinod Koul, Dave Jiang, Prarit Bhargava,
Nicholas Mc Guire, Jarkko Nikula
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).
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v4.4-rc8 v2] dmaengine: ioatdma: Squelch framesize warnings
2016-01-07 18:07 [PATCH v4.4-rc8] dmaengine: ioatdma: Squelch framesize warnings tim.gardner
2016-01-07 19:45 ` Dan Williams
@ 2016-01-08 13:35 ` tim.gardner
2016-01-08 16:39 ` Dan Williams
1 sibling, 1 reply; 9+ messages in thread
From: tim.gardner @ 2016-01-08 13:35 UTC (permalink / raw)
To: dmaengine, linux-kernel
Cc: Tim Gardner, Vinod Koul, Dan Williams, Dave Jiang,
Prarit Bhargava, Nicholas Mc Guire, Jarkko Nikula
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>
---
v2 - use per CPU static buffers instead of dynamically allocating memory.
drivers/dma/ioat/prep.c | 33 +++++++++++++++++++++++++++++----
1 file changed, 29 insertions(+), 4 deletions(-)
diff --git a/drivers/dma/ioat/prep.c b/drivers/dma/ioat/prep.c
index 6bb4a13..2c0768b 100644
--- a/drivers/dma/ioat/prep.c
+++ b/drivers/dma/ioat/prep.c
@@ -21,6 +21,8 @@
#include <linux/dmaengine.h>
#include <linux/dma-mapping.h>
#include <linux/prefetch.h>
+#include <linux/percpu.h>
+#include <linux/preempt.h>
#include "../dmaengine.h"
#include "registers.h"
#include "hw.h"
@@ -655,13 +657,25 @@ ioat_prep_pq_val(struct dma_chan *chan, dma_addr_t *pq, dma_addr_t *src,
flags);
}
+/*
+ * The scf scratch buffer is too large for an automatic variable, and
+ * we don't want to take the performance hit for dynamic allocation.
+ * Therefore, define per CPU buffers and disable preemption while in use.
+ */
+static DEFINE_PER_CPU(unsigned char [MAX_SCF], ioat_scf);
+static inline unsigned char *ioat_assign_scratch_buffer(void)
+{
+ return get_cpu_var(ioat_scf);
+}
+
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;
@@ -669,16 +683,21 @@ ioat_prep_pqxor(struct dma_chan *chan, dma_addr_t dst, dma_addr_t *src,
if (src_cnt > MAX_SCF)
return NULL;
+ preempt_disable();
+ scf = ioat_assign_scratch_buffer();
+
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);
+ preempt_enable();
+ return desc;
}
struct dma_async_tx_descriptor *
@@ -686,9 +705,10 @@ 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;
@@ -696,6 +716,9 @@ ioat_prep_pqxor_val(struct dma_chan *chan, dma_addr_t *src,
if (src_cnt > MAX_SCF)
return NULL;
+ preempt_disable();
+ scf = ioat_assign_scratch_buffer();
+
/* the cleanup routine only sets bits on validate failure, it
* does not clear bits on validate success... so clear it here
*/
@@ -706,11 +729,13 @@ ioat_prep_pqxor_val(struct dma_chan *chan, dma_addr_t *src,
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);
+ preempt_enable();
+ return desc;
}
struct dma_async_tx_descriptor *
--
1.9.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v4.4-rc8 v2] dmaengine: ioatdma: Squelch framesize warnings
2016-01-08 13:35 ` [PATCH v4.4-rc8 v2] " tim.gardner
@ 2016-01-08 16:39 ` Dan Williams
2016-01-08 19:25 ` [PATCH v4.4-rc8 v3] " tim.gardner
0 siblings, 1 reply; 9+ messages in thread
From: Dan Williams @ 2016-01-08 16:39 UTC (permalink / raw)
To: Tim Gardner
Cc: dmaengine, linux-kernel, Vinod Koul, Dave Jiang, Prarit Bhargava,
Nicholas Mc Guire, Jarkko Nikula
On Fri, Jan 8, 2016 at 5:35 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>
> ---
>
> v2 - use per CPU static buffers instead of dynamically allocating memory.
>
> drivers/dma/ioat/prep.c | 33 +++++++++++++++++++++++++++++----
> 1 file changed, 29 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/dma/ioat/prep.c b/drivers/dma/ioat/prep.c
> index 6bb4a13..2c0768b 100644
> --- a/drivers/dma/ioat/prep.c
> +++ b/drivers/dma/ioat/prep.c
> @@ -21,6 +21,8 @@
> #include <linux/dmaengine.h>
> #include <linux/dma-mapping.h>
> #include <linux/prefetch.h>
> +#include <linux/percpu.h>
> +#include <linux/preempt.h>
> #include "../dmaengine.h"
> #include "registers.h"
> #include "hw.h"
> @@ -655,13 +657,25 @@ ioat_prep_pq_val(struct dma_chan *chan, dma_addr_t *pq, dma_addr_t *src,
> flags);
> }
>
> +/*
> + * The scf scratch buffer is too large for an automatic variable, and
> + * we don't want to take the performance hit for dynamic allocation.
> + * Therefore, define per CPU buffers and disable preemption while in use.
> + */
> +static DEFINE_PER_CPU(unsigned char [MAX_SCF], ioat_scf);
> +static inline unsigned char *ioat_assign_scratch_buffer(void)
> +{
> + return get_cpu_var(ioat_scf);
This get needs to be paired with a put_cpu_var().
> +}
> +
> 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;
> @@ -669,16 +683,21 @@ ioat_prep_pqxor(struct dma_chan *chan, dma_addr_t dst, dma_addr_t *src,
> if (src_cnt > MAX_SCF)
> return NULL;
>
> + preempt_disable();
preempt_disable() is embedded in get_cpu_var(), no need to open code it.
> + scf = ioat_assign_scratch_buffer();
> +
> 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);
> + preempt_enable();
put_cpu_var()...
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v4.4-rc8 v3] dmaengine: ioatdma: Squelch framesize warnings
2016-01-08 16:39 ` Dan Williams
@ 2016-01-08 19:25 ` tim.gardner
2016-01-08 19:41 ` Dan Williams
0 siblings, 1 reply; 9+ messages in thread
From: tim.gardner @ 2016-01-08 19:25 UTC (permalink / raw)
To: dmaengine, linux-kernel
Cc: Tim Gardner, Vinod Koul, Dan Williams, Dave Jiang,
Prarit Bhargava, Nicholas Mc Guire, Jarkko Nikula
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>
---
v2 - use per CPU static buffers instead of dynamically allocating memory.
v3 - Use get_cpu_var/put_cpu_var which implicitly control preeemption. Drop
the wrapper function that no longer serves any purpose.
drivers/dma/ioat/prep.c | 29 +++++++++++++++++++++++++----
1 file changed, 25 insertions(+), 4 deletions(-)
diff --git a/drivers/dma/ioat/prep.c b/drivers/dma/ioat/prep.c
index 6bb4a13..0bd05c8 100644
--- a/drivers/dma/ioat/prep.c
+++ b/drivers/dma/ioat/prep.c
@@ -21,6 +21,7 @@
#include <linux/dmaengine.h>
#include <linux/dma-mapping.h>
#include <linux/prefetch.h>
+#include <linux/percpu.h>
#include "../dmaengine.h"
#include "registers.h"
#include "hw.h"
@@ -655,13 +656,22 @@ ioat_prep_pq_val(struct dma_chan *chan, dma_addr_t *pq, dma_addr_t *src,
flags);
}
+/*
+ * The scf scratch buffer is too large for an automatic variable, and
+ * we don't want to take the performance hit for dynamic allocation.
+ * Therefore, define per CPU buffers and use get_cpu_var()/put_cpu_var()
+ * to control preemption while the buffer is in use.
+ */
+static DEFINE_PER_CPU(unsigned char [MAX_SCF], ioat_scf);
+
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;
@@ -669,16 +679,21 @@ ioat_prep_pqxor(struct dma_chan *chan, dma_addr_t dst, dma_addr_t *src,
if (src_cnt > MAX_SCF)
return NULL;
+ scf = get_cpu_var(ioat_scf);
+
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);
+
+ put_cpu_var(ioat_scf);
+ return desc;
}
struct dma_async_tx_descriptor *
@@ -686,9 +701,10 @@ 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;
@@ -696,6 +712,8 @@ ioat_prep_pqxor_val(struct dma_chan *chan, dma_addr_t *src,
if (src_cnt > MAX_SCF)
return NULL;
+ scf = get_cpu_var(ioat_scf);
+
/* the cleanup routine only sets bits on validate failure, it
* does not clear bits on validate success... so clear it here
*/
@@ -706,11 +724,14 @@ ioat_prep_pqxor_val(struct dma_chan *chan, dma_addr_t *src,
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);
+
+ put_cpu_var(ioat_scf);
+ return desc;
}
struct dma_async_tx_descriptor *
--
1.9.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v4.4-rc8 v3] dmaengine: ioatdma: Squelch framesize warnings
2016-01-08 19:25 ` [PATCH v4.4-rc8 v3] " tim.gardner
@ 2016-01-08 19:41 ` Dan Williams
2016-01-08 19:58 ` Jiang, Dave
0 siblings, 1 reply; 9+ messages in thread
From: Dan Williams @ 2016-01-08 19:41 UTC (permalink / raw)
To: Tim Gardner
Cc: dmaengine, linux-kernel, Vinod Koul, Dave Jiang, Prarit Bhargava,
Nicholas Mc Guire, Jarkko Nikula
On Fri, Jan 8, 2016 at 11:25 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>
> ---
>
> v2 - use per CPU static buffers instead of dynamically allocating memory.
> v3 - Use get_cpu_var/put_cpu_var which implicitly control preeemption. Drop
> the wrapper function that no longer serves any purpose.
>
> drivers/dma/ioat/prep.c | 29 +++++++++++++++++++++++++----
> 1 file changed, 25 insertions(+), 4 deletions(-)
Looks good to me... but now that I think about it, why is MAX_SCF set
to 1024 in the first place? Certainly it can't be bigger than the
maximum number of sources in a single operation which is 8 to 16.
Even md raid can only support up to 256 devices in an array. So I
think that contstant is bogus.
If we set it to 16 we may not even need the percpu change.
Dave?
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v4.4-rc8 v3] dmaengine: ioatdma: Squelch framesize warnings
2016-01-08 19:41 ` Dan Williams
@ 2016-01-08 19:58 ` Jiang, Dave
2016-01-08 21:48 ` [PATCH v4.4-rc8 v4] " tim.gardner
0 siblings, 1 reply; 9+ messages in thread
From: Jiang, Dave @ 2016-01-08 19:58 UTC (permalink / raw)
To: Williams, Dan J, tim.gardner
Cc: dmaengine, linux-kernel, der.herr, Koul, Vinod, prarit, jarkko.nikula
On Fri, 2016-01-08 at 19:41 +0000, Williams, Dan J wrote:
> On Fri, Jan 8, 2016 at 11:25 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>
> > ---
> >
> > v2 - use per CPU static buffers instead of dynamically allocating
> > memory.
> > v3 - Use get_cpu_var/put_cpu_var which implicitly control
> > preeemption. Drop
> > the wrapper function that no longer serves any purpose.
> >
> > drivers/dma/ioat/prep.c | 29 +++++++++++++++++++++++++----
> > 1 file changed, 25 insertions(+), 4 deletions(-)
>
> Looks good to me... but now that I think about it, why is MAX_SCF set
> to 1024 in the first place? Certainly it can't be bigger than the
> maximum number of sources in a single operation which is 8 to 16.
> Even md raid can only support up to 256 devices in an array. So I
> think that contstant is bogus.
>
> If we set it to 16 we may not even need the percpu change.
>
> Dave?
You are right. It was an arbitrary number I threw in there to address
sparse warning. It can be reduced. 256 seems reasonable.
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v4.4-rc8 v4] dmaengine: ioatdma: Squelch framesize warnings
2016-01-08 19:58 ` Jiang, Dave
@ 2016-01-08 21:48 ` tim.gardner
2016-01-13 13:28 ` Vinod Koul
0 siblings, 1 reply; 9+ messages in thread
From: tim.gardner @ 2016-01-08 21:48 UTC (permalink / raw)
To: dmaengine, linux-kernel
Cc: Tim Gardner, Vinod Koul, Dan Williams, Dave Jiang,
Prarit Bhargava, Nicholas Mc Guire, Jarkko Nikula
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>
---
v2 - use per CPU static buffers instead of dynamically allocating memory.
v3 - Use get_cpu_var/put_cpu_var which implicitly control preeemption. Drop
the wrapper function that no longer serves any purpose.
v4 - According to discussion between Dan Williams and Dave Jiang, MAX_SCF really
only needs to be 256. That is certainly a simpler patch then previous efforts.
Quoting from an email regarding v3:
Dan said, "Looks good to me... but now that I think about it, why is MAX_SCF set
to 1024 in the first place? Certainly it can't be bigger than the
maximum number of sources in a single operation which is 8 to 16.
Even md raid can only support up to 256 devices in an array. So I
think that contstant is bogus.
If we set it to 16 we may not even need the percpu change.
Dave?"
Dave responded, "You are right. It was an arbitrary number I threw in there to address
sparse warning. It can be reduced. 256 seems reasonable. "
drivers/dma/ioat/prep.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/dma/ioat/prep.c b/drivers/dma/ioat/prep.c
index 6bb4a13..243421a 100644
--- a/drivers/dma/ioat/prep.c
+++ b/drivers/dma/ioat/prep.c
@@ -26,7 +26,7 @@
#include "hw.h"
#include "dma.h"
-#define MAX_SCF 1024
+#define MAX_SCF 256
/* provide a lookup table for setting the source address in the base or
* extended descriptor of an xor or pq descriptor
--
2.6.4
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v4.4-rc8 v4] dmaengine: ioatdma: Squelch framesize warnings
2016-01-08 21:48 ` [PATCH v4.4-rc8 v4] " tim.gardner
@ 2016-01-13 13:28 ` Vinod Koul
0 siblings, 0 replies; 9+ messages in thread
From: Vinod Koul @ 2016-01-13 13:28 UTC (permalink / raw)
To: tim.gardner
Cc: dmaengine, linux-kernel, Dan Williams, Dave Jiang,
Prarit Bhargava, Nicholas Mc Guire, Jarkko Nikula
On Fri, Jan 08, 2016 at 02:48:17PM -0700, 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)
Applied, thanks
--
~Vinod
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2016-01-13 13:25 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-07 18:07 [PATCH v4.4-rc8] dmaengine: ioatdma: Squelch framesize warnings tim.gardner
2016-01-07 19:45 ` Dan Williams
2016-01-08 13:35 ` [PATCH v4.4-rc8 v2] " tim.gardner
2016-01-08 16:39 ` Dan Williams
2016-01-08 19:25 ` [PATCH v4.4-rc8 v3] " tim.gardner
2016-01-08 19:41 ` Dan Williams
2016-01-08 19:58 ` Jiang, Dave
2016-01-08 21:48 ` [PATCH v4.4-rc8 v4] " tim.gardner
2016-01-13 13:28 ` Vinod Koul
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.