linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rafael@kernel.org>
To: Daniel Vetter <daniel.vetter@intel.com>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	dri-devel <dri-devel@lists.freedesktop.org>,
	ramalingam.c@intel.com,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Daniel Vetter <daniel.vetter@ffwll.ch>
Subject: Re: [PATCH] drivers/base: use a worker for sysfs unbind
Date: Thu, 13 Dec 2018 12:05:36 +0100	[thread overview]
Message-ID: <CAJZ5v0g9BGP61CT6SSypo+sUa8BbE+cPuqqzwKfKW=b8YNM6Wg@mail.gmail.com> (raw)
In-Reply-To: <CAJZ5v0iWshem3kuurF53gutVJ8jFm_caAbetK2CiSCpyc6ReeQ@mail.gmail.com>

On Thu, Dec 13, 2018 at 11:23 AM Rafael J. Wysocki <rafael@kernel.org> wrote:
>
> On Thu, Dec 13, 2018 at 10:58 AM Daniel Vetter <daniel@ffwll.ch> wrote:

[cut]

> >
> > - Most of these issues are never visible in normal usage, since normally
> >   driver bind/unbind is done from a kthread or model_load/unload, neither
> >   of which is running in the context of that kernfs mutex kernfs_fop_write
> >   holds. That's why I think the task work is the best solution, since it
> >   changes the locking context of the unbind sysfs to match the locking
> >   context of module unload and hotunplug.
>
> I think that using a task work here makes sense.  There is a drawback,
> which is that the original sysfs write will not wait for the driver to
> actually be released before returning to user space AFAICS, but that
> probably isn't a big deal.
>
> Also please note that the patch changes the code flow slightly,
> because passing a non-NULL parent pointer to
> device_release_driver_internal() potentially has side effects, but
> that should not be a big deal either.
>
> > Unfortunately that trick doesn't work for the bind sysfs file, since that way we can't thread the errno value back to userspace.
>
> Right.  That is unless we wait for the operation to complete and check
> the error left behind by it.  That should be doable, but somewhat
> complicated.

That said I'm not really sure if propagating the error to user space
in this case should be expected.  The interface could be defined as
asynchronous to begin with a separate way for user space to check the
status if necessary.  Changing that now may not be practical, though.

  reply	other threads:[~2018-12-13 11:05 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-10  8:46 [PATCH] drivers/base: use a worker for sysfs unbind Daniel Vetter
2018-12-10 10:06 ` Greg Kroah-Hartman
2018-12-10 10:18   ` Daniel Vetter
2018-12-10 10:20     ` Daniel Vetter
2018-12-12 11:08       ` Daniel Vetter
2018-12-12 11:19         ` Greg Kroah-Hartman
2018-12-12 12:40           ` Daniel Vetter
2018-12-13  9:38 ` Rafael J. Wysocki
2018-12-13  9:58   ` Daniel Vetter
2018-12-13 10:23     ` Rafael J. Wysocki
2018-12-13 11:05       ` Rafael J. Wysocki [this message]
2018-12-13 12:36       ` Daniel Vetter
2018-12-13 16:18         ` Rafael J. Wysocki
2018-12-13 16:25           ` Daniel Vetter
2018-12-13 18:09             ` Rafael J. Wysocki
2018-12-17 19:48               ` Daniel Vetter
2018-12-18  0:03                 ` Rafael J. Wysocki

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='CAJZ5v0g9BGP61CT6SSypo+sUa8BbE+cPuqqzwKfKW=b8YNM6Wg@mail.gmail.com' \
    --to=rafael@kernel.org \
    --cc=daniel.vetter@ffwll.ch \
    --cc=daniel.vetter@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ramalingam.c@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 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).