From: "Patel, Nirmal" <nirmal.patel@linux.intel.com>
To: "You-Sheng Yang (vicamo)" <vicamo.yang@canonical.com>,
"Jonathan Derrick" <jonathan.derrick@linux.dev>,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Wilczyński" <kw@linux.com>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Thomas Gleixner" <tglx@linutronix.de>,
"Keith Busch" <kbusch@kernel.org>
Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] PCI: vmd: guard device addition and removal
Date: Wed, 15 Mar 2023 07:39:03 -0700 [thread overview]
Message-ID: <49907fd5-3069-dc19-1388-590e08600037@linux.intel.com> (raw)
In-Reply-To: <20230313173733.1815277-1-vicamo.yang@canonical.com>
On 3/13/2023 10:37 AM, You-Sheng Yang (vicamo) wrote:
> VMD may fail to create sysfs entries while `pci_rescan_bus()` called in
> some other drivers like t7xx wwan driver:
>
> sysfs: cannot create duplicate filename '/devices/.../resource0'
> Call Trace:
> <TASK>
> sysfs_warn_dup.cold+0x17/0x34
> sysfs_add_bin_file_mode_ns+0xc0/0xf0
> sysfs_create_bin_file+0x6d/0xb0
> pci_create_attr+0x117/0x260
> pci_create_resource_files+0x6b/0x150
> pci_create_sysfs_dev_files+0x18/0x30
> pci_bus_add_device+0x30/0x80
> pci_bus_add_devices+0x31/0x80
> pci_bus_add_devices+0x5b/0x80
> vmd_enable_domain.constprop.0+0x6b7/0x880 [vmd]
> vmd_probe+0x16d/0x193 [vmd]
>
> Fixes: 185a383ada2e ("x86/PCI: Add driver for Intel Volume Management Device (VMD)")
> Signed-off-by: You-Sheng Yang (vicamo) <vicamo.yang@canonical.com>
> ---
> drivers/pci/controller/vmd.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c
> index 769eedeb8802..f050991bd1e9 100644
> --- a/drivers/pci/controller/vmd.c
> +++ b/drivers/pci/controller/vmd.c
> @@ -838,9 +838,13 @@ static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features)
> pci_add_resource_offset(&resources, &vmd->resources[1], offset[0]);
> pci_add_resource_offset(&resources, &vmd->resources[2], offset[1]);
>
> + pci_lock_rescan_remove();
> +
> vmd->bus = pci_create_root_bus(&vmd->dev->dev, vmd->busn_start,
> &vmd_ops, sd, &resources);
> if (!vmd->bus) {
> + pci_unlock_rescan_remove();
> +
> pci_free_resource_list(&resources);
> vmd_remove_irq_domain(vmd);
> return -ENODEV;
> @@ -893,6 +897,8 @@ static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features)
>
> vmd_acpi_end();
>
> + pci_unlock_rescan_remove();
> +
> WARN(sysfs_create_link(&vmd->dev->dev.kobj, &vmd->bus->dev.kobj,
> "domain"), "Can't create symlink to domain\n");
> return 0;
Reviewed-by: Nirmal Patel <nirmal.patel@linux.intel.com>
Thanks
next prev parent reply other threads:[~2023-03-15 14:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-13 17:37 [PATCH] PCI: vmd: guard device addition and removal You-Sheng Yang (vicamo)
2023-03-15 14:39 ` Patel, Nirmal [this message]
2023-04-07 23:58 ` Bjorn Helgaas
2023-04-11 6:29 ` Alexander Stein
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=49907fd5-3069-dc19-1388-590e08600037@linux.intel.com \
--to=nirmal.patel@linux.intel.com \
--cc=bhelgaas@google.com \
--cc=jonathan.derrick@linux.dev \
--cc=kbusch@kernel.org \
--cc=kw@linux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=robh@kernel.org \
--cc=tglx@linutronix.de \
--cc=vicamo.yang@canonical.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