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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <00acf33c-b69f-061b-cac0-6dc7abd018f9@loongson.cn>
Date:   Mon, 14 Sep 2020 14:30:29 +0800
From:   Tiezhu Yang <yangtiezhu@...ngson.cn>
To:     Lukas Wunner <lukas@...ner.de>
Cc:     Bjorn Helgaas <bhelgaas@...gle.com>,
        Konstantin Khlebnikov <khlebnikov@...nvz.org>,
        Khalid Aziz <khalid.aziz@...cle.com>,
        Vivek Goyal <vgoyal@...hat.com>, oohall@...il.com,
        rafael.j.wysocki@...el.com, Xuefeng Li <lixuefeng@...ngson.cn>,
        Huacai Chen <chenhc@...ote.com>,
        Jiaxun Yang <jiaxun.yang@...goat.com>,
        linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH v2] PCI/portdrv: Only disable Bus Master on kexec
 reboot and connected PCI devices

On 09/14/2020 02:13 PM, Tiezhu Yang wrote:
> On 09/14/2020 12:06 PM, Lukas Wunner wrote:
>> On Mon, Sep 14, 2020 at 04:29:10AM +0800, Tiezhu Yang wrote:
>>> --- a/drivers/pci/pcie/portdrv_pci.c
>>> +++ b/drivers/pci/pcie/portdrv_pci.c
>>> @@ -143,6 +144,28 @@ 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);
>>> +
>>> +    /*
>>> +     * If this is a kexec reboot, turn off Bus Master bit on the
>>> +     * device to tell it to not continue to do DMA. Don't touch
>>> +     * devices in D3cold or unknown states.
>>> +     * If it is not a kexec reboot, firmware will hit the PCI
>>> +     * devices with big hammer and stop their DMA any way.
>>> +     */
>>> +    if (kexec_in_progress && (dev->current_state <= PCI_D3hot))
>>> +        pci_disable_device(dev);
>> The last portion of this function is already executed afterwards by
>> pci_device_shutdown().  You don't need to duplicate it here:
>>
>> device_shutdown()
>>    dev->bus->shutdown() == pci_device_shutdown()
>>      drv->shutdown() == pcie_portdrv_shutdown()
>>        pci_disable_device()
>>      pci_disable_device()
>
> pcie_port_device_remove() deletes pci_disable_device(dev)  at the 
> beginning of this patch.

Sorry, I misunderstood your meaning, you are right.

>
>
> diff 
> <https://lore.kernel.org/linux-pci/CAAhV-H5-X9OcBe3iRxF8PnKW-0j_10FVqm8cbiqW2-Lv4mTTdQ@mail.gmail.com/T/#iZ2e.:..:1600028950-10644-1-git-send-email-yangtiezhu::40loongson.cn:0drivers:pci:pcie:portdrv_core.c> 
> --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);   }
>
>>
>> Thanks,
>>
>> Lukas

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ