From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751959Ab3LLXUX (ORCPT ); Thu, 12 Dec 2013 18:20:23 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:59744 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751502Ab3LLXUT (ORCPT ); Thu, 12 Dec 2013 18:20:19 -0500 Date: Thu, 12 Dec 2013 15:22:09 -0800 From: Greg Kroah-Hartman To: Yinghai Lu Cc: Bjorn Helgaas , Neil Horman , Linus Torvalds , Veaceslav Falico , "linux-pci@vger.kernel.org" , Thomas Gleixner , Knut Petersen , Ingo Molnar , Paul McKenney , =?iso-8859-1?Q?Fr=E9d=E9ric?= Weisbecker , Linux Kernel Mailing List Subject: Re: [PATCH] PCI: export MSI mode using attributes, not kobjects Message-ID: <20131212232209.GA8543@kroah.com> References: <20131127184652.GA1856@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.22 (2013-10-16) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 12, 2013 at 03:17:50PM -0800, Yinghai Lu wrote: > On Sat, Dec 7, 2013 at 12:41 PM, Bjorn Helgaas wrote: > > On Wed, Nov 27, 2013 at 11:46 AM, Greg Kroah-Hartman > > wrote: > >> From: Greg Kroah-Hartman > >> > >> The PCI MSI sysfs code is a mess with kobjects for things that don't > >> really need to be kobjects. This patch creates attributes dynamically > >> for the MSI interrupts instead of using kobjects. > >> > >> Note, this removes a directory from the current MSI interrupt sysfs > >> code: > >> > >> old MSI kobjects: > >> pci_device > >> └── msi_irqs > >> └── 40 > >> └── mode > >> > >> new MSI attributes: > >> pci_device > >> └── msi_irqs > >> └── 40 > >> > >> As there was only one file "mode" with the kobject model, the interrupt > >> number is now a file that returns the "mode" of the interrupt (msi vs. > >> msix). > >> > >> Signed-off-by: Greg Kroah-Hartman > > > > I added the acks from Neil and Veaceslav, folded in the > > Documentation/ABI update, and applied the whole thing to my pci/misc > > branch for v3.14. Thanks! > > got: > [ 71.429735] BUG: key ffff887fcf082a58 not in .data! > [ 71.429737] ------------[ cut here ]------------ > [ 71.429742] WARNING: CPU: 0 PID: 4 at kernel/locking/lockdep.c:2987 lockdep_i > nit_map+0x127/0x5b0() > [ 71.429743] DEBUG_LOCKS_WARN_ON(1) > [ 71.429744] Modules linked in: > [ 71.429747] CPU: 0 PID: 4 Comm: kworker/0:0 Tainted: G I 3.13.0-rc3 > -yh-01187-ge0e4e4e-dirty #45 > [ 71.429757] Workqueue: events work_for_cpu_fn > [ 71.429792] 0000000000000009 ffff881fcf95da58 ffffffff82020475 ffff881fcf95d > aa0 > [ 71.429800] ffff881fcf95da90 ffffffff81097c3d ffff887fcf082a58 ffff88dfcec1a > d28 > [ 71.429809] 0000000000000000 0000000000000000 ffff889fcf2eecd0 ffff881fcf95d > af0 > [ 71.429809] Call Trace: > [ 71.429814] [] dump_stack+0x45/0x56 > [ 71.429818] [] warn_slowpath_common+0x7d/0xa0 > [ 71.429822] [] warn_slowpath_fmt+0x4c/0x50 > [ 71.429826] [] lockdep_init_map+0x127/0x5b0 > [ 71.429835] [] ? sysfs_new_dirent+0x98/0x140 > [ 71.429839] [] sysfs_add_file_mode_ns+0x63/0xc0 > [ 71.429843] [] internal_create_group+0x18d/0x260 > [ 71.429853] [] ? populate_msi_sysfs+0x185/0x1d0 > [ 71.429857] [] sysfs_create_groups+0x42/0xa0 > [ 71.429861] [] populate_msi_sysfs+0x1a7/0x1d0 > [ 71.429865] [] pci_enable_msi_block+0x1f7/0x2a0 > [ 71.429870] [] pcie_port_device_register+0x335/0x520 > [ 71.429874] [] pcie_portdrv_probe+0x68/0xa0 > [ 71.429883] [] local_pci_probe+0x45/0xa0 > [ 71.429887] [] work_for_cpu_fn+0x14/0x20 > [ 71.429891] [] process_one_work+0x28b/0x4a0 > [ 71.429895] [] ? process_one_work+0x202/0x4a0 > [ 71.429899] [] worker_thread+0x26b/0x3a0 > [ 71.429903] [] ? trace_hardirqs_on+0xd/0x10 > [ 71.429906] [] ? manage_workers.isra.17+0x340/0x340 > [ 71.429912] [] kthread+0x111/0x120 > [ 71.429919] [] ? local_clock+0x2b/0x40 > [ 71.429923] [] ? kthread_stop+0xf0/0xf0 > [ 71.429927] [] ret_from_fork+0x7c/0xb0 > [ 71.429931] [] ? kthread_stop+0xf0/0xf0 > [ 71.429933] ---[ end trace c511e3d74efea94e ]--- > > looks like Greg forgot adding attr init. > > Can you fold attached patch into Greg's patch ? > > Index: linux-2.6/drivers/pci/msi.c > =================================================================== > --- linux-2.6.orig/drivers/pci/msi.c > +++ linux-2.6/drivers/pci/msi.c > @@ -547,6 +547,7 @@ static int populate_msi_sysfs(struct pci > msi_dev_attr = kzalloc(sizeof(*msi_dev_attr), GFP_KERNEL); > if (!msi_dev_attr) > return -ENOMEM; > + sysfs_attr_init(&msi_dev_attr->attr); > sprintf(name, "%d", entry->irq); > msi_dev_attr->attr.name = name; > msi_dev_attr->attr.mode = S_IRUGO; > --- > drivers/pci/msi.c | 1 + > 1 file changed, 1 insertion(+) > > Index: linux-2.6/drivers/pci/msi.c > =================================================================== > --- linux-2.6.orig/drivers/pci/msi.c > +++ linux-2.6/drivers/pci/msi.c > @@ -547,6 +547,7 @@ static int populate_msi_sysfs(struct pci > msi_dev_attr = kzalloc(sizeof(*msi_dev_attr), GFP_KERNEL); > if (!msi_dev_attr) > return -ENOMEM; > + sysfs_attr_init(&msi_dev_attr->attr); > sprintf(name, "%d", entry->irq); > msi_dev_attr->attr.name = name; > msi_dev_attr->attr.mode = S_IRUGO; Ah, crap, yes, you are right, my fault, very nice catch. Acked-by: Greg Kroah-Hartman greg k-h