From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751843AbdBOLZS (ORCPT ); Wed, 15 Feb 2017 06:25:18 -0500 Received: from mga09.intel.com ([134.134.136.24]:59055 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751071AbdBOLZQ (ORCPT ); Wed, 15 Feb 2017 06:25:16 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.35,165,1484035200"; d="scan'208";a="58790019" Subject: Re: [PATCH] PCI/PME: Restore pcie_pme_driver.remove To: Yinghai Lu , Bjorn Helgaas References: <20170215051748.3346-1-yinghai@kernel.org> Cc: Paul Gortmaker , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org From: "Rafael J. Wysocki" Organization: Intel Technology Poland Sp. z o. o., KRS 101882, ul. Slowackiego 173, 80-298 Gdansk Message-ID: Date: Wed, 15 Feb 2017 12:25:12 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <20170215051748.3346-1-yinghai@kernel.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/15/2017 6:17 AM, Yinghai Lu wrote: > Found 4.9 and later, removing pci device for pcie port via /sys failed: > ------------[ cut here ]------------ > kernel BUG at drivers/pci/msi.c:370! > invalid opcode: 0000 [#1] SMP > Modules linked in: > CPU: 1 PID: 14509 Comm: sh Tainted: G W 4.8.0-rc1-yh-00012-gd29438d > RIP: 0010:[] free_msi_irqs+0x65/0x190 > ... > Call Trace: > [] pci_disable_msi+0x34/0x40 > [] cleanup_service_irqs+0x27/0x30 > [] pcie_port_device_remove+0x2a/0x40 > [] pcie_portdrv_remove+0x40/0x50 > [] pci_device_remove+0x4b/0xc0 > [] __device_release_driver+0xb6/0x150 > [] device_release_driver+0x25/0x40 > [] pci_stop_bus_device+0x74/0xa0 > [] pci_stop_and_remove_bus_device_locked+0x1a/0x30 > [] remove_store+0x50/0x70 > [] dev_attr_store+0x18/0x30 > [] sysfs_kf_write+0x44/0x60 > [] kernfs_fop_write+0x10e/0x190 > [] __vfs_write+0x28/0x110 > [] ? percpu_down_read+0x44/0x80 > [] ? __sb_start_write+0xa7/0xe0 > [] ? __sb_start_write+0xa7/0xe0 > [] vfs_write+0xc4/0x180 > [] SyS_write+0x49/0xa0 > [] do_syscall_64+0xa6/0x1b0 > [] entry_SYSCALL64_slow_path+0x25/0x25 > ... > RIP [] free_msi_irqs+0x65/0x190 > RSP > ---[ end trace f4505e1dac5b95d3 ]--- > Segmentation fault > > Bisect to commit d7def2040077 ("PCI/PME: Make explicitly non-modular"). > That commit did extra thing like remove the .remove for pcie_pme_driver. > > Put back pcie_pme_remove and restore to pcie_pme_driver fix the problem. > > Fixes: d7def2040077 ("PCI/PME: Make explicitly non-modular") > Cc: > Signed-off-by: Yinghai Lu ACK > diff --git a/drivers/pci/pcie/pme.c b/drivers/pci/pcie/pme.c > index 7175293..2dd1c68 100644 > --- a/drivers/pci/pcie/pme.c > +++ b/drivers/pci/pcie/pme.c > @@ -433,6 +433,17 @@ static int pcie_pme_resume(struct pcie_device *srv) > return 0; > } > > +/** > + * pcie_pme_remove - Prepare PCIe PME service device for removal. > + * @srv - PCIe service device to remove. > + */ > +static void pcie_pme_remove(struct pcie_device *srv) > +{ > + pcie_pme_suspend(srv); > + free_irq(srv->irq, srv); > + kfree(get_service_data(srv)); > +} > + > static struct pcie_port_service_driver pcie_pme_driver = { > .name = "pcie_pme", > .port_type = PCI_EXP_TYPE_ROOT_PORT, > @@ -441,6 +452,7 @@ static struct pcie_port_service_driver pcie_pme_driver = { > .probe = pcie_pme_probe, > .suspend = pcie_pme_suspend, > .resume = pcie_pme_resume, > + .remove = pcie_pme_remove, > }; > > /** Thanks, Rafael