lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b8f0d64d-8a29-aa4f-c764-397e87527600@loongson.cn>
Date:   Fri, 11 Sep 2020 09:54:40 +0800
From:   Tiezhu Yang <yangtiezhu@...ngson.cn>
To:     Bjorn Helgaas <helgaas@...nel.org>
Cc:     Bjorn Helgaas <bhelgaas@...gle.com>, linux-pci@...r.kernel.org,
        linux-kernel@...r.kernel.org,
        "Rafael J. Wysocki" <rafael.j.wysocki@...el.com>,
        Xuefeng Li <lixuefeng@...ngson.cn>,
        Huacai Chen <chenhc@...ote.com>,
        Jiaxun Yang <jiaxun.yang@...goat.com>
Subject: Re: [RFC PATCH] PCI/portdrv: No need to call pci_disable_device()
 during shutdown

On 09/11/2020 04:21 AM, Bjorn Helgaas wrote:
> [+cc Huacai]
>
> On Thu, Sep 10, 2020 at 02:41:39PM -0500, Bjorn Helgaas wrote:
>> On Sat, Sep 05, 2020 at 04:33:26PM +0800, Tiezhu Yang wrote:
>>> After commit 745be2e700cd ("PCIe: portdrv: call pci_disable_device
>>> during remove") and commit cc27b735ad3a ("PCI/portdrv: Turn off PCIe
>>> services during shutdown"), it also calls pci_disable_device() during
>>> shutdown, this seems unnecessary, so just remove it.
>> I would like to get rid of the portdrv completely by folding its
>> functionality into the PCI core itself, so there would be no portdrv
>> probe or remove.
>>
>> Does this solve a problem?

Yes, sometimes it can not shutdown or reboot normally with 
pci_disable_device().

>> If not, I'm inclined to just leave it
>> as-is for now.  But if it fixes something, we should do the fix, of
>> course.
> This looks awfully similar to [1], so I guess we *do* need to do
> something here.  I'll respond there since it has more details.
>
> [1] https://lore.kernel.org/r/1596268180-9114-1-git-send-email-chenhc@lemote.com
>
>>> Signed-off-by: Tiezhu Yang <yangtiezhu@...ngson.cn>
>>> ---
>>>   drivers/pci/pcie/portdrv_core.c |  1 -
>>>   drivers/pci/pcie/portdrv_pci.c  | 14 +++++++++++++-
>>>   2 files changed, 13 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/drivers/pci/pcie/portdrv_core.c b/drivers/pci/pcie/portdrv_core.c
>>> index 50a9522..1991aca 100644
>>> --- a/drivers/pci/pcie/portdrv_core.c
>>> +++ b/drivers/pci/pcie/portdrv_core.c
>>> @@ -491,7 +491,6 @@ void pcie_port_device_remove(struct pci_dev *dev)
>>>   {
>>>   	device_for_each_child(&dev->dev, NULL, remove_iter);
>>>   	pci_free_irq_vectors(dev);
>>> -	pci_disable_device(dev);
>>>   }
>>>   
>>>   /**
>>> diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c
>>> index 3a3ce40..cab37a8 100644
>>> --- a/drivers/pci/pcie/portdrv_pci.c
>>> +++ b/drivers/pci/pcie/portdrv_pci.c
>>> @@ -143,6 +143,18 @@ static void pcie_portdrv_remove(struct pci_dev *dev)
>>>   	}
>>>   
>>>   	pcie_port_device_remove(dev);
>>> +	pci_disable_device(dev);
>>> +}
>>> +
>>> +static void pcie_portdrv_shutdown(struct pci_dev *dev)
>>> +{
>>> +	if (pci_bridge_d3_possible(dev)) {
>>> +		pm_runtime_forbid(&dev->dev);
>>> +		pm_runtime_get_noresume(&dev->dev);
>>> +		pm_runtime_dont_use_autosuspend(&dev->dev);
>>> +	}
>>> +
>>> +	pcie_port_device_remove(dev);
>>>   }
>>>   
>>>   static pci_ers_result_t pcie_portdrv_error_detected(struct pci_dev *dev,
>>> @@ -211,7 +223,7 @@ static struct pci_driver pcie_portdriver = {
>>>   
>>>   	.probe		= pcie_portdrv_probe,
>>>   	.remove		= pcie_portdrv_remove,
>>> -	.shutdown	= pcie_portdrv_remove,
>>> +	.shutdown	= pcie_portdrv_shutdown,
>>>   
>>>   	.err_handler	= &pcie_portdrv_err_handler,
>>>   
>>> -- 
>>> 2.1.0
>>>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ