All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Sinan Kaya <okaya@codeaurora.org>
Cc: dmaengine <dmaengine@vger.kernel.org>,
	Timur Tabi <timur@codeaurora.org>,
	linux-arm-msm@vger.kernel.org,
	linux-arm Mailing List <linux-arm-kernel@lists.infradead.org>,
	Dan Williams <dan.j.williams@intel.com>,
	Vinod Koul <vinod.koul@intel.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] dmaengine: dmatest: add support for memset test
Date: Wed, 28 Jun 2017 11:58:24 +0300	[thread overview]
Message-ID: <CAHp75Vdw2orpkx4C+O6CLHBWOUDrS8rWPuuDV0DzOCqu8kWkGQ@mail.gmail.com> (raw)
In-Reply-To: <1498610786-6090-2-git-send-email-okaya@codeaurora.org>

On Wed, Jun 28, 2017 at 3:46 AM, Sinan Kaya <okaya@codeaurora.org> wrote:
> Introducing memset test into dmatest. This change allows us to test
> memset capable HW using the dmatest test procedure. The new dmatest
> value for memset is 2 and it is not the default value.
>
> Memset support patch shares the same code path as the other dmatest
> code to reuse as much as we can.
>
> The first value inside the source buffer is used as a pattern
> to fill in the destination buffer space.
>
> Prior to running the test, source/destination buffers are initialized
> in the current code.
>
> "The remaining bits are the inverse of a counter which increments by
>  one for each byte address."
>
> Memset test will fill in the upper bits of pattern with the inverse of
> fixed counter value 1 as opposed to an incrementing value in a loop.
>
> An example run is as follows:
>
> echo dma0chan0 > /sys/module/dmatest/parameters/channel
> echo 2 >  /sys/module/dmatest/parameters/dmatest
> echo 2000 >  /sys/module/dmatest/parameters/timeout
> echo 10 >  /sys/module/dmatest/parameters/iterations
> echo 1 >  /sys/module/dmatest/parameters/run

Good someone is developing tests!
My comments below.

>  static void dmatest_init_srcs(u8 **bufs, unsigned int start, unsigned int len,
> +               unsigned int buf_size, bool is_memset)
>  {
>         unsigned int i;
>         u8 *buf;
>
>         for (; (buf = *bufs); bufs++) {
> +               for (i = 0; i < start; i++) {

> +                       unsigned int val = is_memset ? PATTERN_MEMSET_IDX : i;
> +
> +                       buf[i] = PATTERN_SRC | (~val & PATTERN_COUNT_MASK);

> +                       unsigned int val = is_memset ? PATTERN_MEMSET_IDX : i;
> +
>                         buf[i] = PATTERN_SRC | PATTERN_COPY
> +                               | (~val & PATTERN_COUNT_MASK);

> +                       unsigned int val = is_memset ? PATTERN_MEMSET_IDX : i;
> +
> +                       buf[i] = PATTERN_SRC | (~val & PATTERN_COUNT_MASK);

Looks like a candidate now for a helper function

static inline u8 gen_src_value(u8 index, bool is_memset)
{
    u8 val = is_memset ? PATTERN_MEMSET_IDX : i;
    return PATTERN_SRC | (~val & PATTERN_COUNT_MASK);
}

buf[i] = gen_src_value(i, is_memset);
buf[i] = gen_src_value(i, is_memset) | PATTERN_COPY;
buf[i] = gen_src_value(i, is_memset);

> +                       unsigned int val = is_memset ? PATTERN_MEMSET_IDX : i;
> +
> +                       buf[i] = PATTERN_DST | (~val & PATTERN_COUNT_MASK);

> +                       unsigned int val = is_memset ? PATTERN_MEMSET_IDX : i;
> +
>                         buf[i] = PATTERN_DST | PATTERN_OVERWRITE
> +                               | (~val & PATTERN_COUNT_MASK);

> +                       unsigned int val = is_memset ? PATTERN_MEMSET_IDX : i;
> +
> +                       buf[i] = PATTERN_DST | (~val & PATTERN_COUNT_MASK);

Ditto for DST.

> +               unsigned int counter, bool is_srcbuf, bool is_memset)

This is a signal to replace it with

unsigned int flags

#define DMATEST_FL_SRCBUF BIT(0)
#define DMATEST_FL_MEMSET BIT(1)

or alike.

I'm not insisting, just consider an opportunity.

> +               bool is_srcbuf, bool is_memset)

Ditto.

>                 start = ktime_get();
> +
>                 pr_debug("%s: verifying source buffer...\n", current->comm);

The change doesn't belong to the patch.

> +
>                 error_count += dmatest_verify(thread->dsts, dst_off + len,

Ditto.

-- 
With Best Regards,
Andy Shevchenko

WARNING: multiple messages have this Message-ID (diff)
From: andy.shevchenko@gmail.com (Andy Shevchenko)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] dmaengine: dmatest: add support for memset test
Date: Wed, 28 Jun 2017 11:58:24 +0300	[thread overview]
Message-ID: <CAHp75Vdw2orpkx4C+O6CLHBWOUDrS8rWPuuDV0DzOCqu8kWkGQ@mail.gmail.com> (raw)
In-Reply-To: <1498610786-6090-2-git-send-email-okaya@codeaurora.org>

On Wed, Jun 28, 2017 at 3:46 AM, Sinan Kaya <okaya@codeaurora.org> wrote:
> Introducing memset test into dmatest. This change allows us to test
> memset capable HW using the dmatest test procedure. The new dmatest
> value for memset is 2 and it is not the default value.
>
> Memset support patch shares the same code path as the other dmatest
> code to reuse as much as we can.
>
> The first value inside the source buffer is used as a pattern
> to fill in the destination buffer space.
>
> Prior to running the test, source/destination buffers are initialized
> in the current code.
>
> "The remaining bits are the inverse of a counter which increments by
>  one for each byte address."
>
> Memset test will fill in the upper bits of pattern with the inverse of
> fixed counter value 1 as opposed to an incrementing value in a loop.
>
> An example run is as follows:
>
> echo dma0chan0 > /sys/module/dmatest/parameters/channel
> echo 2 >  /sys/module/dmatest/parameters/dmatest
> echo 2000 >  /sys/module/dmatest/parameters/timeout
> echo 10 >  /sys/module/dmatest/parameters/iterations
> echo 1 >  /sys/module/dmatest/parameters/run

Good someone is developing tests!
My comments below.

>  static void dmatest_init_srcs(u8 **bufs, unsigned int start, unsigned int len,
> +               unsigned int buf_size, bool is_memset)
>  {
>         unsigned int i;
>         u8 *buf;
>
>         for (; (buf = *bufs); bufs++) {
> +               for (i = 0; i < start; i++) {

> +                       unsigned int val = is_memset ? PATTERN_MEMSET_IDX : i;
> +
> +                       buf[i] = PATTERN_SRC | (~val & PATTERN_COUNT_MASK);

> +                       unsigned int val = is_memset ? PATTERN_MEMSET_IDX : i;
> +
>                         buf[i] = PATTERN_SRC | PATTERN_COPY
> +                               | (~val & PATTERN_COUNT_MASK);

> +                       unsigned int val = is_memset ? PATTERN_MEMSET_IDX : i;
> +
> +                       buf[i] = PATTERN_SRC | (~val & PATTERN_COUNT_MASK);

Looks like a candidate now for a helper function

static inline u8 gen_src_value(u8 index, bool is_memset)
{
    u8 val = is_memset ? PATTERN_MEMSET_IDX : i;
    return PATTERN_SRC | (~val & PATTERN_COUNT_MASK);
}

buf[i] = gen_src_value(i, is_memset);
buf[i] = gen_src_value(i, is_memset) | PATTERN_COPY;
buf[i] = gen_src_value(i, is_memset);

> +                       unsigned int val = is_memset ? PATTERN_MEMSET_IDX : i;
> +
> +                       buf[i] = PATTERN_DST | (~val & PATTERN_COUNT_MASK);

> +                       unsigned int val = is_memset ? PATTERN_MEMSET_IDX : i;
> +
>                         buf[i] = PATTERN_DST | PATTERN_OVERWRITE
> +                               | (~val & PATTERN_COUNT_MASK);

> +                       unsigned int val = is_memset ? PATTERN_MEMSET_IDX : i;
> +
> +                       buf[i] = PATTERN_DST | (~val & PATTERN_COUNT_MASK);

Ditto for DST.

> +               unsigned int counter, bool is_srcbuf, bool is_memset)

This is a signal to replace it with

unsigned int flags

#define DMATEST_FL_SRCBUF BIT(0)
#define DMATEST_FL_MEMSET BIT(1)

or alike.

I'm not insisting, just consider an opportunity.

> +               bool is_srcbuf, bool is_memset)

Ditto.

>                 start = ktime_get();
> +
>                 pr_debug("%s: verifying source buffer...\n", current->comm);

The change doesn't belong to the patch.

> +
>                 error_count += dmatest_verify(thread->dsts, dst_off + len,

Ditto.

-- 
With Best Regards,
Andy Shevchenko

  reply	other threads:[~2017-06-28  8:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-28  0:46 [PATCH 1/2] dmaengine: qcom_hidma: introduce memset support Sinan Kaya
2017-06-28  0:46 ` Sinan Kaya
2017-06-28  0:46 ` [PATCH 2/2] dmaengine: dmatest: add support for memset test Sinan Kaya
2017-06-28  0:46   ` Sinan Kaya
2017-06-28  8:58   ` Andy Shevchenko [this message]
2017-06-28  8:58     ` Andy Shevchenko
2017-06-29  1:54     ` Sinan Kaya
2017-06-29  1:54       ` Sinan Kaya

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHp75Vdw2orpkx4C+O6CLHBWOUDrS8rWPuuDV0DzOCqu8kWkGQ@mail.gmail.com \
    --to=andy.shevchenko@gmail.com \
    --cc=dan.j.williams@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=okaya@codeaurora.org \
    --cc=timur@codeaurora.org \
    --cc=vinod.koul@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.