DPDK patches and discussions
 help / color / mirror / Atom feed
From: David Marchand <david.marchand@redhat.com>
To: David Christensen <drc@linux.vnet.ibm.com>
Cc: dev <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH v4] app/test: add tests for atomic exchanges
Date: Wed, 6 Nov 2019 15:18:34 +0100	[thread overview]
Message-ID: <CAJFAV8xuQfy8xtj1zG8OchBu-8Tt+su_xQ=xLz76TJfoUTMrjA@mail.gmail.com> (raw)
In-Reply-To: <20191018203041.22074-1-drc@linux.vnet.ibm.com>

On Fri, Oct 18, 2019 at 10:31 PM David Christensen
<drc@linux.vnet.ibm.com> wrote:
>
> The test works by creating a token comprised of random data
> and a CRC8 value, using the rte_atomicXX_exchange to exchange
> the new token for a previously generated token, and then
> verifying that the exchanged data is intact (i.e. the CRC8
> is still correct for the data).

Thanks, can you rebase this on master?

>
> Signed-off-by: David Christensen <drc@linux.vnet.ibm.com>
> ---
> v4:
> * Fix build error due to use of variable initialization
>   in "for" statement.
>
> v3:
> * Actually fixed build issue on all platforms caused by
>   misspelling of rte_atomic64_inc
>
> v2:
> * Fixed build issue on all platforms caused by misspelling
>   of rte_atomic64_inc
>
>  app/test/test_atomic.c | 176 ++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 174 insertions(+), 2 deletions(-)
>
> diff --git a/app/test/test_atomic.c b/app/test/test_atomic.c
> index 43be30ec0..858c6d7f9 100644
> --- a/app/test/test_atomic.c
> +++ b/app/test/test_atomic.c
> @@ -1,10 +1,12 @@
>  /* SPDX-License-Identifier: BSD-3-Clause
>   * Copyright(c) 2010-2014 Intel Corporation
> + * Copyright(c) 2019 Arm Limited
>   */
>
>  #include <stdio.h>
>  #include <stdint.h>
>  #include <unistd.h>
> +#include <inttypes.h>
>  #include <sys/queue.h>
>
>  #include <rte_memory.h>
> @@ -13,6 +15,8 @@
>  #include <rte_atomic.h>
>  #include <rte_eal.h>
>  #include <rte_lcore.h>
> +#include <rte_random.h>
> +#include <rte_hash_crc.h>
>
>  #include "test.h"
>
> @@ -20,7 +24,7 @@
>   * Atomic Variables
>   * ================
>   *
> - * - The main test function performs three subtests. The first test
> + * - The main test function performs four subtests. The first test

Let's drop this sentence.
No point in maintaining the number of subtests.

>   *   checks that the usual inc/dec/add/sub functions are working
>   *   correctly:
>   *
> @@ -61,11 +65,26 @@
>   *       atomic_sub(&count, tmp+1);
>   *
>   *   - At the end of the test, the *count* value must be 0.
> + *
> + * - Test "atomic exchange"
> + *
> + *   - Create a 64 bit token that can be tested for data integrity
> + *
> + *   - Invoke ``test_atomic_exchange`` on each lcore.  Before doing
> + *     anything else, the cores wait for a synchronization event.
> + *     Each core then does the follwoing for N iterations:
> + *
> + *       Generate a new token with a data integrity check
> + *       Exchange the new token for previously generated token
> + *       Increment a counter if a corrupt token was received
> + *
> + *   - At the end of the test, the number of corrupted tokens must be 0.
> + *
>   */
>
>  #define NUM_ATOMIC_TYPES 3
>
> -#define N 10000
> +#define N 1000000
>
>  static rte_atomic16_t a16;
>  static rte_atomic32_t a32;
> @@ -216,6 +235,127 @@ test_atomic_dec_and_test(__attribute__((unused)) void *arg)
>         return 0;
>  }
>
> +/*
> + * Helper definitions/variables/functions for
> + * atomic exchange tests
> + */
> +typedef union {
> +       uint16_t u16;
> +       uint8_t  u8[2];
> +} rte_u16_t;
> +
> +typedef union {
> +       uint32_t u32;
> +       uint16_t u16[2];
> +       uint8_t  u8[4];
> +} rte_u32_t;
> +
> +typedef union {
> +       uint64_t u64;
> +       uint32_t u32[2];
> +       uint16_t u16[4];
> +       uint8_t  u8[8];
> +} rte_u64_t;

Please, don't use such names for internal types.
It gives the impression those are EAL types.. but I don't feel like we
need them, so let's just avoid adding them in EAL, now.



-- 
David Marchand


  reply	other threads:[~2019-11-06 14:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20191018182112.115448-1-drc@ibm.com>
2019-10-18 20:30 ` David Christensen
2019-11-06 14:18   ` David Marchand [this message]
2019-11-06 19:57   ` [dpdk-dev] [PATCH v5] " David Christensen
2019-11-06 20:21     ` David Marchand
2019-11-06 21:18     ` [dpdk-dev] [PATCH v6] " David Christensen
2019-11-07 16:42       ` David Marchand

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='CAJFAV8xuQfy8xtj1zG8OchBu-8Tt+su_xQ=xLz76TJfoUTMrjA@mail.gmail.com' \
    --to=david.marchand@redhat.com \
    --cc=dev@dpdk.org \
    --cc=drc@linux.vnet.ibm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).