From: Jason Wang <jasowang@redhat.com>
To: Jason Gunthorpe <jgg@mellanox.com>
Cc: mst@redhat.com, linux-kernel@vger.kernel.org,
kvm@vger.kernel.org, virtualization@lists.linux-foundation.org,
netdev@vger.kernel.org, maxime.coquelin@redhat.com,
cunming.liang@intel.com, zhihong.wang@intel.com,
rob.miller@broadcom.com, xiao.w.wang@intel.com,
lingshan.zhu@intel.com, eperezma@redhat.com, lulu@redhat.com,
parav@mellanox.com, kevin.tian@intel.com, stefanha@redhat.com,
rdunlap@infradead.org, hch@infradead.org, aadam@redhat.com,
jiri@mellanox.com, shahafs@mellanox.com, hanand@xilinx.com,
mhabets@solarflare.com, gdawar@xilinx.com, saugatm@xilinx.com,
vmireyno@marvell.com, Bie Tiwei <tiwei.bie@intel.com>
Subject: Re: [PATCH V8 9/9] virtio: Intel IFC VF driver for VDPA
Date: Thu, 26 Mar 2020 21:56:48 +0800 [thread overview]
Message-ID: <a03edad7-e1c9-ae2f-5843-d63907289a3f@redhat.com> (raw)
In-Reply-To: <20200326121705.GJ13183@mellanox.com>
On 2020/3/26 下午8:17, Jason Gunthorpe wrote:
> On Thu, Mar 26, 2020 at 01:50:53PM +0800, Jason Wang wrote:
>
>>>> + adapter->vdpa.dma_dev = dev;
>>>> + ret = vdpa_register_device(&adapter->vdpa);
>>>> + if (ret) {
>>>> + IFCVF_ERR(adapter->dev, "Failed to register ifcvf to vdpa bus");
>>>> + goto err_msix;
>>>> + }
>>>> +
>>>> + return 0;
>>>> +
>>>> +err_msix:
>>>> + put_device(&adapter->vdpa.dev);
>>>> + return ret;
>>>> +err_alloc:
>>>> + pci_free_irq_vectors(pdev);
>>>> +err_vectors:
>>>> + pci_release_regions(pdev);
>>>> +err_regions:
>>>> + pci_disable_device(pdev);
>>>> +err_enable:
>>>> + return ret;
>>>> +}
>>> I personally don't like seeing goto unwinds with multiple returns, and
>>> here I think it is actually a tiny bug.
>>>
>>> All touches to the PCI device must stop before the driver core
>>> remove() returns - so these pci function cannot be in the kref put
>>> release function anyhow.
>>
>> I'm not sure I get here. IFCVF held refcnt of its PCI parent, so it looks to
>> me it's safe to free PCI resources in vDPA free callback?
> The refcnt doesn't prevent the driver core from re-binding the
> pci_device to another driver. Then the refcount put would do a
> pci_disable_device() after another driver has started
>
> For this reason all touches to a struct pci_device must stop before
> remove returns.
>
> Jason
Ok, will send a new version shortly.
Thanks
>
prev parent reply other threads:[~2020-03-26 13:57 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-25 8:27 [PATCH V8 0/9] vDPA support Jason Wang
2020-03-25 8:27 ` [PATCH V8 1/9] vhost: refine vhost and vringh kconfig Jason Wang
2020-03-25 8:27 ` [PATCH V8 2/9] vhost: allow per device message handler Jason Wang
2020-03-25 8:27 ` [PATCH V8 3/9] vhost: factor out IOTLB Jason Wang
2020-03-25 8:27 ` [PATCH V8 4/9] vringh: IOTLB support Jason Wang
2020-03-25 8:27 ` [PATCH V8 5/9] vDPA: introduce vDPA bus Jason Wang
2020-03-25 12:29 ` Jason Gunthorpe
2020-03-26 5:51 ` Jason Wang
2020-03-25 8:27 ` [PATCH V8 6/9] virtio: introduce a vDPA based transport Jason Wang
2020-03-25 8:27 ` [PATCH V8 7/9] vhost: introduce vDPA-based backend Jason Wang
2020-03-25 8:27 ` [PATCH V8 8/9] vdpasim: vDPA device simulator Jason Wang
2020-03-25 8:27 ` [PATCH V8 9/9] virtio: Intel IFC VF driver for VDPA Jason Wang
2020-03-25 12:34 ` Jason Gunthorpe
2020-03-26 5:50 ` Jason Wang
2020-03-26 12:17 ` Jason Gunthorpe
2020-03-26 13:56 ` Jason Wang [this message]
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=a03edad7-e1c9-ae2f-5843-d63907289a3f@redhat.com \
--to=jasowang@redhat.com \
--cc=aadam@redhat.com \
--cc=cunming.liang@intel.com \
--cc=eperezma@redhat.com \
--cc=gdawar@xilinx.com \
--cc=hanand@xilinx.com \
--cc=hch@infradead.org \
--cc=jgg@mellanox.com \
--cc=jiri@mellanox.com \
--cc=kevin.tian@intel.com \
--cc=kvm@vger.kernel.org \
--cc=lingshan.zhu@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lulu@redhat.com \
--cc=maxime.coquelin@redhat.com \
--cc=mhabets@solarflare.com \
--cc=mst@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=parav@mellanox.com \
--cc=rdunlap@infradead.org \
--cc=rob.miller@broadcom.com \
--cc=saugatm@xilinx.com \
--cc=shahafs@mellanox.com \
--cc=stefanha@redhat.com \
--cc=tiwei.bie@intel.com \
--cc=virtualization@lists.linux-foundation.org \
--cc=vmireyno@marvell.com \
--cc=xiao.w.wang@intel.com \
--cc=zhihong.wang@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox