All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Williams <dan.j.williams-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: "Verma,
	Vishal L"
	<vishal.l.verma-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: "Brice.Goglin-MZpvjPyXg2s@public.gmane.org"
	<Brice.Goglin-MZpvjPyXg2s@public.gmane.org>,
	"dave.hansen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org"
	<dave.hansen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
	"linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org"
	<linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org>
Subject: Re: [ndctl PATCH 2/2] libdaxctl: fix device reconfiguration with builtin drivers
Date: Wed, 4 Sep 2019 14:01:31 -0700	[thread overview]
Message-ID: <CAPcyv4inooSbqCaAXJ4KzwVMxcDpfKpMD2QG5aXOP_sKnFy6UQ@mail.gmail.com> (raw)
In-Reply-To: <be47815b3d454ce76a81799ba355b5579713c916.camel-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>

On Wed, Sep 4, 2019 at 1:27 PM Verma, Vishal L <vishal.l.verma-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> wrote:
>
> On Tue, 2019-09-03 at 19:20 -0700, Dan Williams wrote:
> >
> > > +static int try_kmod_builtin(struct daxctl_dev *dev, const char *mod_name)
> > > +{
> > > +       const char *devname = daxctl_dev_get_devname(dev);
> > > +       struct daxctl_ctx *ctx = daxctl_dev_get_ctx(dev);
> > > +       struct kmod_module *kmod;
> > > +       int rc = -ENXIO;
> > > +
> > > +       rc = kmod_module_new_from_name(ctx->kmod_ctx, mod_name, &kmod);
> > > +       if (rc < 0) {
> > > +               err(ctx, "%s: failed getting module for: %s: %s\n",
> > > +                       devname, mod_name, strerror(-rc));
> > > +               return rc;
> > > +       }
> > > +
> > > +       if (kmod_module_get_initstate(kmod) != KMOD_MODULE_BUILTIN)
> > > +               return -ENXIO;
> > > +
> > > +       dbg(ctx, "%s inserting module: %s\n", devname,
> > > +               kmod_module_get_name(kmod));
> > > +       rc = kmod_module_probe_insert_module(kmod,
> > > +                       KMOD_PROBE_APPLY_BLACKLIST,
> > > +                       NULL, NULL, NULL, NULL);
> > > +       if (rc < 0) {
> > > +               err(ctx, "%s: insert failure: %d\n", devname, rc);
> > > +               return rc;
> > > +       }
> > > +       dev->module = kmod;
> > > +
> > > +       return 0;
> > > +}
> > > +
> > >  static int daxctl_insert_kmod_for_mode(struct daxctl_dev *dev,
> > >                 const char *mod_name)
> > >  {
> > > @@ -877,6 +908,8 @@ static int daxctl_insert_kmod_for_mode(struct daxctl_dev *dev,
> > >         int rc = -ENXIO;
> > >
> > >         if (dev->kmod_list == NULL) {
> >
> > Hmm, why wait until now to check if this list is NULL. How about fall
> > back to kmod_module_new_from_name() at to_module_list() time? That
> > would seem to simplify this follow up routine to not need to worry
> > about working around a NULL list.
>
> So we moved the list checking to later in the process around v4 of the
> original series, so that we don't unnecessarily fail add_dax_dev() if
> for some reason a list wasn't created.

Ah true, I forgot that wrinkle, however...

> Also, we use mod_name = dax_modules[mode] during an 'enable' to
> determine the module name to use for the fallback - we wouldn't have
> this at add_dax_dev() time.

Since modalias is already not reliable it seems the implementation
should go ahead never do module lookups and just do everything based
on module names.

In other words the libndctl panacea of not needing to hard code module
names is already lost in libdaxctl land. If the code drops modalias
usage does that clean up some of these flows?

  parent reply	other threads:[~2019-09-04 21:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-04  1:08 [ndctl PATCH 1/2] libdaxctl: fix the system-ram capability check Vishal Verma
2019-09-04  1:08 ` [ndctl PATCH 2/2] libdaxctl: fix device reconfiguration with builtin drivers Vishal Verma
2019-09-04  2:20   ` Dan Williams
     [not found]     ` <CAPcyv4ipdLhKSUVZ-U3ZFpcuw=tJJTq1ZW5x6vJ-bJNReyjJbQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-09-04 20:27       ` Verma, Vishal L
     [not found]         ` <be47815b3d454ce76a81799ba355b5579713c916.camel-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2019-09-04 21:01           ` Dan Williams [this message]
     [not found]             ` <CAPcyv4inooSbqCaAXJ4KzwVMxcDpfKpMD2QG5aXOP_sKnFy6UQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2019-09-04 21:17               ` Verma, Vishal L
     [not found]                 ` <25878b6903086ee20d332a02cd784065d93cea61.camel-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2019-09-04 21:39                   ` Dan Williams
     [not found]   ` <20190904010819.11012-2-vishal.l.verma-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2019-09-04 17:30     ` Brice Goglin
2019-09-04  2:21 ` [ndctl PATCH 1/2] libdaxctl: fix the system-ram capability check 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=CAPcyv4inooSbqCaAXJ4KzwVMxcDpfKpMD2QG5aXOP_sKnFy6UQ@mail.gmail.com \
    --to=dan.j.williams-ral2jqcrhueavxtiumwx3w@public.gmane.org \
    --cc=Brice.Goglin-MZpvjPyXg2s@public.gmane.org \
    --cc=dave.hansen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
    --cc=linux-nvdimm-hn68Rpc1hR1g9hUCZPvPmw@public.gmane.org \
    --cc=vishal.l.verma-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    /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.