From: Andrew Morton <akpm@linux-foundation.org>
To: Ian Abbott <abbotti@mev.co.uk>
Cc: linux-kernel@vger.kernel.org, linux-pci@atrey.karlin.mff.cuni.cz,
pcihpd-discuss@lists.sourceforge.net, gregkh@suse.de,
kristen.c.accardi@intel.com
Subject: Re: [PATCH(v3) 2.6.24] Fix fakephp deadlock
Date: Sat, 26 Jan 2008 22:01:01 -0800 [thread overview]
Message-ID: <20080126220101.9e767f41.akpm@linux-foundation.org> (raw)
In-Reply-To: <479A0D1C.8080401@mev.co.uk>
> On Fri, 25 Jan 2008 16:23:56 +0000 Ian Abbott <abbotti@mev.co.uk> wrote:
> From: Ian Abbott <abbotti@mev.co.uk>
>
> If the fakephp driver is used to emulate removal of a PCI device by
> writing text string "0" to the "power" sysfs attribute file, this causes
> its parent directory and its contents (including the "power" file) to be
> deleted before the write operation returns. Unfortunately, it ends up
> in a deadlock waiting for itself to complete.
Thansk for working on this, but....
> The deadlock is as follows: sysfs_write_file calls flush_write_buffer
> which calls sysfs_get_active_two before calling power_write_file in
> pci_hotplug_core.c via the sysfs store operation. The power_write_file
> function calls disable_slot in fakephp.c via the slot operation. The
> disable_slot function calls remove_slot which calls pci_hp_deregister
> (back in pci_hotplug_core.c) which calls fs_remove_slot which calls
> sysfs_remove_file to remove the "power" file. The sysfs_remove_file
> function calls sysfs_hash_and_remove which calls sysfs_addrm_finish
> which calls sysfs_deactivate. The sysfs_deactivate function sees that
> something has an active reference on the sysfs_dirent (from the
> previous call to sysfs_get_active_two back up the call stack somewhere)
> so waits for the active reference to go away, which is of course
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ <- this always wrong
> impossible.
>
> The problem has been present since 2.6.21.
>
> This patch breaks the deadlock by queuing work queue items on a single-
> threaded work queue to remove a slot from sysfs, and to rescan the PCI
> buses. There is also some protection against disabling a slot that is
> already being removed.
Adding a deferred-work like this just because we can't get the locking and
refcounting correct is a really sad hack.
Can we get the locking and refcounting right please? Start by making that
wait-for-refcount-to-go-away go away.
next prev parent reply other threads:[~2008-01-27 6:02 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-25 16:23 [PATCH(v3) 2.6.24] Fix fakephp deadlock Ian Abbott
2008-01-27 6:01 ` Andrew Morton [this message]
2008-01-28 10:33 ` Ian Abbott
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=20080126220101.9e767f41.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=abbotti@mev.co.uk \
--cc=gregkh@suse.de \
--cc=kristen.c.accardi@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@atrey.karlin.mff.cuni.cz \
--cc=pcihpd-discuss@lists.sourceforge.net \
/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.