From: Bjorn Helgaas <helgaas@kernel.org>
To: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: Valdis Kletnieks <valdis.kletnieks@vt.edu>,
Lukas Wunner <lukas@wunner.de>,
"Rafael J . Wysocki" <rafael.j.wysocki@intel.com>,
linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org
Subject: Re: [PATCH] PCI: pcie: Call pm_runtime_no_callbacks() after device is registered
Date: Mon, 23 May 2016 14:55:00 -0500 [thread overview]
Message-ID: <20160523195500.GA24375@localhost> (raw)
In-Reply-To: <1463991115-64820-1-git-send-email-mika.westerberg@linux.intel.com>
On Mon, May 23, 2016 at 11:11:55AM +0300, Mika Westerberg wrote:
> Commit 0195d2813547 ("PCI: Add runtime PM support for PCIe ports") added
> call to pm_runtime_no_callbacks() for each port service device to prevent
> them exposing unnecessary runtime PM sysfs files. However, that function
> tries to acquire dev->power.lock which is not yet initialized.
>
> This triggers following splat:
>
> BUG: spinlock bad magic on CPU#0, swapper/0/1
> lock: 0xffff8801be2aa8e8, .magic: 00000000, .owner: <none>/-1, .owner_cpu: 0
> CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.6.0+ #820
> 0000000000000000 ffff8801beb97be0 ffffffff812cf42d 0000000000000000
> ffff8801be2aa8e8 ffff8801beb97c00 ffffffff8109ee58 ffff8801be2aa8e8
> ffff8801be2aa8e8 ffff8801beb97c30 ffffffff8109efd9 ffff8801be2aa8e8
> Call Trace:
> [<ffffffff812cf42d>] dump_stack+0x4f/0x72
> [<ffffffff8109ee58>] spin_dump+0x78/0xc0
> [<ffffffff8109efd9>] do_raw_spin_lock+0xf9/0x150
> [<ffffffff81674e10>] _raw_spin_lock_irq+0x20/0x30
> [<ffffffff813d738e>] pm_runtime_no_callbacks+0x1e/0x40
> [<ffffffff81322cad>] pcie_port_device_register+0x1fd/0x4e0
> [<ffffffff813232f8>] pcie_portdrv_probe+0x38/0xa0
> [<ffffffff81314fb5>] local_pci_probe+0x45/0xa0
> [<ffffffff81315fe0>] ? pci_match_device+0xe0/0x110
> [<ffffffff813163ab>] pci_device_probe+0xdb/0x130
> [<ffffffff813ccefc>] driver_probe_device+0x22c/0x440
> [<ffffffff813cd1e1>] __driver_attach+0xd1/0xf0
> [<ffffffff813cd110>] ? driver_probe_device+0x440/0x440
> [<ffffffff813caab4>] bus_for_each_dev+0x64/0xa0
> [<ffffffff813cc60e>] driver_attach+0x1e/0x20
> [<ffffffff813cc0cb>] bus_add_driver+0x1eb/0x280
> [<ffffffff81d36cdc>] ? pcie_port_setup+0x7c/0x7c
> [<ffffffff813cdb90>] driver_register+0x60/0xe0
> [<ffffffff813148e0>] __pci_register_driver+0x60/0x70
> [<ffffffff81d36d3f>] pcie_portdrv_init+0x63/0x75
> [<ffffffff810003db>] do_one_initcall+0xab/0x1c0
> [<ffffffff81cff083>] kernel_init_freeable+0x153/0x1d9
> [<ffffffff8166dfce>] kernel_init+0xe/0x100
> [<ffffffff81675612>] ret_from_fork+0x22/0x40
> [<ffffffff8166dfc0>] ? rest_init+0x90/0x90
>
> Fix this by calling pm_runtime_no_callbacks() after device_register() just
> like other buses, like I2C is doing already.
>
> Reported-by: Valdis Kletnieks <valdis.kletnieks@vt.edu>
> Tested-by: Valdis Kletnieks <valdis.kletnieks@vt.edu>
> Suggested-by: Lukas Wunner <lukas@wunner.de>
> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
I think this is a bugfix for "PCI: Add runtime PM support for PCIe
ports", so I folded this into that patch since it hasn't been merged
yet. Is that the right place for it?
> ---
> drivers/pci/pcie/portdrv_core.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c
> index 65b1a624826b..97927dfbbf5f 100644
> --- a/drivers/pci/pcie/portdrv_core.c
> +++ b/drivers/pci/pcie/portdrv_core.c
> @@ -344,7 +344,6 @@ static int pcie_device_init(struct pci_dev *pdev, int service, int irq)
> get_descriptor_id(pci_pcie_type(pdev), service));
> device->parent = &pdev->dev;
> device_enable_async_suspend(device);
> - pm_runtime_no_callbacks(device);
>
> retval = device_register(device);
> if (retval) {
> @@ -352,6 +351,8 @@ static int pcie_device_init(struct pci_dev *pdev, int service, int irq)
> return retval;
> }
>
> + pm_runtime_no_callbacks(device);
> +
> return 0;
> }
>
> --
> 2.8.1
>
next prev parent reply other threads:[~2016-05-23 19:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-17 18:36 next-20160517 - lockdep splat in pcie code Valdis Kletnieks
2016-05-17 19:37 ` Bjorn Helgaas
2016-05-17 22:12 ` Lukas Wunner
2016-05-18 8:54 ` Mika Westerberg
2016-05-19 21:19 ` Valdis.Kletnieks
2016-05-23 8:11 ` [PATCH] PCI: pcie: Call pm_runtime_no_callbacks() after device is registered Mika Westerberg
2016-05-23 19:55 ` Bjorn Helgaas [this message]
2016-05-24 7:58 ` Mika Westerberg
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=20160523195500.GA24375@localhost \
--to=helgaas@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=mika.westerberg@linux.intel.com \
--cc=rafael.j.wysocki@intel.com \
--cc=valdis.kletnieks@vt.edu \
/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).