[dpdk-dev] [PATCH v2] igb_uio: allow multi-process access

Wang, Xiao W xiao.w.wang at intel.com
Tue Dec 19 10:23:21 CET 2017


Thanks for pointing it out. Fix it in v3.

BRs,
Xiao

> -----Original Message-----
> From: Bie, Tiwei
> Sent: Tuesday, December 19, 2017 5:05 PM
> To: Wang, Xiao W <xiao.w.wang at intel.com>
> Cc: Yigit, Ferruh <ferruh.yigit at intel.com>; dev at dpdk.org;
> stephen at networkplumber.org
> Subject: Re: [dpdk-dev] [PATCH v2] igb_uio: allow multi-process access
> 
> Hi,
> 
> On Tue, Dec 19, 2017 at 07:42:20AM -0800, Xiao Wang wrote:
> > @@ -336,6 +337,10 @@ struct rte_uio_pci_dev {
> >  	struct pci_dev *dev = udev->pdev;
> >  	int err;
> >
> > +	atomic_inc(&udev->refcnt);
> > +	if (atomic_read(&udev->refcnt) > 1)
> 
> The "inc and read" should be atomic. Otherwise below
> sequence may happen:
> 
> P1: atomic_inc(&udev->refcnt);
> P2: atomic_inc(&udev->refcnt);
> P1: if (atomic_read(&udev->refcnt) > 1)
> P2: if (atomic_read(&udev->refcnt) > 1)
> 
> > +		return 0;
> > +
> >  	/* set bus master, which was cleared by the reset function */
> >  	pci_set_master(dev);
> >
> > @@ -354,6 +359,10 @@ struct rte_uio_pci_dev {
> >  	struct rte_uio_pci_dev *udev = info->priv;
> >  	struct pci_dev *dev = udev->pdev;
> >
> > +	atomic_dec(&udev->refcnt);
> > +	if (atomic_read(&udev->refcnt) > 0)
> > +		return 0;
> 
> Ditto.
> 
> Best regards,
> Tiwei Bie
> 
> > +
> >  	/* disable interrupts */
> >  	igbuio_pci_disable_interrupts(udev);
> >
> > --
> > 1.8.3.1
> >


More information about the dev mailing list