From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by dpdk.org (Postfix) with ESMTP id 659A0271 for ; Wed, 20 Dec 2017 03:17:43 +0100 (CET) X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Dec 2017 18:17:42 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,429,1508828400"; d="scan'208";a="4102709" Received: from deepin-15.sh.intel.com (HELO debian-xvivbkq) ([10.67.104.165]) by orsmga007.jf.intel.com with ESMTP; 19 Dec 2017 18:17:41 -0800 Date: Wed, 20 Dec 2017 10:17:13 +0800 From: Tiwei Bie To: Xiao Wang Cc: ferruh.yigit@intel.com, dev@dpdk.org, stephen@networkplumber.org Message-ID: <20171220021713.y3pjk6lpp2fdgq46@debian-xvivbkq> References: <1513698140-92837-1-git-send-email-xiao.w.wang@intel.com> <1513706293-133528-1-git-send-email-xiao.w.wang@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1513706293-133528-1-git-send-email-xiao.w.wang@intel.com> User-Agent: NeoMutt/20170609 (1.8.3) Subject: Re: [dpdk-dev] [PATCH v3] igb_uio: allow multi-process access X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Dec 2017 02:17:44 -0000 On Tue, Dec 19, 2017 at 09:58:13AM -0800, Xiao Wang wrote: [...] > static char *intr_mode; > @@ -336,6 +337,9 @@ struct rte_uio_pci_dev { > struct pci_dev *dev = udev->pdev; > int err; > > + if (atomic_inc_return(&udev->refcnt) > 1) > + return 0; > + Hmm, ideally, you also need to make sure that other calls won't return until the setup is actually done. Best regards, Tiwei Bie > /* set bus master, which was cleared by the reset function */ > pci_set_master(dev); > > @@ -354,6 +358,9 @@ struct rte_uio_pci_dev { > struct rte_uio_pci_dev *udev = info->priv; > struct pci_dev *dev = udev->pdev; > > + if (atomic_dec_return(&udev->refcnt) > 0) > + return 0; > + > /* disable interrupts */ > igbuio_pci_disable_interrupts(udev); > > -- > 1.8.3.1 >