mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@sisk.pl>
To: Tejun Heo <tj@kernel.org>
Cc: Gu Zheng <guz.fnst@cn.fujitsu.com>,
	ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Toshi Kani <toshi.kani@hp.com>,
	LKML <linux-kernel@vger.kernel.org>,
	Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Subject: Re: [PATCH] driver core / ACPI: Avoid device removal locking problems
Date: Wed, 28 Aug 2013 15:24:45 +0200	[thread overview]
Message-ID: <1592448.YZbpON5n7n@vostro.rjw.lan> (raw)
In-Reply-To: <20130828122422.GA18348@mtj.dyndns.org>

On Wednesday, August 28, 2013 08:24:22 AM Tejun Heo wrote:
> Hello, Rafael.
> 
> On Tue, Aug 27, 2013 at 11:45:46PM +0200, Rafael J. Wysocki wrote:
> > I've thought about that a bit over the last several hours and I'm still
> > thinking that that patch is a bit overkill, because it will trigger the
> > restart_syscall() for all cases when device_hotplug_lock is locked, even
> > if they can't lead to any deadlocks.  The only deadlockish situation is
> > when device *removal* is in progress when store_online(), for example,
> > is called.
> > 
> > So to address that particular situation without adding too much overhead for
> > other cases, I've come up with the appended patch (untested for now).
> > 
> > This is how it is supposed to work.
> > 
> > There are three "lock levels" for device hotplug, "normal", "remove"
> > and "weak".  The difference is related to how __lock_device_hotplug()
> > works.  Namely, if device hotplug is currently locked, that function
> > will either block or return false, depending on the "current lock
> > level" and its argument (the "new lock level").  The rules here are
> > that false is returned immediately if the "current lock level" is
> > "remove" and the "new lock level" is "weak".  The function blocks
> > for all other combinations of the two.
> 
> I think this is going way too far and a massive overkill in terms of
> complexity, which is way more important than for doing some
> restart_syscall loops during some rare sysfs file access, which isn't
> gonna be that common anyway.  Fancy locking always sucks.  The root
> cause of the problem is file removal ref draining from sysfs side and
> a proper solution should be implemented there.  Adding all this
> complexity to device hotplug lock won't solve problems involving other
> locks while obfuscating what's going on through all the complexity.
> Also, when sysfs is updated with a proper solution, a simpler
> workaround from device hotplug side would be far easier to convert to
> the new solution than this, which over time is likely to grow
> interesting uses.
> 
> Let's *please* stick to something simple.

OK, I'll use restart_syscall() approach in the simplest form, then.

Thanks,
Rafael


-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

  reply	other threads:[~2013-08-28 13:14 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-25 20:09 Rafael J. Wysocki
2013-08-25 21:54 ` Greg Kroah-Hartman
2013-08-26  3:13 ` Gu Zheng
2013-08-26 12:42   ` Rafael J. Wysocki
2013-08-26 14:43     ` Rafael J. Wysocki
2013-08-26 15:02       ` Rafael J. Wysocki
2013-08-27  3:26         ` Gu Zheng
2013-08-27  9:21         ` Gu Zheng
2013-08-27 18:36           ` Tejun Heo
2013-08-27 21:45             ` Rafael J. Wysocki
2013-08-28 10:03               ` Gu Zheng
2013-08-28 12:24               ` Tejun Heo
2013-08-28 13:24                 ` Rafael J. Wysocki [this message]
2013-08-28 13:45                   ` [PATCH 0/2] " Rafael J. Wysocki
2013-08-28 13:48                     ` [PATCH 1/2] driver core / ACPI: Avoid device hot remove locking issues Rafael J. Wysocki
2013-08-28 18:53                       ` Greg Kroah-Hartman
2013-08-29  2:02                       ` Gu Zheng
2013-08-28 13:51                     ` [PATCH 2/2] ACPI / hotplug: Remove containers synchronously Rafael J. Wysocki
2013-08-28 18:53                       ` Greg Kroah-Hartman
2013-08-29  2:02                       ` Gu Zheng
2013-08-28 17:06                     ` [PATCH 0/2] driver core / ACPI: Avoid device removal locking problems Toshi Kani
2013-08-29  2:00                     ` Gu Zheng
2013-08-27 21:38           ` [PATCH] " Toshi Kani
2013-08-28  2:12             ` Gu Zheng
2013-08-28 16:55               ` Toshi Kani
2013-08-27  2:03       ` Gu Zheng
2013-08-27  2:38       ` Gu Zheng

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=1592448.YZbpON5n7n@vostro.rjw.lan \
    --to=rjw@sisk.pl \
    --cc=gregkh@linuxfoundation.org \
    --cc=guz.fnst@cn.fujitsu.com \
    --cc=isimatu.yasuaki@jp.fujitsu.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tj@kernel.org \
    --cc=toshi.kani@hp.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

all inboxes | Powered by JetHome®