From mboxrd@z Thu Jan 1 00:00:00 1970 From: Greg Kroah-Hartman Subject: Re: [PATCH][tentative] PCI / ACPI: Rework PCI host bridge removal to avoid sysfs warnings Date: Sat, 28 Dec 2013 19:59:25 -0800 Message-ID: <20131229035925.GC26111@kroah.com> References: <37552283.kG1L4S8Daa@vostro.rjw.lan> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mail.linuxfoundation.org ([140.211.169.12]:38626 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751963Ab3L2D6p (ORCPT ); Sat, 28 Dec 2013 22:58:45 -0500 Content-Disposition: inline In-Reply-To: <37552283.kG1L4S8Daa@vostro.rjw.lan> Sender: linux-acpi-owner@vger.kernel.org List-Id: linux-acpi@vger.kernel.org To: "Rafael J. Wysocki" Cc: Bjorn Helgaas , Yinghai Lu , Linux PCI , ACPI Devel Maling List , LKML , Yasuaki Ishimatsu , Tejun Heo On Sun, Dec 29, 2013 at 12:20:22AM +0100, Rafael J. Wysocki wrote: > From: Rafael J. Wysocki > > The device_del(&host_bridge->dev) in pci_stop_root_bus() is > problematic, because it causes all sysfs directories below > the host bridge to be removed recursively and when > pci_remove_root_bus() attempts to remove devices on the root > bus (whose sysfs directories are gone now along with all their > subdirectories), it causes warnings similar to this one to be > printed: > > WARNING: CPU: 0 PID: 6 at fs/sysfs/group.c:214 sysfs_remove_group+0xc6/0xd0() > sysfs group ffffffff819ac5c0 not found for kobject '0001:ff:10.2' > Modules linked in: > CPU: 0 PID: 6 Comm: kworker/u512:0 Tainted: G W 3.13.0-rc5+ #11 > Hardware name: > Workqueue: kacpi_hotplug acpi_hotplug_work_fn > 0000000000000009 ffff8808738d3bd8 ffffffff815d84ea ffff8808738d3c20 > ffff8808738d3c10 ffffffff8106594d 0000000000000000 ffffffff819ac5c0 > ffff880871b9d0a8 ffff8a07d1895000 0000000000000103 ffff8808738d3c70 > Call Trace: > [] dump_stack+0x45/0x56 > [] warn_slowpath_common+0x7d/0xa0 > [] warn_slowpath_fmt+0x4c/0x50 > [] ? sysfs_get_dirent_ns+0x4e/0x70 > [] sysfs_remove_group+0xc6/0xd0 > [] dpm_sysfs_remove+0x43/0x50 > [] device_del+0x45/0x1c0 > [] pci_remove_bus_device+0x66/0xd0 > [] pci_remove_root_bus+0x73/0x80 > [] acpi_pci_root_remove+0x42/0x4f > [] acpi_bus_trim+0x56/0x89 > [] acpi_bus_trim+0x38/0x89 > [] acpi_device_hotplug+0x137/0x33b > [] acpi_hotplug_work_fn+0x1c/0x27 > [] process_one_work+0x17b/0x460 > [] worker_thread+0x11b/0x400 > [] ? rescuer_thread+0x3e0/0x3e0 > [] kthread+0xd2/0xf0 > [] ? kthread_create_on_node+0x180/0x180 > [] ret_from_fork+0x7c/0xb0 > [] ? kthread_create_on_node+0x180/0x180 > > To avoid that, the host bridge device has to be deleted after all of > its children, so merge pci_stop_root_bus() and pci_remove_root_bus() > into one function, pci_stop_and_remove_root_bus(), that first will > use pci_stop_and_remove_bus_device() to stop and remove all devices > on the root bus and then will delete the host bridge device, remove > its bus and drop the final reference to it. > > Reported-by: Yasuaki Ishimatsu > Signed-off-by: Rafael J. Wysocki > --- > > Hi, > > I can't really test this patch, but I don't know how it can break anything. > > The only user of pci_stop_root_bus() and pci_remove_root_bus() is > acpi_pci_root_remove() and the code ordering there seems to be somewhat > arbitrary. If you are aware of any reason why it may not work, please let > me know. :-) Acked-by: Greg Kroah-Hartman