DPDK patches and discussions
 help / color / mirror / Atom feed
From: Tiwei Bie <tiwei.bie@intel.com>
To: Xiao Wang <xiao.w.wang@intel.com>
Cc: ferruh.yigit@intel.com, dev@dpdk.org, stephen@networkplumber.org
Subject: Re: [dpdk-dev] [PATCH v2] igb_uio: allow multi-process access
Date: Tue, 19 Dec 2017 17:04:34 +0800	[thread overview]
Message-ID: <20171219090433.3jymojar7of3mkdm@debian-xvivbkq> (raw)
In-Reply-To: <1513698140-92837-1-git-send-email-xiao.w.wang@intel.com>

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
> 

  reply	other threads:[~2017-12-19  9:05 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-09  1:57 [dpdk-dev] [PATCH] " Xiao Wang
2017-12-12  1:38 ` Stephen Hemminger
2017-12-18 15:53   ` Wang, Xiao W
2017-12-19 15:42 ` [dpdk-dev] [PATCH v2] " Xiao Wang
2017-12-19  9:04   ` Tiwei Bie [this message]
2017-12-19  9:23     ` Wang, Xiao W
2017-12-19 15:39   ` Stephen Hemminger
2017-12-19 17:58   ` [dpdk-dev] [PATCH v3] " Xiao Wang
2017-12-20  2:17     ` Tiwei Bie
2018-01-01 22:00     ` [dpdk-dev] [PATCH v4] " Xiao Wang
2018-01-16 19:43       ` Ferruh Yigit
2018-01-16 23:37         ` Thomas Monjalon
2018-03-08 21:17 ` [dpdk-dev] [PATCH] " Stephen Hemminger

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=20171219090433.3jymojar7of3mkdm@debian-xvivbkq \
    --to=tiwei.bie@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=stephen@networkplumber.org \
    --cc=xiao.w.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;
as well as URLs for NNTP newsgroup(s).