All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Yu Liao <liaoyu15@huawei.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
	kuba@kernel.org, pabeni@redhat.com, liwei391@huawei.com,
	Xiongfeng Wang <wangxiongfeng2@huawei.com>
Subject: Re: [PATCH net-next] pds_core: remove redundant pci_clear_master()
Date: Wed, 16 Aug 2023 13:39:41 +0300	[thread overview]
Message-ID: <20230816103941.GW22185@unreal> (raw)
In-Reply-To: <c232243d-0c5a-c253-5e3b-81be2479b776@huawei.com>

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.

Thanks

  reply	other threads:[~2023-08-16 10:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-16  1:38 [PATCH net-next] pds_core: remove redundant pci_clear_master() Yu Liao
2023-08-16  6:38 ` Leon Romanovsky
2023-08-16  9:39   ` Yu Liao
2023-08-16 10:39     ` Leon Romanovsky [this message]
2023-08-17  1:07       ` Yu Liao
2023-08-16 14:02 ` Nelson, Shannon
2023-08-17  1:11   ` Yu Liao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230816103941.GW22185@unreal \
    --to=leon@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=liaoyu15@huawei.com \
    --cc=liwei391@huawei.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=wangxiongfeng2@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.