[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <09d281b2-bba7-0708-9c15-0553d6c49117@huawei.com>
Date: Thu, 17 Aug 2023 09:07:07 +0800
From: Yu Liao <liaoyu15@...wei.com>
To: Leon Romanovsky <leon@...nel.org>
CC: <netdev@...r.kernel.org>, <davem@...emloft.net>, <edumazet@...gle.com>,
<kuba@...nel.org>, <pabeni@...hat.com>, <liwei391@...wei.com>, Xiongfeng Wang
<wangxiongfeng2@...wei.com>
Subject: Re: [PATCH net-next] pds_core: remove redundant pci_clear_master()
On 2023/8/16 18:39, Leon Romanovsky wrote:
> On Wed, Aug 16, 2023 at 05:39:33PM +0800, Yu Liao wrote:
>> On 2023/8/16 14:38, Leon Romanovsky wrote:
>>> On Wed, Aug 16, 2023 at 09:38:02AM +0800, Yu Liao wrote:
>>>> pci_disable_device() involves disabling PCI bus-mastering. So remove
>>>> redundant pci_clear_master().
>>>
>>> I would say that this commit message needs to be more descriptive and
>>> explain why pci_disable_device() will actually disable PCI in these
>>> flows.
>>>
>>> According to the doc and code:
>>> 2263 * Note we don't actually disable the device until all callers of
>>> 2264 * pci_enable_device() have called pci_disable_device().
>>>
>>> Thanks
>>>
>> Thank you for the review. My bad, I didn't describe it clearly in commit
>> message. I will send the v2 version and add the following explanation:
>>
>> do_pci_disable_device() disable PCI bus-mastering as following:
>> static void do_pci_disable_device(struct pci_dev *dev)
>> {
>> u16 pci_command;
>>
>> pci_read_config_word(dev, PCI_COMMAND, &pci_command);
>> if (pci_command & PCI_COMMAND_MASTER) {
>> pci_command &= ~PCI_COMMAND_MASTER;
>> pci_write_config_word(dev, PCI_COMMAND, pci_command);
>> }
>>
>> pcibios_disable_device(dev);
>> }
>> And pci_disable_device() sets dev->is_busmaster to 0.
>>
>> So for pci_dev that has called pci_enable_device(), pci_disable_device()
>> involves disabling PCI bus-mastering. Remove redundant pci_clear_master() in
>> the following places:
>> - In error path 'err_out_clear_master' of pdsc_probe(), pci_enable_device()
>> has already been called.
>> - In pdsc_remove(), pci_enable_device() has already been called in pdsc_probe().
>
> All that you need to add is a sentence that pci_enable_device() is
> called only once before calling to pci_disable_device() and such
> pci_clear_master() is not needed.
>
Thank you for the review. I'll make the suggested changes and send the V2.
Best regards,
Yu
> Thanks
Powered by blists - more mailing lists