DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Wang, Xiao W" <xiao.w.wang@intel.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: "Yigit, Ferruh" <ferruh.yigit@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH] igb_uio: allow multi-process access
Date: Mon, 18 Dec 2017 15:53:36 +0000	[thread overview]
Message-ID: <B7F2E978279D1D49A3034B7786DACF406F8040A4@SHSMSX101.ccr.corp.intel.com> (raw)
In-Reply-To: <20171211173855.3eed4623@xeon-e3>

Hi,

> -----Original Message-----
> From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> Sent: Tuesday, December 12, 2017 9:39 AM
> To: Wang, Xiao W <xiao.w.wang@intel.com>
> Cc: Yigit, Ferruh <ferruh.yigit@intel.com>; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH] igb_uio: allow multi-process access
> 
> On Fri,  8 Dec 2017 17:57:33 -0800
> Xiao Wang <xiao.w.wang@intel.com> wrote:
> 
> > 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 enablement after FLR in VM")
> 
> 
> Yes, this makes sense.
> 
> >
> > Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
> > ---
> >  lib/librte_eal/linuxapp/igb_uio/igb_uio.c | 7 +++++++
> >  1 file changed, 7 insertions(+)
> >
> > diff --git a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
> b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
> > index a3a98c1..c239d98 100644
> > --- a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
> > +++ b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
> > @@ -45,6 +45,7 @@ struct rte_uio_pci_dev {
> >  	struct uio_info info;
> >  	struct pci_dev *pdev;
> >  	enum rte_intr_mode mode;
> > +	uint32_t ref_cnt;
> 
> Simple unsigned reference count is not SMP safe on all architectures.
> In kernel it is recommended to use refcount_t and associated API's.
> Note: refcount_t was introduced in last 2 years and some DPDK users
> still have ancient kernels.

I think atomic_t associated API will be enough, without worry about kernel version.

> 
> >  };
> >
> >  static char *intr_mode;
> > @@ -336,6 +337,9 @@ struct rte_uio_pci_dev {
> >  	struct pci_dev *dev = udev->pdev;
> >  	int err;
> >
> > +	if (++(udev->ref_cnt) > 1)
> > +		return 0;
> 
> Do not use (unnecessary) parenthesis. C precedence order is well defined.

Agree. Will change it in v2.

Thanks for your comments,
Xiao

  reply	other threads:[~2017-12-18 15:53 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-09  1:57 Xiao Wang
2017-12-12  1:38 ` Stephen Hemminger
2017-12-18 15:53   ` Wang, Xiao W [this message]
2017-12-19 15:42 ` [dpdk-dev] [PATCH v2] " Xiao Wang
2017-12-19  9:04   ` Tiwei Bie
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=B7F2E978279D1D49A3034B7786DACF406F8040A4@SHSMSX101.ccr.corp.intel.com \
    --to=xiao.w.wang@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=stephen@networkplumber.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).