linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: ACPI Devel Maling List <linux-acpi@vger.kernel.org>,
	Bjorn Helgaas <bhelgaas@google.com>,
	Aaron Lu <aaron.lu@intel.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linux PCI <linux-pci@vger.kernel.org>
Subject: Re: [Update][PATCH 4/5][RFT] ACPI / hotplug / PCI: Simplify acpi_install_hotplug_notify_handler()
Date: Sun, 02 Feb 2014 01:12 +0100	[thread overview]
Message-ID: <2014200.ZMkXkiESpH@vostro.rjw.lan> (raw)
In-Reply-To: <6782022.RtGDcVFnWK@vostro.rjw.lan>

On Friday, January 31, 2014 06:34:22 PM Rafael J. Wysocki wrote:
> On Friday, January 31, 2014 07:09:51 PM Mika Westerberg wrote:
> > On Fri, Jan 31, 2014 at 05:16:03PM +0100, Rafael J. Wysocki wrote:

[...]

> > 
> > [   64.914639] ACPI: \_SB_.PCI0.RP05: ACPI_NOTIFY_BUS_CHECK event
> > [   64.914640] ACPI: \_SB_.PCI0.RP05: BEFORE mutex_lock()
> > 
> > Then running sysrq-w I get following task as blocked:
> > 
> > [  346.885950] SysRq : Show Blocked State
> > [  346.887733]   task                        PC stack   pid father
> > [  346.889535] kworker/0:0     D ffff880100241ae0  5280     4      2 0x00000000
> > [  346.891355] Workqueue: kacpi_notify acpi_os_execute_deferred
> > [  346.893171]  ffff8801003c7d30 0000000000000046 ffff880100241710 ffffffff81e10460
> > [  346.895011]  ffff8801003c7fd8 00000000000129c0 00000000000129c0 ffff880100241710
> > [  346.896849]  ffffffff81e5db70 ffffffff81e5db74 ffff880100241710 00000000ffffffff
> > [  346.898702] Call Trace:
> > [  346.900518]  [<ffffffff81815bc4>] schedule_preempt_disabled+0x24/0x70
> > [  346.902338]  [<ffffffff818175f2>] __mutex_lock_slowpath+0x132/0x1b0
> > [  346.904164]  [<ffffffff8181768a>] mutex_lock+0x1a/0x2a
> > [  346.905993]  [<ffffffff81324845>] acpi_hotplug_notify_cb+0x70/0x227
> > [  346.907820]  [<ffffffff813384f4>] acpi_ev_notify_dispatch+0x44/0x5c
> > [  346.909637]  [<ffffffff8131fa8d>] acpi_os_execute_deferred+0xf/0x1b
> > [  346.911455]  [<ffffffff8105e12a>] process_one_work+0x17a/0x440
> > [  346.913285]  [<ffffffff8105ed29>] worker_thread+0x119/0x390
> > [  346.915121]  [<ffffffff8105ec10>] ? manage_workers.isra.25+0x2a0/0x2a0
> > [  346.916970]  [<ffffffff81064dad>] kthread+0xcd/0xf0
> > [  346.918809]  [<ffffffff81064ce0>] ? kthread_create_on_node+0x180/0x180
> > [  346.920653]  [<ffffffff8181fefc>] ret_from_fork+0x7c/0xb0
> > [  346.922501]  [<ffffffff81064ce0>] ? kthread_create_on_node+0x180/0x180
> > [  346.924351] kworker/u8:5    D ffff88006ea55860  4696   945      2 0x00000000
> > [  346.926212] Workqueue: kacpi_hotplug acpi_hotplug_work_fn
> > [  346.928074]  ffff88006de49a40 0000000000000046 ffff88006ea55490 ffff880100245490
> > [  346.929978]  ffff88006de49fd8 00000000000129c0 00000000000129c0 ffff88006ea55490
> > [  346.931872]  ffff88006de49ba0 7fffffffffffffff ffff88006de49b98 ffff88006ea55490
> > [  346.933753] Call Trace:
> > [  346.935626]  [<ffffffff81815794>] schedule+0x24/0x70
> > [  346.937516]  [<ffffffff81814a89>] schedule_timeout+0x1a9/0x2a0
> > [  346.939415]  [<ffffffff8107dda8>] ? __wake_up_common+0x58/0x90
> > [  346.941312]  [<ffffffff81816968>] wait_for_completion+0x98/0x100
> > [  346.943222]  [<ffffffff81071b70>] ? wake_up_state+0x10/0x10
> > [  346.945133]  [<ffffffff8105ba25>] flush_workqueue+0x115/0x5a0
> > [  346.947054]  [<ffffffff81309b20>] ? acpi_pci_find_companion+0x40/0x40
> > [  346.948986]  [<ffffffff81309b20>] ? acpi_pci_find_companion+0x40/0x40
> > [  346.950904]  [<ffffffff81320340>] acpi_os_wait_events_complete+0x1c/0x1e
> > [  346.952829]  [<ffffffff8133a387>] acpi_remove_notify_handler+0x78/0x1ef
> > [  346.954748]  [<ffffffff81309b20>] ? acpi_pci_find_companion+0x40/0x40
> > [  346.956669]  [<ffffffff813226df>] acpi_remove_pm_notifier+0x39/0x5c
> > [  346.958592]  [<ffffffff81309ab5>] pci_acpi_cleanup+0x25/0x50
> > [  346.960508]  [<ffffffff8132368c>] acpi_platform_notify_remove+0x44/0x53
> > [  346.962427]  [<ffffffff814426f2>] device_del+0x142/0x1b0
> > [  346.964333]  [<ffffffff812edcfa>] pci_remove_bus_device+0x7a/0x100
> > [  346.966238]  [<ffffffff812edd95>] pci_stop_and_remove_bus_device+0x15/0x20
> > [  346.968140]  [<ffffffff8130639e>] disable_slot+0x4e/0xa0
> > [  346.970030]  [<ffffffff813067b8>] acpiphp_check_bridge.part.10+0xe8/0xf0
> > [  346.971911]  [<ffffffff81306f92>] hotplug_event+0xf2/0x1a0
> > [  346.973776]  [<ffffffff813070a1>] acpiphp_hotplug_event+0x61/0xe0
> > [  346.975630]  [<ffffffff8132634e>] acpi_device_hotplug+0x37c/0x3c2
> > [  346.977471]  [<ffffffff81320359>] acpi_hotplug_work_fn+0x17/0x22
> > [  346.979299]  [<ffffffff8105e12a>] process_one_work+0x17a/0x440
> > [  346.981122]  [<ffffffff8105ed29>] worker_thread+0x119/0x390
> > [  346.982956]  [<ffffffff8105ec10>] ? manage_workers.isra.25+0x2a0/0x2a0
> > [  346.984762]  [<ffffffff81064dad>] kthread+0xcd/0xf0
> > [  346.986581]  [<ffffffff81064ce0>] ? kthread_create_on_node+0x180/0x180
> > [  346.988419]  [<ffffffff8181fefc>] ret_from_fork+0x7c/0xb0
> > [  346.990221]  [<ffffffff81064ce0>] ? kthread_create_on_node+0x180/0x180
> > 
> > I have to leave now but I can continue debugging tomorrow if needed.
> 
> No need for now, I think I know what's happening.  I'll follow up later.

acpi_remove_notify_handler() which is called from acpi_remove_pm_notifier()
executes acpi_os_wait_events_complete() which does flush_workqueue(kacpi_notify_wq)
and all that happens under acpi_scan_lock acquired by acpi_device_hotplug().

Now, acpi_hotplug_notify_cb() runs from kacpi_notify_wq, so effectively
acpi_os_wait_events_complete() waits for it to return, so if it attempts
to acquire acpi_scan_lock, it will deadlock.  Which happens on the NUC.

The good news is that we can use a different lock to eliminate the race
I wanted to deal with using acpi_scan_lock, but that required me to rework
the whole patchset.  I'll send a new version shortly, but I need to update
the ACPIPHP updates it is on top of.

Thanks!

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

  reply	other threads:[~2014-02-01 23:57 UTC|newest]

Thread overview: 100+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-27  0:37 [PATCH 0/11] ACPI / hotplug / PCI: Updates on top of changes merged recently Rafael J. Wysocki
2014-01-27  0:38 ` [PATCH 1/11] ACPI / hotplug / PCI: Proper kerneldoc comments for enumeration/removal Rafael J. Wysocki
2014-01-27  0:38 ` [PATCH 2/11] ACPI / hotplug / PCI: Simplify register_slot() Rafael J. Wysocki
2014-01-27  0:39 ` [PATCH 3/11] ACPI / hotplug / PCI: Drop acpiphp_bus_trim() Rafael J. Wysocki
2014-01-27  0:40 ` [PATCH 4/11] ACPI / hotplug / PCI: Rework acpiphp_no_hotplug() Rafael J. Wysocki
2014-01-27  0:41 ` [PATCH 5/11] ACPI / hotplug / PCI: Store acpi_device pointer in acpiphp_context Rafael J. Wysocki
2014-01-27  0:41 ` [PATCH 6/11] ACPI / hotplug / PCI: Drop acpiphp_bus_add() Rafael J. Wysocki
2014-01-27  0:42 ` [PATCH 7/11] ACPI / hotplug / PCI: Drop crit_sect locking Rafael J. Wysocki
2014-01-27  0:43 ` [PATCH 8/11] ACPI / hotplug / PCI: Simplify hotplug_event() Rafael J. Wysocki
2014-01-27  0:44 ` [PATCH 9/11] ACPI / hotplug / PCI: Simplify disable_slot() Rafael J. Wysocki
2014-01-27  0:45 ` [PATCH 10/11] ACPI / hotplug / PCI: Use acpi_handle_debug() in hotplug_event() Rafael J. Wysocki
2014-01-27  0:46 ` [PATCH 11/11] ACPI / hotplug: Do not pass ACPI handles to ACPI dock operations Rafael J. Wysocki
2014-01-28 22:10 ` [PATCH 0/5][RFT] ACPI / hotplug / PCI: Consolidation of ACPIPHP with ACPI core device hotplug Rafael J. Wysocki
2014-01-28 22:12   ` [PATCH 1/5][RFT] ACPI / hotplug / PCI: Attach hotplug contexts to struct acpi_device Rafael J. Wysocki
2014-01-28 22:13   ` [PATCH 2/5][RFT] ACPI / hotplug: Introduce acpi_install_hotplug_notify_handler() Rafael J. Wysocki
2014-01-28 22:14   ` [PATCH 3/5][RFT] ACPI / hotplug / PCI: Consolidate ACPIPHP with ACPI core hotplug Rafael J. Wysocki
2014-01-28 22:14   ` [PATCH 4/5][RFT] ACPI / hotplug / PCI: Simplify acpi_install_hotplug_notify_handler() Rafael J. Wysocki
2014-01-28 22:16   ` [PATCH 5/5][RFT] ACPI / hotplug: Dispach hotplug notifications from acpi_bus_notify() Rafael J. Wysocki
2014-01-28 23:57   ` [PATCH 0/5][RFT] ACPI / hotplug / PCI: Consolidation of ACPIPHP with ACPI core device hotplug Rafael J. Wysocki
2014-01-28 23:58     ` [Resend][PATCH 1/5][RFT] ACPI / hotplug / PCI: Attach hotplug contexts to struct acpi_device Rafael J. Wysocki
2014-01-28 23:59     ` [Resend][PATCH 2/5][RFT] ACPI / hotplug: Introduce acpi_install_hotplug_notify_handler() Rafael J. Wysocki
2014-01-28 23:59     ` [Update][PATCH 3/5][RFT] ACPI / hotplug / PCI: Consolidate ACPIPHP with ACPI core hotplug Rafael J. Wysocki
2014-01-29  0:00     ` [Update][PATCH 4/5][RFT] ACPI / hotplug / PCI: Simplify acpi_install_hotplug_notify_handler() Rafael J. Wysocki
2014-01-31 15:28       ` Mika Westerberg
2014-01-31 15:42         ` Rafael J. Wysocki
2014-01-31 15:40           ` Mika Westerberg
2014-01-31 16:01             ` Mika Westerberg
2014-01-31 16:16               ` Rafael J. Wysocki
2014-01-31 17:09                 ` Mika Westerberg
2014-01-31 17:34                   ` Rafael J. Wysocki
2014-02-02  0:12                     ` Rafael J. Wysocki [this message]
2014-01-29  0:02     ` [Update][PATCH 5/5][RFT] ACPI / hotplug / PCI: Hotplug notifications from acpi_bus_notify() Rafael J. Wysocki
2014-01-30 15:28       ` [Update 2x][PATCH " Rafael J. Wysocki
2014-02-02  0:52     ` [PATCH v2 0/6] ACPI / hotplug / PCI: Consolidation of ACPIPHP with ACPI core device hotplug Rafael J. Wysocki
2014-02-02  0:54       ` [PATCH v2 1/6] ACPI / hotplug: Fix theoretical race in acpi_hotplug_notify_cb() Rafael J. Wysocki
2014-02-02 17:01         ` Rafael J. Wysocki
2014-02-02  0:55       ` [PATCH v2 2/6] ACPI / hotplug / PCI: Define hotplug context lock in the core Rafael J. Wysocki
2014-02-02  0:56       ` [PATCH v2 3/6] ACPI / hotplug / PCI: Consolidate ACPIPHP with ACPI core hotplug Rafael J. Wysocki
2014-02-02  0:57       ` [PATCH v2 4/6] ACPI / hotplug / PCI: Rework the handling of eject requests Rafael J. Wysocki
2014-02-02  0:58       ` [PATCH v2 5/6] ACPI / hotplug / PCI: Simplify acpi_install_hotplug_notify_handler() Rafael J. Wysocki
2014-02-02  0:58       ` [PATCH v2 6/6] ACPI / hotplug / PCI: Hotplug notifications from acpi_bus_notify() Rafael J. Wysocki
2014-02-02 17:11       ` [PATCH v3 0/7] ACPI / hotplug / PCI: Consolidation of ACPIPHP with ACPI core device hotplug Rafael J. Wysocki
2014-02-02 17:12         ` [PATCH v3 1/7] ACPICA: Introduce acpi_get_data_full() and rework acpi_get_data() Rafael J. Wysocki
2014-02-02 17:15         ` [PATCH v3 2/7] ACPI / hotplug: Fix potential races in notify handlers Rafael J. Wysocki
2014-02-02 17:16         ` [PATCH v3 3/7] ACPI / hotplug / PCI: Define hotplug context lock in the core Rafael J. Wysocki
2014-02-02 17:17         ` [PATCH v3 4/7] ACPI / hotplug / PCI: Consolidate ACPIPHP with ACPI core hotplug Rafael J. Wysocki
2014-02-02 17:18         ` [PATCH v3 5/7] ACPI / hotplug / PCI: Rework the handling of eject requests Rafael J. Wysocki
2014-02-02 17:19         ` [PATCH v3 6/7] ACPI / hotplug / PCI: Simplify acpi_install_hotplug_notify_handler() Rafael J. Wysocki
2014-02-02 17:20         ` [PATCH v3 7/7] ACPI / hotplug / PCI: Hotplug notifications from acpi_bus_notify() Rafael J. Wysocki
2014-02-03 10:45         ` [PATCH v3 0/7] ACPI / hotplug / PCI: Consolidation of ACPIPHP with ACPI core device hotplug Mika Westerberg
2014-02-03 21:51           ` Rafael J. Wysocki
2014-02-02  0:19 ` [PATCH v2 0/13] ACPI / hotplug / PCI: Updates on top of changes merged recently Rafael J. Wysocki
2014-02-02  0:21   ` [PATCH v2 1/13] ACPI / hotplug / PCI: Remove entries from bus->devices in reverse order Rafael J. Wysocki
2014-02-02  0:22   ` [PATCH v2 2/13] ACPI / hotplug / PCI: Move PCI rescan-remove locking to hotplug_event() Rafael J. Wysocki
2014-02-02  0:23   ` [PATCH v2 3/13] ACPI / hotplug / PCI: Simplify disable_slot() Rafael J. Wysocki
2014-02-02  0:24   ` [PATCH v2 4/13] ACPI / hotplug / PCI: Proper kerneldoc comments for enumeration/removal Rafael J. Wysocki
2014-02-02  0:25   ` [PATCH v2 5/13] ACPI / hotplug / PCI: Simplify register_slot() Rafael J. Wysocki
2014-02-02  0:26   ` [PATCH v2 6/13] ACPI / hotplug / PCI: Drop acpiphp_bus_trim() Rafael J. Wysocki
2014-02-02  0:27   ` [PATCH v2 7/13] ACPI / hotplug / PCI: Rework acpiphp_no_hotplug() Rafael J. Wysocki
2014-02-02  0:27   ` [PATCH v2 8/13] ACPI / hotplug / PCI: Store acpi_device pointer in acpiphp_context Rafael J. Wysocki
2014-02-02  0:28   ` [PATCH v2 9/13] ACPI / hotplug / PCI: Drop acpiphp_bus_add() Rafael J. Wysocki
2014-02-02  0:29   ` [PATCH v2 10/13] ACPI / hotplug / PCI: Drop crit_sect locking Rafael J. Wysocki
2014-02-02  0:30   ` [PATCH v2 11/13] ACPI / hotplug / PCI: Simplify hotplug_event() Rafael J. Wysocki
2014-02-02  0:31   ` [PATCH v2 12/13] ACPI / hotplug / PCI: Use acpi_handle_debug() in hotplug_event() Rafael J. Wysocki
2014-02-02  0:31   ` [PATCH v2 13/13] ACPI / hotplug: Do not pass ACPI handles to ACPI dock operations Rafael J. Wysocki
2014-02-03  1:47   ` [PATCH] ACPI / hotplug / PCI: Scan root bus under the PCI rescan-remove lock Rafael J. Wysocki
2014-02-03 10:44   ` [PATCH v2 0/13] ACPI / hotplug / PCI: Updates on top of changes merged recently Mika Westerberg
2014-02-03 23:12     ` [PATCH v2 0/24] ACPI / hotplug / PCI: ACPIPHP updates and consolidation with ACPI core Rafael J. Wysocki
2014-02-03 23:14       ` [PATCH 1/24][Resend] ACPI / hotplug / PCI: Remove entries from bus->devices in reverse order Rafael J. Wysocki
2014-02-03 23:15       ` [PATCH 2/24][Resend] ACPI / hotplug / PCI: Move PCI rescan-remove locking to hotplug_event() Rafael J. Wysocki
2014-02-03 23:16       ` [PATCH 3/24][Resend] ACPI / hotplug / PCI: Scan root bus under the PCI rescan-remove lock Rafael J. Wysocki
2014-02-03 23:18       ` [PATCH 4/24][New] ACPI / hotplug / PCI: Fix bridge removal race in handle_hotplug_event() Rafael J. Wysocki
2014-02-03 23:18       ` [PATCH 5/24][New] ACPI / hotplug / PCI: Fix bridge removal race vs dock events Rafael J. Wysocki
2014-02-03 23:20       ` [PATCH 6/24][Resend] ACPI / hotplug / PCI: Simplify disable_slot() Rafael J. Wysocki
2014-02-03 23:21       ` [PATCH 7/24][Resend] ACPI / hotplug / PCI: Proper kerneldoc comments for enumeration/removal Rafael J. Wysocki
2014-02-03 23:22       ` [PATCH 8/24][Resend] ACPI / hotplug / PCI: Simplify register_slot() Rafael J. Wysocki
2014-02-03 23:23       ` [PATCH 9/24][Resend] ACPI / hotplug / PCI: Drop acpiphp_bus_trim() Rafael J. Wysocki
2014-02-03 23:24       ` [PATCH 10/24][Resend] ACPI / hotplug / PCI: Rework acpiphp_no_hotplug() Rafael J. Wysocki
2014-02-03 23:25       ` [PATCH 11/24][Update] ACPI / hotplug / PCI: Store acpi_device pointer in acpiphp_context Rafael J. Wysocki
2014-02-03 23:26       ` [PATCH 12/24][Resend] ACPI / hotplug / PCI: Drop acpiphp_bus_add() Rafael J. Wysocki
2014-02-03 23:27       ` [PATCH 13/24][Resend] ACPI / hotplug / PCI: Drop crit_sect locking Rafael J. Wysocki
2014-02-03 23:33       ` [PATCH 14/24][Update] ACPI / hotplug / PCI: Simplify hotplug_event() Rafael J. Wysocki
2014-02-03 23:33       ` [PATCH 15/24][Resend] ACPI / hotplug / PCI: Use acpi_handle_debug() in hotplug_event() Rafael J. Wysocki
2014-02-03 23:34       ` [PATCH 16/24][New] ACPI / hotplug / PCI: Do not pass ACPI handle to hotplug_event() Rafael J. Wysocki
2014-02-03 23:34       ` [PATCH 17/24][Resend] ACPICA: Introduce acpi_get_data_full() and rework acpi_get_data() Rafael J. Wysocki
2014-02-03 23:36       ` [PATCH 18/24][Update] ACPI / hotplug: Fix potential race in acpi_bus_notify() Rafael J. Wysocki
2014-02-03 23:36       ` [PATCH 19/24][Update] ACPI / hotplug / PCI: Define hotplug context lock in the core Rafael J. Wysocki
2014-02-03 23:37       ` [PATCH 20/24][Update] ACPI / hotplug / PCI: Consolidate ACPIPHP with ACPI core hotplug Rafael J. Wysocki
2014-02-06 13:07         ` [Update][PATCH 20/24] " Rafael J. Wysocki
2014-02-06 23:35           ` [Update 2x][PATCH " Rafael J. Wysocki
2014-02-03 23:38       ` [PATCH 21/24][Resend] ACPI / hotplug / PCI: Rework the handling of eject requests Rafael J. Wysocki
2014-02-03 23:39       ` [PATCH 22/24][Resend] ACPI / hotplug / PCI: Simplify acpi_install_hotplug_notify_handler() Rafael J. Wysocki
2014-02-06 13:09         ` [Update][PATCH 22/24] " Rafael J. Wysocki
2014-02-03 23:40       ` [PATCH 23/24][Update] ACPI / hotplug / PCI: Hotplug notifications from acpi_bus_notify() Rafael J. Wysocki
2014-02-06 13:10         ` [Update][PATCH 23/24] " Rafael J. Wysocki
2014-02-03 23:41       ` [PATCH 24/24][New] ACPI / hotplug / PCI: Rework acpiphp_check_host_bridge() Rafael J. Wysocki
2014-02-05 10:14       ` [PATCH v2 0/24] ACPI / hotplug / PCI: ACPIPHP updates and consolidation with ACPI core Mika Westerberg
2014-02-05 10:59         ` Rafael J. Wysocki
2014-02-11  0:19 ` [PATCH 0/11] ACPI / hotplug / PCI: Updates on top of changes merged recently Bjorn Helgaas
2014-02-11 12:53   ` 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=2014200.ZMkXkiESpH@vostro.rjw.lan \
    --to=rjw@rjwysocki.net \
    --cc=aaron.lu@intel.com \
    --cc=bhelgaas@google.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --subject='Re: [Update][PATCH 4/5][RFT] ACPI / hotplug / PCI: Simplify acpi_install_hotplug_notify_handler()' \
    /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

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).