linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: "Krzysztof Hałasa" <khalasa@piap.pl>
Cc: "Pali Rohár" <pali@kernel.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Lorenzo Pieralisi" <lorenzo.pieralisi@arm.com>,
	"Gregory Clement" <gregory.clement@bootlin.com>,
	"Andrew Lunn" <andrew@lunn.ch>,
	"Krzysztof Wilczyński" <kw@linux.com>,
	"Koen Vandeputte" <koen.vandeputte@citymesh.com>,
	"Dexuan Cui" <dexuan.linux@gmail.com>
Subject: Re: PCI: Race condition in pci_create_sysfs_dev_files (can't boot)
Date: Tue, 8 Feb 2022 17:40:23 -0600	[thread overview]
Message-ID: <20220208234023.GA505306@bhelgaas> (raw)
In-Reply-To: <m38ruwxgnx.fsf@t19.piap.pl>

[+cc Koen, Dexuan from this old thread:
https://lore.kernel.org/all/20200716110423.xtfyb3n6tn5ixedh@pali/]

On Mon, Jan 31, 2022 at 12:56:18PM +0100, Krzysztof Hałasa wrote:
> Bjorn Helgaas <helgaas@kernel.org> writes:
> 
> > Thanks.  e1d3f3268b0e and related patches converted individual files
> > ("config", "rom", "vpd", etc) to static attributes, but since the
> > problem you're seeing is with a directory, it's likely different.
> >
> > I opened this bugzilla report to try to keep this from getting lost:
> > https://bugzilla.kernel.org/show_bug.cgi?id=215515
> 
> Ok, thanks.

Koen collected some interesting logs at
https://lore.kernel.org/all/cd4812f0-1de3-0582-936c-ba30906595af@citymesh.com/
They're from v5.10, which was before all of Krzysztof W's nice work
converting to static attributes, but Koen's log shows the error
happening in the pci_sysfs_init() initcall, which is *after*
imx6_pcie_probe():

  imx6_pcie_probe                # probably device initcall (level 6)
    ...
      pci_create_sysfs_dev_files

  pci_sysfs_init                 # late initcall (level 7)
    pci_create_sysfs_dev_files
      "sysfs: cannot create duplicate filename"

Krzysztof, you're running v5.14, which includes Krzysztof W's work,
but that shouldn't affect the imx6_pcie_probe()/pci_sysfs_init()
ordering.  Your log shows the error in imx6_pcie_probe().

Would you mind adding the patch below and attaching a complete dmesg
log to the bugzilla?

Bjorn

diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index 7bbf2673c7f2..6a2b62fe7704 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -1200,6 +1200,9 @@ static int pci_create_attr(struct pci_dev *pdev, int num, int write_combine)
 	res_attr->attr.mode = 0600;
 	res_attr->size = pci_resource_len(pdev, num);
 	res_attr->private = (void *)(unsigned long)num;
+	pci_info(pdev, "pci_create_attr:");
+	print_hex_dump(KERN_INFO, "", DUMP_PREFIX_OFFSET, 16, 1,
+			res_attr, 64, true);
 	retval = sysfs_create_bin_file(&pdev->dev.kobj, res_attr);
 	if (retval)
 		kfree(res_attr);
@@ -1380,6 +1383,9 @@ static const struct attribute_group pci_dev_reset_attr_group = {
 
 int __must_check pci_create_sysfs_dev_files(struct pci_dev *pdev)
 {
+	pci_info(pdev, "pci_create_sysfs_dev_files\n");
+	dump_stack();
+
 	if (!sysfs_initialized)
 		return -EACCES;
 


  reply	other threads:[~2022-02-08 23:40 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-30  8:18 PCI: Race condition in pci_create_sysfs_dev_files (can't boot) Krzysztof Hałasa
2021-07-30  9:49 ` Pali Rohár
2022-01-20 23:00 ` Bjorn Helgaas
2022-01-21  7:14   ` Krzysztof Hałasa
2022-01-21 16:57     ` Bjorn Helgaas
2022-01-31 11:56       ` Krzysztof Hałasa
2022-02-08 23:40         ` Bjorn Helgaas [this message]
2022-02-11 12:31           ` Krzysztof Hałasa
2022-02-15  6:35           ` Krzysztof Hałasa
2022-04-01 13:50             ` Koen Vandeputte
2022-04-06 14:08               ` Koen Vandeputte
2022-04-13 12:52                 ` Koen Vandeputte

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=20220208234023.GA505306@bhelgaas \
    --to=helgaas@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=bhelgaas@google.com \
    --cc=dexuan.linux@gmail.com \
    --cc=gregory.clement@bootlin.com \
    --cc=khalasa@piap.pl \
    --cc=koen.vandeputte@citymesh.com \
    --cc=kw@linux.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=pali@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;
as well as URLs for NNTP newsgroup(s).