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

2017-12-19 Thread Stephen Hemminger
On Tue, 19 Dec 2017 07:42:20 -0800 Xiao Wang wrote: > + atomic_dec(&udev->refcnt); > + if (atomic_read(&udev->refcnt) > 0) > + return 0; > + The point of using atomic functions is to do atomic operations. You need to use atomic_dec_and_test here.

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

2017-12-19 Thread Wang, Xiao W
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 > Cc: Yigit, Ferruh ; dev@dpdk.org; > step...@networkplumber.org > Subject: Re: [dpdk-dev] [PATCH v2] igb_uio

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

2017-12-19 Thread Tiwei Bie
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. Otherwi

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

2017-12-18 Thread Xiao Wang
In some case, one device are accessed by different processes via different BARs, so one uio device may be opened by more than one process, for this case we just need to enable interrupt once, and pci_clear_master only when the last process closed. Fixes: 5f6ff30dc507 ("igb_uio: fix interrupt enabl