From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Lukas Wunner <lukas@wunner.de>
Cc: Heiner Kallweit <hkallweit1@gmail.com>,
Keith Busch <kbusch@kernel.org>, Wolfram Sang <wsa@kernel.org>,
Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>,
Jean Delvare <jdelvare@suse.de>,
"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
"linux-i2c@vger.kernel.org" <linux-i2c@vger.kernel.org>,
Bjorn Helgaas <bhelgaas@google.com>
Subject: Re: [bug report] lockdep WARN at PCI device rescan
Date: Tue, 14 Nov 2023 19:58:11 +0200 [thread overview]
Message-ID: <ZVO1M2289uvElgOi@smile.fi.intel.com> (raw)
In-Reply-To: <ZVOcPOlkkBk3Xfm5@smile.fi.intel.com>
On Tue, Nov 14, 2023 at 06:11:40PM +0200, Andy Shevchenko wrote:
> On Tue, Nov 14, 2023 at 04:57:01PM +0100, Lukas Wunner wrote:
> > On Tue, Nov 14, 2023 at 02:04:34PM +0200, Andy Shevchenko wrote:
> > > On Tue, Nov 14, 2023 at 11:47:15AM +0100, Heiner Kallweit wrote:
> > > > On 14.11.2023 11:16, Wolfram Sang wrote:
> > > > > On Tue, Nov 14, 2023 at 06:54:29AM +0000, Shinichiro Kawasaki wrote:
...
> > > > > > The lockdep splat indicates possible deadlock between
> > > > > > pci_rescan_remove_lock and work_completion lock have deadlock
> > > > > > possibility.
> > > > > > In the call stack, I found that the workqueue thread for
> > > > > > i801_probe() calls p2sb_bar(), which locks pci_rescan_remove_lock.
> > > >
> > > > i801 just uses p2sb_bar(), I don't see any issue in i801. Root cause
> > > > seems to be in the PCI subsystem. Calling p2sb_bar() from a PCI driver
> > > > probe callback seems to be problematic, nevertheless it's a valid API
> > > > usage.
> > >
> > > So, currently I'm lack of (good) ideas and would like to hear other (more
> > > experienced) PCI developers on how is to address this...
> >
> > Can you add a p2sb_bar_locked() library call which is used by the
> > i801 probe path?
> >
> > Basically rename p2sb_bar() to __p2sb_bar() and add a third parameter
> > of type boolean which signifies whether it's invoked in locked context
> > or not, then call that from p2sb_bar() and p2sb_bar_locked() wrappers.
>
> It may work, I assume. Let me cook the patch.
Hmm... But this will open a window when probing phase happens, e.g. during
boot time, no? If somebody somehow calls for full rescan, we may end up in
the situation when P2SB is gone before accessing it in p2sb_bar().
Now I'm wondering why simple pci_dev_get() can't be sufficient in the
p2sb_bar().
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2023-11-14 17:58 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-14 6:54 [bug report] lockdep WARN at PCI device rescan Shinichiro Kawasaki
2023-11-14 10:16 ` Wolfram Sang
2023-11-14 10:47 ` Heiner Kallweit
2023-11-14 12:04 ` Andy Shevchenko
2023-11-14 15:57 ` Lukas Wunner
2023-11-14 16:11 ` Andy Shevchenko
2023-11-14 17:58 ` Andy Shevchenko [this message]
2023-11-24 10:49 ` Shinichiro Kawasaki
2023-11-24 15:22 ` Andy Shevchenko
2023-11-28 7:45 ` Shinichiro Kawasaki
2023-11-29 11:17 ` Lukas Wunner
[not found] ` <ZWdBnMTOq9wIt9L-@smile.fi.intel.com>
2023-11-29 13:53 ` Andy Shevchenko
2023-11-30 7:30 ` Shinichiro Kawasaki
2023-11-30 9:36 ` Lukas Wunner
2023-12-01 0:37 ` Bjorn Helgaas
2023-12-01 10:46 ` Shinichiro Kawasaki
2023-11-30 15:19 ` Andy Shevchenko
2023-12-01 10:34 ` Shinichiro Kawasaki
2023-11-24 17:30 ` Heiner Kallweit
2023-11-28 10:16 ` Shinichiro Kawasaki
2023-11-29 11:30 ` Lukas Wunner
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=ZVO1M2289uvElgOi@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=bhelgaas@google.com \
--cc=hkallweit1@gmail.com \
--cc=jdelvare@suse.de \
--cc=kbusch@kernel.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lukas@wunner.de \
--cc=shinichiro.kawasaki@wdc.com \
--cc=wsa@kernel.org \
/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