All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vishal Verma <vishal@kernel.org>
To: Dan Williams <dan.j.williams@intel.com>,
	Vishal Verma <vishal.l.verma@intel.com>
Cc: "linux-nvdimm@lists.01.org" <linux-nvdimm@lists.01.org>
Subject: Re: [ndctl PATCH v2 2/6] libndctl: add error injection related interfaces
Date: Sat, 14 Oct 2017 21:35:56 -0600	[thread overview]
Message-ID: <1508038556.31494.2.camel@kernel.org> (raw)
In-Reply-To: <CAPcyv4g3YK--W1dmnA=J-FkS7RALTRNz1rgGDXpUgSz13ALnDg@mail.gmail.com>

On Fri, 2017-10-13 at 16:07 -0700, Dan Williams wrote:
> On Thu, Oct 12, 2017 at 5:10 PM, Vishal Verma <vishal.l.verma@intel.c
> om> wrote:
> > Add interfaces to enable error injection commands. Add nfit
> > specific
> > error injection helpers in ndctl/lib/nfit.c, and generic wrappers
> > for
> > them in libndctl.
> > 
> > Cc: Dan Williams <dan.j.williams@intel.com>
> > Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
> > ---
> >  ndctl/lib/Makefile.am  |   1 +
> >  ndctl/lib/inject.c     | 391
> > +++++++++++++++++++++++++++++++++++++++++++++++++
> >  ndctl/lib/libndctl.c   |  47 +-----
> >  ndctl/lib/libndctl.sym |   9 ++
> >  ndctl/lib/nfit.c       |  89 +++++++++++
> >  ndctl/lib/private.h    |  53 +++++++
> >  ndctl/libndctl-nfit.h  |   2 +
> >  ndctl/libndctl.h.in    |  23 +++
> >  8 files changed, 573 insertions(+), 42 deletions(-)
> >  create mode 100644 ndctl/lib/inject.c
> > 
> > diff --git a/ndctl/lib/Makefile.am b/ndctl/lib/Makefile.am
> > index 9a7734d..3a6024e 100644
> > --- a/ndctl/lib/Makefile.am
> > +++ b/ndctl/lib/Makefile.am
> > @@ -18,6 +18,7 @@ libndctl_la_SOURCES =\
> >         ../../util/sysfs.c \
> >         ../../util/sysfs.h \
> >         dimm.c \
> > +       inject.c \
> >         libndctl.c
> > 
> >  libndctl_la_LIBADD =\
> > diff --git a/ndctl/lib/inject.c b/ndctl/lib/inject.c
> > new file mode 100644
> > index 0000000..2660384
> > --- /dev/null
> > +++ b/ndctl/lib/inject.c
> > @@ -0,0 +1,391 @@
> > +/*
> > + * Copyright (c) 2014-2017, Intel Corporation.
> > + *
> > + * This program is free software; you can redistribute it and/or
> > modify it
> > + * under the terms and conditions of the GNU Lesser General Public
> > License,
> > + * version 2.1, as published by the Free Software Foundation.
> > + *
> > + * This program is distributed in the hope it will be useful, but
> > WITHOUT ANY
> > + * WARRANTY; without even the implied warranty of MERCHANTABILITY
> > or FITNESS
> > + * FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
> > License for
> > + * more details.
> > + */
> > +#include <stdlib.h>
> > +#include <limits.h>
> > +#include <util/list.h>
> > +#include <util/size.h>
> > +#include <ndctl/libndctl.h>
> > +#include <ccan/list/list.h>
> > +#include <ndctl/libndctl-nfit.h>
> > +#include <ccan/short_types/short_types.h>
> > +#include "private.h"
> > +
> > +NDCTL_EXPORT int ndctl_bus_has_error_injection(struct ndctl_bus
> > *bus)
> > +{
> > +       /* Currently, only nfit buses have error injection */
> > +       if (!bus || !ndctl_bus_has_nfit(bus))
> > +               return 0;
> > +
> > +       if (ndctl_bus_is_nfit_cmd_supported(bus,
> > NFIT_CMD_ARS_INJECT_SET) &&
> > +               ndctl_bus_is_nfit_cmd_supported(bus,
> > NFIT_CMD_ARS_INJECT_GET) &&
> > +               ndctl_bus_is_nfit_cmd_supported(bus,
> > NFIT_CMD_ARS_INJECT_CLEAR))
> > +               return 1;
> > +
> > +       return 0;
> > +}
> > +
> > +NDCTL_EXPORT void ndctl_namespace_get_injection_bounds(
> > +               struct ndctl_namespace *ndns, unsigned long long
> > *ns_offset,
> > +               unsigned long long *ns_size)
> > +{
> 
> This routine should have an error code because the resource values
> are
> root-only, but I think a better solution is to just not NDCTL_EXPORT
> it since it's only used internally in the library. In fact, if you
> didn't find a use case for a new library call in the error injection
> command then we should make it internal-only until an external user
> shows up.
> 
> Are there any other commands like this?

Agreed that we should just remove the NDCTL_EXPORT for this. I was
using it from the inject-error code, but in the last round of
refactoring, that usage disappeared, and the export lingered..
Can you fix it while applying or shall I resend?

I don't think there are other exported functions like this that aren't
used outside the library.

> _______________________________________________
> Linux-nvdimm mailing list
> Linux-nvdimm@lists.01.org
> https://lists.01.org/mailman/listinfo/linux-nvdimm

_______________________________________________
Linux-nvdimm mailing list
Linux-nvdimm@lists.01.org
https://lists.01.org/mailman/listinfo/linux-nvdimm

  reply	other threads:[~2017-10-15  3:32 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-13  0:09 [ndctl PATCH v2 0/6] add an inject-error command to ndctl Vishal Verma
2017-10-13  0:09 ` [ndctl PATCH v2 1/6] libndctl: add APIs to get scrub count and to wait for a scrub Vishal Verma
2017-10-13 23:01   ` Dan Williams
2017-10-13  0:10 ` [ndctl PATCH v2 2/6] libndctl: add error injection related interfaces Vishal Verma
2017-10-13 23:07   ` Dan Williams
2017-10-15  3:35     ` Vishal Verma [this message]
2017-10-13  0:10 ` [ndctl PATCH v2 3/6] ndctl: add an inject-error command Vishal Verma
2017-10-13 22:24   ` Dan Williams
2017-10-13  0:10 ` [ndctl PATCH v2 4/6] ndctl/test: add a new unit test for inject-error Vishal Verma
2017-10-13 23:09   ` Dan Williams
2017-10-13  0:10 ` [ndctl PATCH v2 5/6] ndctl/test: update existing unit tests to use inject-error Vishal Verma
2017-10-13  0:10 ` [ndctl PATCH v2 6/6] ndctl/test: add a new unit test for BTT error clearing Vishal Verma
2017-10-13 23:12   ` Dan Williams

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=1508038556.31494.2.camel@kernel.org \
    --to=vishal@kernel.org \
    --cc=dan.j.williams@intel.com \
    --cc=linux-nvdimm@lists.01.org \
    --cc=vishal.l.verma@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.