public inbox for linux-pci@vger.kernel.org
 help / color / mirror / Atom feed
From: Alex Williamson <alex@shazbot.org>
To: "Anthony Pighin (Nokia)" <anthony.pighin@nokia.com>
Cc: "kvm@vger.kernel.org" <kvm@vger.kernel.org>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	Nathan Chen <nathanc@nvidia.com>,
	Jason Gunthorpe <jgg@nvidia.com>
Subject: Re: VFIO_GROUP_GET_DEVICE_FD triggering an "unlocked secondary bus reset" warning
Date: Mon, 12 Jan 2026 15:32:45 -0700	[thread overview]
Message-ID: <20260112153245.1e64dca9@shazbot.org> (raw)
In-Reply-To: <BN0PR08MB6951416BAFA500FC9902DAA68381A@BN0PR08MB6951.namprd08.prod.outlook.com>

On Mon, 12 Jan 2026 21:58:44 +0000
"Anthony Pighin (Nokia)" <anthony.pighin@nokia.com> wrote:

> When adding a PCI device to a VFIO group, the following is triggered:
> pcieport 0000:00:00.0: unlocked secondary bus reset via: pci_reset_bus_function+0x188/0x1b8 
> 
> As a result of:
> 920f6468924f ("PCI: Warn on missing cfg_access_lock during secondary bus reset")
> 
> PCI topology is very simple:
> # lspci -vvvtn
> -[0000:00]---00.0-[01-ff]----00.0  10ee:7011
> 
> Full backtrace is as follows:
> [  125.942637] Hardware name: Freescale ARMv8 based Layerscape SoC family
> [  125.942642] Call trace:
> [  125.942648]  dump_backtrace from show_stack+0x20/0x24
> [  125.942669]  r7:600f0013 r6:600f0013 r5:c11bd5e8 r4:00000000
> [  125.942672]  show_stack from dump_stack_lvl+0x58/0x6c
> [  125.942688]  dump_stack_lvl from dump_stack+0x18/0x1c
> [  125.942706]  r7:c3663483 r6:c1c2e000 r5:00000000 r4:c1c2e000
> [  125.942709]  dump_stack from pci_bridge_secondary_bus_reset+0x74/0x78
> [  125.942724]  pci_bridge_secondary_bus_reset from pci_reset_bus_function+0x188/0x1b8
> [  125.942740]  r5:00000000 r4:c3663000
> [  125.942742]  pci_reset_bus_function from __pci_reset_function_locked+0x4c/0x6c
> [  125.942761]  r6:c104aa58 r5:c3663000 r4:c366347c
> [  125.942764]  __pci_reset_function_locked from pci_try_reset_function+0x64/0xd4
> [  125.942782]  r7:c24b3700 r6:c36630cc r5:c3648400 r4:c3663000
> [  125.942784]  pci_try_reset_function from vfio_pci_core_enable+0x74/0x29c
> [  125.942802]  r7:c24b3700 r6:c3663000 r5:c3648400 r4:00000000
> [  125.942805]  vfio_pci_core_enable from vfio_pci_open_device+0x1c/0x34
> [  125.942825]  r7:c24b3700 r6:c3648400 r5:c3648400 r4:c3648400
> [  125.942828]  vfio_pci_open_device from vfio_df_open+0xc8/0xe4
> [  125.942844]  r5:00000000 r4:c3648400
> [  125.942847]  vfio_df_open from vfio_group_fops_unl_ioctl+0x3dc/0x704
> [  125.942861]  r7:c24b3700 r6:00000013 r5:c3179cc0 r4:c3648400
> [  125.942863]  vfio_group_fops_unl_ioctl from sys_ioctl+0x2d4/0xc80
> [  125.942879]  r10:c24b3700 r9:00000012 r8:c3757300 r7:beb3c8e8 r6:00003b6a r5:c3757301
> [  125.942883]  r4:00003b6a
> [  125.942886]  sys_ioctl from ret_fast_syscall+0x0/0x5c
> 
> Some added debug shows that the trylock is successful for the device being attached. However,
> the parent (controller) is not locked, leading to the warning.
> 
> [  126.254846] pci_cfg_access_trylock: locked for 0000:01:00.0
> [  126.255081] pci_parent_bus_reset called for dev 0000:01:00.0
> [  126.255086] pci_parent_bus_reset: checking conditions for dev 0000:01:00.0
> [  126.255091]   pci_is_root_bus: 0
> [  126.255096]   subordinate: 00000000
> [  126.255102]   bus->self: e8833d2c
> [  126.255108]   PCI_DEV_FLAGS_NO_BUS_RESET: 0
> [  126.255112] pci_parent_bus_reset: resetting bus for dev 0000:00:00.0
> [  126.255120] pcieport 0000:00:00.0: unlocked secondary bus reset via: pci_reset_bus_function+0x21c/0x220
> 
> The reset methods are as follows:
> # cat /sys/devices/platform/soc/3500000.pcie/pci0000:00/0000:00:00.0/reset_method
> pm
> # cat /sys/devices/platform/soc/3500000.pcie/pci0000:00/0000:00:00.0/0000:01:00.0/reset_method
> bus


Thanks for the report, I'm surprised we haven't seen more of this.
The warning was added in 7e89efc6e9e4 ("PCI: Lock upstream bridge for
pci_reset_function()"), where locking of the parent bridge was added
for pci_reset_function() but not for pci_try_reset_function().  There's
another case too where vfio_pci_core_disable() makes use of
__pci_reset_function_locked() and was also not updated to match the
requirement enforced by 7e89efc6e9e4  Thanks,

Alex

      reply	other threads:[~2026-01-12 22:32 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-12 21:58 VFIO_GROUP_GET_DEVICE_FD triggering an "unlocked secondary bus reset" warning Anthony Pighin (Nokia)
2026-01-12 22:32 ` Alex Williamson [this message]

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=20260112153245.1e64dca9@shazbot.org \
    --to=alex@shazbot.org \
    --cc=anthony.pighin@nokia.com \
    --cc=jgg@nvidia.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=nathanc@nvidia.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