All of lore.kernel.org
 help / color / mirror / Atom feed
From: Li Wang <liwang@redhat.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2] syscalls/mbind0{2,3,4}: Add basic mbind tests
Date: Tue, 23 Jul 2019 15:41:27 +0800	[thread overview]
Message-ID: <CAEemH2dapin31=WrPsA97wgX=2d5rzQy8+D7LVta6nr6BwFN5A@mail.gmail.com> (raw)
In-Reply-To: <20190722150316.27395-1-chrubis@suse.cz>

Hi Cyril,

On Mon, Jul 22, 2019 at 11:03 PM Cyril Hrubis <chrubis@suse.cz> wrote:
> ...
>  create mode 100644 testcases/kernel/syscalls/mbind/mbind.h
>  create mode 100644 testcases/kernel/syscalls/mbind/mbind02.c
>  create mode 100644 testcases/kernel/syscalls/mbind/mbind03.c
>  create mode 100644 testcases/kernel/syscalls/mbind/mbind04.c

Ad Petr commented in the patch V1, Makefile needs updating after
adding libltpnuma, otherwise, these test cases won't build
successfully.

LDFLAGS += -L$(top_builddir)/libs/libltpnuma
LDLIBS  += $(NUMA_LIBS) -lltpnuma

> diff --git a/testcases/kernel/syscalls/mbind/mbind02.c
> b/testcases/kernel/syscalls/mbind/mbind02.c
> ...
> +       TEST(mbind(ptr, size, mode, bm->maskp, bm->size + 1, MPOL_MF_STRICT));
> +
> +       if (TST_RET) {

I think we'd better check if the TST_RET is EIO before getting TPASS?
Otherwise, it will miss the failure with any other errno.

if (TST_ERR == EIO) {
        tst_res(TPASS | TTERRNO,
                        "mbind(%s, MPOL_MF_STRICT) node %u",
                         tst_numa_mode_name(mode), node);
} else {
         tst_res(TFAIL | TTERRNO, "mbind(%s, MPOL_MF_STRICT) node %u
failed unexpcted",
                         tst_numa_mode_name(mode), node);
}

> +               tst_res(TPASS | TTERRNO,
> +                       "mbind(%s, MPOL_MF_STRICT) node %u",
> +                       tst_numa_mode_name(mode), node);
> +       } else {
> +               tst_res(TFAIL, "mbind(%s, MPOL_MF_STRICT) node %u succeded",
> +                       tst_numa_mode_name(mode), node);
> +       }
> +
> +       tst_numa_unmap(ptr, size);
> +       numa_free_nodemask(bm);
> +}
> +
> +static void verify_mbind(unsigned int n)
> +{
> +       int mode = n ? MPOL_PREFERRED : MPOL_BIND;

Why not test MPOL_INTERLEAVE for mbind02? I guess it also makes sense
to add here.

> +       .forks_child = 1,

.forks_child is redundant?

> diff --git a/testcases/kernel/syscalls/mbind/mbind03.c b/testcases/kernel/syscalls/mbind/mbind03.c
> new file mode 100644
> index 000000000..f0622b07f
> --- /dev/null
> +++ b/testcases/kernel/syscalls/mbind/mbind03.c
> ...
> +
> +void verify_mbind(unsigned int n)
> +{
> +       int mode = n ? MPOL_PREFERRED : MPOL_BIND;

Adding MPOL_INTERLEAVE?

> +       .forks_child = 1,

remove .forks_child.

> diff --git a/testcases/kernel/syscalls/mbind/mbind04.c
> +++ b/testcases/kernel/syscalls/mbind/mbind04.c
> ...
> +
> +static void verify_policy(unsigned int node, int mode, unsigned flag)
> +{
> +       struct bitmask *bm = numa_allocate_nodemask();
> +       unsigned int i;
> +       void *ptr;
> +       unsigned long size = PAGES_ALLOCATED * page_size;
> +
> +       numa_bitmask_setbit(bm, node);
> +
> +       ptr = tst_numa_map(NULL, size);
> +
> +       TEST(mbind(ptr, size, mode, bm->maskp, bm->size + 1, flag));
> +
> +       if (TST_RET) {
> +               tst_res(TFAIL | TTERRNO,
> +                       "mbind(%s, %s) node %u",
> +                       tst_numa_mode_name(mode), mbind_flag_name(flag), node);

Do numa_free_nodemask(bm) before return?

> +static void verify_mbind(unsigned int n)
> +{
> +       unsigned int i;
> +       int mode = n ? MPOL_PREFERRED : MPOL_BIND;
> +
> +       for (i = 0; i < nodes->cnt; i++) {

I remember there are some ppc64le which have non-continuous numa nodes
in hardware configuration. I'm not sure if that special config will
break the mbind04 test, will update details to you after I run this
test on such a system.

    lscpu
    -----
    Architecture:        ppc64le
    ...
    CPU(s):              128
    Core(s) per socket:  16
    Socket(s):           2
    NUMA node(s):        2
    Model name:          POWER9, altivec supported
    ...
    NUMA node0 CPU(s):   0-63
    NUMA node8 CPU(s):   64-127

--
Regards,
Li Wang

  reply	other threads:[~2019-07-23  7:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-22 15:03 [LTP] [PATCH v2] syscalls/mbind0{2,3,4}: Add basic mbind tests Cyril Hrubis
2019-07-23  7:41 ` Li Wang [this message]
2019-07-23  9:33   ` Cyril Hrubis
2019-07-23  9:48     ` Li Wang

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='CAEemH2dapin31=WrPsA97wgX=2d5rzQy8+D7LVta6nr6BwFN5A@mail.gmail.com' \
    --to=liwang@redhat.com \
    --cc=ltp@lists.linux.it \
    /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.