From: Wei Yang <weiyang@linux.vnet.ibm.com>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: Wei Yang <weiyang@linux.vnet.ibm.com>,
Gavin Shan <gwshan@linux.vnet.ibm.com>,
"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>
Subject: Re: [PATCH] pci/iov: return a reference to PF on destroying VF
Date: Thu, 7 May 2015 10:35:58 +0800 [thread overview]
Message-ID: <20150507023557.GA6645@richard> (raw)
In-Reply-To: <CAErSpo7xis8=QWOeOubZmRxY0v3jSqC0WxGCo-KaEJisCJGB6Q@mail.gmail.com>
On Wed, May 06, 2015 at 10:30:39AM -0500, Bjorn Helgaas wrote:
>On Wed, May 6, 2015 at 1:09 AM, Wei Yang <weiyang@linux.vnet.ibm.com> wrote:
>> On Tue, May 05, 2015 at 04:29:05PM -0500, Bjorn Helgaas wrote:
>
>>>Prior to your patch, the VF reference was released in virtfn_remove(),
>>>which is only called via pci_disable_sriov(). This typically happens in
>>>a driver .remove() method. The reference is *not* released if we call
>>>pci_stop_and_remove_bus_device(VF) directly, as we would via the
>>>remove_store() (sysfs "remove" file) or hot unplug paths, e.g.,
>>>pciehp_unconfigure_device().
>>
>> You want to say the reference for VF or PF?
>
>Yes, I meant the PF reference.
>
>The hot unplug paths call pci_stop_and_remove_bus_device() for the VFs
>first, then the PF. Calling it for the VF releases the VF reference
>but not the PF one. Calling it for the PF will call virtfn_remove()
>via the driver's .remove() method, but it probably does nothing
>because when it calls pci_get_domain_bus_and_slot() to get the virtfn,
>it gets a NULL because the VF has already been removed.
>
>>>What about the other things done in virtfn_remove(), e.g., the sysfs link
>>>removal? Your patch fixes a reference count leak, but don't we still have
>>>a sysfs link leak?
>>
>> Agree, I am afraid the sysfs would have a leak too.
>>
>> While I am not that familiar with the sysfs part, I don't dare to move that to
>> pci_destroy_dev(). Need more investigation.
>
>OK. I don't want to fix half of the leak problem. I want to fix the
>whole thing at once.
>
Sure, I will do some investigation and repost it.
BTW, seems we also face the leak of the virtual bus. Will fix it in next
version too.
>Bjorn
--
Richard Yang
Help you, Help me
next prev parent reply other threads:[~2015-05-07 2:36 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-10 8:53 [PATCH] pci/iov: return a reference to PF on destroying VF Wei Yang
2015-05-05 21:29 ` Bjorn Helgaas
2015-05-06 6:09 ` Wei Yang
2015-05-06 15:30 ` Bjorn Helgaas
2015-05-07 2:35 ` Wei Yang [this message]
2015-05-06 7:25 ` Wei Yang
2015-05-06 15:23 ` Bjorn Helgaas
2015-05-07 2:40 ` Wei Yang
2015-05-08 3:53 ` [PATCH V2] pci/iov: fix resource leak " Wei Yang
2015-05-19 23:00 ` Bjorn Helgaas
2015-05-20 1:34 ` Wei Yang
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=20150507023557.GA6645@richard \
--to=weiyang@linux.vnet.ibm.com \
--cc=bhelgaas@google.com \
--cc=gwshan@linux.vnet.ibm.com \
--cc=linux-pci@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).