Message ID | 20240529114901.344655-1-imre.deak@intel.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | [core-for-CI] PCI: Make PCI cfg_access_lock lockdep key a singleton | expand |
Hi, Commenting to list too. > -----Original Message----- > From: Deak, Imre <imre.deak@intel.com> > Sent: Wednesday, 29 May 2024 14.49 > To: intel-gfx@lists.freedesktop.org > Cc: Williams, Dan J <dan.j.williams@intel.com>; Saarinen, Jani > <jani.saarinen@intel.com>; Jiang, Dave <dave.jiang@intel.com>; Bjorn > Helgaas <bhelgaas@google.com> > Subject: [core-for-CI PATCH] PCI: Make PCI cfg_access_lock lockdep key a > singleton > > From: Dan Williams <dan.j.williams@intel.com> > > The new lockdep annotation for cfg_access_lock naively registered a new key > per device. This is overkill and leads to warnings on hash collisions at > dynamic registration time: > > WARNING: CPU: 0 PID: 1 at kernel/locking/lockdep.c:1226 > lockdep_register_key+0xb0/0x240 > RIP: 0010:lockdep_register_key+0xb0/0x240 > [..] > Call Trace: > <TASK> > ? __warn+0x8c/0x190 > ? lockdep_register_key+0xb0/0x240 > ? report_bug+0x1f8/0x200 > ? handle_bug+0x3c/0x70 > ? exc_invalid_op+0x18/0x70 > ? asm_exc_invalid_op+0x1a/0x20 > ? lockdep_register_key+0xb0/0x240 > pci_device_add+0x14b/0x560 > ? pci_setup_device+0x42e/0x6a0 > pci_scan_single_device+0xa7/0xd0 > p2sb_scan_and_cache_devfn+0xc/0x90 > p2sb_fs_init+0x15f/0x170 > > Switch to a shared static key for all instances. > > Fixes: 7e89efc6e9e4 ("PCI: Lock upstream bridge for pci_reset_function()") > Reported-by: Jani Saarinen <jani.saarinen@intel.com> > Closes: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_14834/bat-apl- > 1/boot0.txt > Cc: Dave Jiang <dave.jiang@intel.com> > Cc: Bjorn Helgaas <bhelgaas@google.com> > Signed-off-by: Dan Williams <dan.j.williams@intel.com> See patch sent to intel-gfx https://patchwork.freedesktop.org/series/134186/ => https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_134186v1/index.html?hosts=apl => No taint in the boot and system does testing again: https://intel-gfx-ci.01.org/tree/drm-tip/Patchwork_134186v1/bat-all.html?hosts=apl With that: Tested-By: Jani Saarinen <jani.saarinen@intel.com> or our CI, what ever. Thanks. Could someone ack this to get this merged to core-for-ci until official fix lands? Use this while merging to core-for-ci: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/11223 Br, Jani > --- > drivers/pci/probe.c | 7 ++++--- > include/linux/pci.h | 1 - > 2 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index > 8e696e547565c..15168881ec941 100644 > --- a/drivers/pci/probe.c > +++ b/drivers/pci/probe.c > @@ -2533,6 +2533,8 @@ static void pci_set_msi_domain(struct pci_dev > *dev) > dev_set_msi_domain(&dev->dev, d); > } > > +static struct lock_class_key cfg_access_key; > + > void pci_device_add(struct pci_dev *dev, struct pci_bus *bus) { > int ret; > @@ -2546,9 +2548,8 @@ void pci_device_add(struct pci_dev *dev, struct > pci_bus *bus) > dev->dev.dma_mask = &dev->dma_mask; > dev->dev.dma_parms = &dev->dma_parms; > dev->dev.coherent_dma_mask = 0xffffffffull; > - lockdep_register_key(&dev->cfg_access_key); > - lockdep_init_map(&dev->cfg_access_lock, dev_name(&dev->dev), > - &dev->cfg_access_key, 0); > + lockdep_init_map(&dev->cfg_access_lock, "&dev->cfg_access_lock", > + &cfg_access_key, 0); > > dma_set_max_seg_size(&dev->dev, 65536); > dma_set_seg_boundary(&dev->dev, 0xffffffff); diff --git > a/include/linux/pci.h b/include/linux/pci.h index > fb004fd4e8890..5bece7fd11f88 100644 > --- a/include/linux/pci.h > +++ b/include/linux/pci.h > @@ -413,7 +413,6 @@ struct pci_dev { > struct resource driver_exclusive_resource; /* driver exclusive > resource ranges */ > > bool match_driver; /* Skip attaching driver */ > - struct lock_class_key cfg_access_key; > struct lockdep_map cfg_access_lock; > > unsigned int transparent:1; /* Subtractive decode bridge > */ > -- > 2.43.3
On Wed, 29 May 2024, Imre Deak <imre.deak@intel.com> wrote: > From: Dan Williams <dan.j.williams@intel.com> > > The new lockdep annotation for cfg_access_lock naively registered a new > key per device. This is overkill and leads to warnings on hash > collisions at dynamic registration time: > > WARNING: CPU: 0 PID: 1 at kernel/locking/lockdep.c:1226 lockdep_register_key+0xb0/0x240 > RIP: 0010:lockdep_register_key+0xb0/0x240 > [..] > Call Trace: > <TASK> > ? __warn+0x8c/0x190 > ? lockdep_register_key+0xb0/0x240 > ? report_bug+0x1f8/0x200 > ? handle_bug+0x3c/0x70 > ? exc_invalid_op+0x18/0x70 > ? asm_exc_invalid_op+0x1a/0x20 > ? lockdep_register_key+0xb0/0x240 > pci_device_add+0x14b/0x560 > ? pci_setup_device+0x42e/0x6a0 > pci_scan_single_device+0xa7/0xd0 > p2sb_scan_and_cache_devfn+0xc/0x90 > p2sb_fs_init+0x15f/0x170 > > Switch to a shared static key for all instances. > > Fixes: 7e89efc6e9e4 ("PCI: Lock upstream bridge for pci_reset_function()") > Reported-by: Jani Saarinen <jani.saarinen@intel.com> > Closes: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_14834/bat-apl-1/boot0.txt > Cc: Dave Jiang <dave.jiang@intel.com> > Cc: Bjorn Helgaas <bhelgaas@google.com> > Signed-off-by: Dan Williams <dan.j.williams@intel.com> Dropped extra Cc's. Acked-by: Jani Nikula <jani.nikula@intel.com> for merging to topic/core-for-CI. Please create the issue at gitlab, label it core-for-CI, and add References: to it here. > --- > drivers/pci/probe.c | 7 ++++--- > include/linux/pci.h | 1 - > 2 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c > index 8e696e547565c..15168881ec941 100644 > --- a/drivers/pci/probe.c > +++ b/drivers/pci/probe.c > @@ -2533,6 +2533,8 @@ static void pci_set_msi_domain(struct pci_dev *dev) > dev_set_msi_domain(&dev->dev, d); > } > > +static struct lock_class_key cfg_access_key; > + > void pci_device_add(struct pci_dev *dev, struct pci_bus *bus) > { > int ret; > @@ -2546,9 +2548,8 @@ void pci_device_add(struct pci_dev *dev, struct pci_bus *bus) > dev->dev.dma_mask = &dev->dma_mask; > dev->dev.dma_parms = &dev->dma_parms; > dev->dev.coherent_dma_mask = 0xffffffffull; > - lockdep_register_key(&dev->cfg_access_key); > - lockdep_init_map(&dev->cfg_access_lock, dev_name(&dev->dev), > - &dev->cfg_access_key, 0); > + lockdep_init_map(&dev->cfg_access_lock, "&dev->cfg_access_lock", > + &cfg_access_key, 0); > > dma_set_max_seg_size(&dev->dev, 65536); > dma_set_seg_boundary(&dev->dev, 0xffffffff); > diff --git a/include/linux/pci.h b/include/linux/pci.h > index fb004fd4e8890..5bece7fd11f88 100644 > --- a/include/linux/pci.h > +++ b/include/linux/pci.h > @@ -413,7 +413,6 @@ struct pci_dev { > struct resource driver_exclusive_resource; /* driver exclusive resource ranges */ > > bool match_driver; /* Skip attaching driver */ > - struct lock_class_key cfg_access_key; > struct lockdep_map cfg_access_lock; > > unsigned int transparent:1; /* Subtractive decode bridge */
[+cc linux-pci, this is a follow-up to 7e89efc6e9e4, which appeared in v6.10-rc1 via the PCI tree] On Wed, May 29, 2024 at 02:49:01PM +0300, Imre Deak wrote: > From: Dan Williams <dan.j.williams@intel.com> > > The new lockdep annotation for cfg_access_lock naively registered a new > key per device. This is overkill and leads to warnings on hash > collisions at dynamic registration time: > > WARNING: CPU: 0 PID: 1 at kernel/locking/lockdep.c:1226 lockdep_register_key+0xb0/0x240 > RIP: 0010:lockdep_register_key+0xb0/0x240 > [..] > Call Trace: > <TASK> > ? __warn+0x8c/0x190 > ? lockdep_register_key+0xb0/0x240 > ? report_bug+0x1f8/0x200 > ? handle_bug+0x3c/0x70 > ? exc_invalid_op+0x18/0x70 > ? asm_exc_invalid_op+0x1a/0x20 > ? lockdep_register_key+0xb0/0x240 > pci_device_add+0x14b/0x560 > ? pci_setup_device+0x42e/0x6a0 > pci_scan_single_device+0xa7/0xd0 > p2sb_scan_and_cache_devfn+0xc/0x90 > p2sb_fs_init+0x15f/0x170 > > Switch to a shared static key for all instances. > > Fixes: 7e89efc6e9e4 ("PCI: Lock upstream bridge for pci_reset_function()") > Reported-by: Jani Saarinen <jani.saarinen@intel.com> > Closes: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_14834/bat-apl-1/boot0.txt > Cc: Dave Jiang <dave.jiang@intel.com> > Cc: Bjorn Helgaas <bhelgaas@google.com> > Signed-off-by: Dan Williams <dan.j.williams@intel.com> > --- > drivers/pci/probe.c | 7 ++++--- > include/linux/pci.h | 1 - > 2 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c > index 8e696e547565c..15168881ec941 100644 > --- a/drivers/pci/probe.c > +++ b/drivers/pci/probe.c > @@ -2533,6 +2533,8 @@ static void pci_set_msi_domain(struct pci_dev *dev) > dev_set_msi_domain(&dev->dev, d); > } > > +static struct lock_class_key cfg_access_key; > + > void pci_device_add(struct pci_dev *dev, struct pci_bus *bus) > { > int ret; > @@ -2546,9 +2548,8 @@ void pci_device_add(struct pci_dev *dev, struct pci_bus *bus) > dev->dev.dma_mask = &dev->dma_mask; > dev->dev.dma_parms = &dev->dma_parms; > dev->dev.coherent_dma_mask = 0xffffffffull; > - lockdep_register_key(&dev->cfg_access_key); > - lockdep_init_map(&dev->cfg_access_lock, dev_name(&dev->dev), > - &dev->cfg_access_key, 0); > + lockdep_init_map(&dev->cfg_access_lock, "&dev->cfg_access_lock", > + &cfg_access_key, 0); > > dma_set_max_seg_size(&dev->dev, 65536); > dma_set_seg_boundary(&dev->dev, 0xffffffff); > diff --git a/include/linux/pci.h b/include/linux/pci.h > index fb004fd4e8890..5bece7fd11f88 100644 > --- a/include/linux/pci.h > +++ b/include/linux/pci.h > @@ -413,7 +413,6 @@ struct pci_dev { > struct resource driver_exclusive_resource; /* driver exclusive resource ranges */ > > bool match_driver; /* Skip attaching driver */ > - struct lock_class_key cfg_access_key; > struct lockdep_map cfg_access_lock; > > unsigned int transparent:1; /* Subtractive decode bridge */ > -- > 2.43.3 >
On Wed, May 29, 2024 at 02:49:01PM +0300, Imre Deak wrote: > From: Dan Williams <dan.j.williams@intel.com> > > The new lockdep annotation for cfg_access_lock naively registered a new > key per device. This is overkill and leads to warnings on hash > collisions at dynamic registration time: > > WARNING: CPU: 0 PID: 1 at kernel/locking/lockdep.c:1226 lockdep_register_key+0xb0/0x240 > RIP: 0010:lockdep_register_key+0xb0/0x240 > [..] > Call Trace: > <TASK> > ? __warn+0x8c/0x190 > ? lockdep_register_key+0xb0/0x240 > ? report_bug+0x1f8/0x200 > ? handle_bug+0x3c/0x70 > ? exc_invalid_op+0x18/0x70 > ? asm_exc_invalid_op+0x1a/0x20 > ? lockdep_register_key+0xb0/0x240 > pci_device_add+0x14b/0x560 > ? pci_setup_device+0x42e/0x6a0 > pci_scan_single_device+0xa7/0xd0 > p2sb_scan_and_cache_devfn+0xc/0x90 > p2sb_fs_init+0x15f/0x170 > > Switch to a shared static key for all instances. > > Fixes: 7e89efc6e9e4 ("PCI: Lock upstream bridge for pci_reset_function()") > Reported-by: Jani Saarinen <jani.saarinen@intel.com> > Closes: https://intel-gfx-ci.01.org/tree/drm-tip/CI_DRM_14834/bat-apl-1/boot0.txt > Cc: Dave Jiang <dave.jiang@intel.com> > Cc: Bjorn Helgaas <bhelgaas@google.com> > Signed-off-by: Dan Williams <dan.j.williams@intel.com> FWIW, this patch has been applied to the PCI tree for v6.10: https://lore.kernel.org/r/20240530173659.GA553323@bhelgaas > --- > drivers/pci/probe.c | 7 ++++--- > include/linux/pci.h | 1 - > 2 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c > index 8e696e547565c..15168881ec941 100644 > --- a/drivers/pci/probe.c > +++ b/drivers/pci/probe.c > @@ -2533,6 +2533,8 @@ static void pci_set_msi_domain(struct pci_dev *dev) > dev_set_msi_domain(&dev->dev, d); > } > > +static struct lock_class_key cfg_access_key; > + > void pci_device_add(struct pci_dev *dev, struct pci_bus *bus) > { > int ret; > @@ -2546,9 +2548,8 @@ void pci_device_add(struct pci_dev *dev, struct pci_bus *bus) > dev->dev.dma_mask = &dev->dma_mask; > dev->dev.dma_parms = &dev->dma_parms; > dev->dev.coherent_dma_mask = 0xffffffffull; > - lockdep_register_key(&dev->cfg_access_key); > - lockdep_init_map(&dev->cfg_access_lock, dev_name(&dev->dev), > - &dev->cfg_access_key, 0); > + lockdep_init_map(&dev->cfg_access_lock, "&dev->cfg_access_lock", > + &cfg_access_key, 0); > > dma_set_max_seg_size(&dev->dev, 65536); > dma_set_seg_boundary(&dev->dev, 0xffffffff); > diff --git a/include/linux/pci.h b/include/linux/pci.h > index fb004fd4e8890..5bece7fd11f88 100644 > --- a/include/linux/pci.h > +++ b/include/linux/pci.h > @@ -413,7 +413,6 @@ struct pci_dev { > struct resource driver_exclusive_resource; /* driver exclusive resource ranges */ > > bool match_driver; /* Skip attaching driver */ > - struct lock_class_key cfg_access_key; > struct lockdep_map cfg_access_lock; > > unsigned int transparent:1; /* Subtractive decode bridge */ > -- > 2.43.3 >
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index 8e696e547565c..15168881ec941 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -2533,6 +2533,8 @@ static void pci_set_msi_domain(struct pci_dev *dev) dev_set_msi_domain(&dev->dev, d); } +static struct lock_class_key cfg_access_key; + void pci_device_add(struct pci_dev *dev, struct pci_bus *bus) { int ret; @@ -2546,9 +2548,8 @@ void pci_device_add(struct pci_dev *dev, struct pci_bus *bus) dev->dev.dma_mask = &dev->dma_mask; dev->dev.dma_parms = &dev->dma_parms; dev->dev.coherent_dma_mask = 0xffffffffull; - lockdep_register_key(&dev->cfg_access_key); - lockdep_init_map(&dev->cfg_access_lock, dev_name(&dev->dev), - &dev->cfg_access_key, 0); + lockdep_init_map(&dev->cfg_access_lock, "&dev->cfg_access_lock", + &cfg_access_key, 0); dma_set_max_seg_size(&dev->dev, 65536); dma_set_seg_boundary(&dev->dev, 0xffffffff); diff --git a/include/linux/pci.h b/include/linux/pci.h index fb004fd4e8890..5bece7fd11f88 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -413,7 +413,6 @@ struct pci_dev { struct resource driver_exclusive_resource; /* driver exclusive resource ranges */ bool match_driver; /* Skip attaching driver */ - struct lock_class_key cfg_access_key; struct lockdep_map cfg_access_lock; unsigned int transparent:1; /* Subtractive decode bridge */