LKML Archive mirror
 help / color / mirror / Atom feed
From: Shinichiro Kawasaki <shinichiro.kawasaki@wdc.com>
To: Klara Modin <klarasmodin@gmail.com>
Cc: "Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
	"Lukas Wunner" <lukas@wunner.de>,
	"bcfradella@proton.me" <bcfradella@proton.me>,
	"Danil Rybakov" <danilrybakov249@gmail.com>,
	"Hans de Goede" <hdegoede@redhat.com>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"platform-driver-x86@vger.kernel.org"
	<platform-driver-x86@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Ben Fradella" <bfradell@netapp.com>,
	"Ranjan Dutta" <ranjan.dutta@intel.com>,
	"Yifan2 Li" <yifan2.li@intel.com>,
	"Jonathan Yong" <jonathan.yong@intel.com>
Subject: Re: [PATCH] p2sb: Don't init until unassigned resources have been assigned.
Date: Sun, 12 May 2024 10:23:02 +0000	[thread overview]
Message-ID: <am2n3qjaxgnciwfxhqs4aeosyug2oy2umuul4dzuagfhxdjlod@7ksrhwbjdxuc> (raw)
In-Reply-To: <b9ce0494-ab30-4647-9b0b-e01cc19dab23@gmail.com>

On May 10, 2024 / 21:22, Klara Modin wrote:
> On 2024-05-10 16:50, Andy Shevchenko wrote:
> > On Thu, May 09, 2024 at 07:04:32PM +0200, Lukas Wunner wrote:
> > > [cc += Shin'ichiro, Klara, Andy, Danil]
> > 
> > Thank you!
> > 
> > > On Thu, May 09, 2024 at 04:49:34PM +0000, bcfradella@proton.me wrote:
> > > > From: Ben Fradella <bfradell@netapp.com>
> > > > 
> > > > The P2SB could get an invalid BAR from the BIOS, and that won't be fixed
> > > > up until pcibios_assign_resources(), which is an fs_initcall().
> > > > 
> > > > - Move p2sb_fs_init() to an fs_initcall_sync(). This is still early
> > > >    enough to avoid a race with any dependent drivers.
> > > > 
> > > > - Add a check for IORESOURCE_UNSET in p2sb_valid_resource() to catch
> > > >    unset BARs going forward.
> > > > 
> > > > - Return error values from p2sb_fs_init() so that the 'initcall_debug'
> > > >    cmdline arg provides useful data.
> > 
> > ...
> > 
> > > >   /*
> > > > - * pci_rescan_remove_lock to avoid access to unhidden P2SB devices can
> > > > - * not be locked in sysfs pci bus rescan path because of deadlock. To
> > > > - * avoid the deadlock, access to P2SB devices with the lock at an early
> > > > - * step in kernel initialization and cache required resources. This
> > > > - * should happen after subsys_initcall which initializes PCI subsystem
> > > > - * and before device_initcall which requires P2SB resources.
> > > > + * pci_rescan_remove_lock() can not be locked in sysfs pci bus rescan path
> > 
> > PCI bus
> > 
> > > > + * because of deadlock. To avoid the deadlock, access P2SB devices with the lock
> > > > + * at an early step in kernel initialization and cache required resources.
> > > > + *
> > > > + * We want to run as early as possible. If the P2SB was assigned a bad BAR,
> > > > + * we'll need to wait on pcibios_assign_resources() to fix it. So, our list of
> > > > + * initcall dependencies looks something like this:
> > > > + *
> > > > + * ...
> > > > + * subsys_initcall (pci_subsys_init)
> > > > + * fs_initcall     (pcibios_assign_resources)
> > > >    */
> > 
> > This makes sense to me
> > Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> > 
> > I assume others will conduct the proper review and testing.
> > 
> 
> This patch did not introduce any new issues on my previously problematic
> system.
> 
> Tested-by: Klara Modin <klarasmodin@gmail.com>

The changes look reasonable and good to me. I also confirmed that the patch
does not affect on my use case using two my test machines.

Reviewed-by: Shin'ichiro Kawasaki <shinichiro.kawasaki@wdc.com>

  reply	other threads:[~2024-05-12 10:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-09 16:49 [PATCH] p2sb: Don't init until unassigned resources have been assigned bcfradella
2024-05-09 17:04 ` Lukas Wunner
2024-05-10 14:50   ` Andy Shevchenko
2024-05-10 19:22     ` Klara Modin
2024-05-12 10:23       ` Shinichiro Kawasaki [this message]
2024-05-13 12:03 ` Hans de Goede
2024-05-13 15:53   ` Fradella, Ben

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=am2n3qjaxgnciwfxhqs4aeosyug2oy2umuul4dzuagfhxdjlod@7ksrhwbjdxuc \
    --to=shinichiro.kawasaki@wdc.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=bcfradella@proton.me \
    --cc=bfradell@netapp.com \
    --cc=danilrybakov249@gmail.com \
    --cc=hdegoede@redhat.com \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=jonathan.yong@intel.com \
    --cc=klarasmodin@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lukas@wunner.de \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=ranjan.dutta@intel.com \
    --cc=yifan2.li@intel.com \
    /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 read-only IMAP folder(s) and NNTP newsgroup(s).