public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Lukas Wunner <lukas@wunner.de>
Cc: Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Heiner Kallweit <hkallweit1@gmail.com>,
	Keith Busch <kbusch@kernel.org>, Wolfram Sang <wsa@kernel.org>,
	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: Thu, 30 Nov 2023 18:37:14 -0600	[thread overview]
Message-ID: <20231201003714.GA501991@bhelgaas> (raw)
In-Reply-To: <20231130093601.GA11031@wunner.de>

On Thu, Nov 30, 2023 at 10:36:01AM +0100, Lukas Wunner wrote:
> On Thu, Nov 30, 2023 at 07:30:56AM +0000, Shinichiro Kawasaki wrote:
> ...

> > Lukas, thank you for the idea. If I understand the comment by Andy
> > correctly, P2SB should not be unhidden between arch_initcall and
> > fs_initcall. Hmm.
> > 
> > This made me think: how about to unhide and hide P2SB just during
> > fs_initcall to cache the P2SB resources? To try it, I added a function
> > below on top of the previous trial patch. The added function calls
> > p2sb_bar() for devfn=0 at fs_initcall so that the resource is cached
> > before probe of i2c-i801. This worked
> > good on my system. It avoided the deadlock as well as the lockdep WARN :)
> 
> This may work if i2c-i801 is compiled as a module, but may not work
> if it's builtin:  It would try to access the cached P2SB BAR when
> it's not yet been cached.  So you'd have to return -EPROBE_DEFER
> from p2sb_bar() if it hasn't been cached yet.  And you'd have to
> make sure that all the callers can cope with that return value.
> 
> Another approach would be to cache the BARs very early at boot in
> arch/x86/kernel/early-quirks.c.  That would obviate the need to
> defer probing if the BAR hasn't been cached yet.

I hinted at something like this too:

  https://lore.kernel.org/all/20220107010305.GA334966@bhelgaas/

I think these hidden devices are an architectural nightmare.  I doubt
firmware folks have signed up to support the OS unhiding and using
them.  I think we're going out on a limb by assuming they're fair game
for the OS to use.  So I'm ... a bit hesitant to complicate the PCI
core locking, enumeration, and BAR reading code to accommodate them.

> Looking through past discussions archived in lore, I've found an
> important issue raised by Bjorn:
> 
>    "Apparently this normally hidden device is consuming
>     PCI address space.  The PCI core needs to know about this.  If it
>     doesn't, the PCI core may assign this space to another device."
>     
>    https://lore.kernel.org/all/20210308185212.GA1790506@bjorn-Precision-5520/

I think that was covered because the address space is not included in
the PNP0A03 _CRS, as mentioned in the v2 commit log, right?

  https://lore.kernel.org/all/20211221173945.53674-3-andriy.shevchenko@linux.intel.com/

Bjorn

  reply	other threads:[~2023-12-01  0:37 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
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 [this message]
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=20231201003714.GA501991@bhelgaas \
    --to=helgaas@kernel.org \
    --cc=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