From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: Re: [PATCH v8 7/7] igb_uio: fix uio release issue for hotplug Date: Tue, 10 Jul 2018 14:48:13 -0700 Message-ID: <20180710144813.2d08babf@xeon-e3> References: <1498711073-42917-1-git-send-email-jia.guo@intel.com> <1531220607-2977-1-git-send-email-jia.guo@intel.com> <1531220607-2977-8-git-send-email-jia.guo@intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: bruce.richardson@intel.com, ferruh.yigit@intel.com, konstantin.ananyev@intel.com, gaetan.rivet@6wind.com, jingjing.wu@intel.com, thomas@monjalon.net, motih@mellanox.com, matan@mellanox.com, harry.van.haaren@intel.com, qi.z.zhang@intel.com, shaopeng.he@intel.com, bernard.iremonger@intel.com, arybchenko@solarflare.com, wenzhuo.lu@intel.com, jblunck@infradead.org, shreyansh.jain@nxp.com, dev@dpdk.org, helin.zhang@intel.com To: Jeff Guo Return-path: Received: from mail-pl0-f67.google.com (mail-pl0-f67.google.com [209.85.160.67]) by dpdk.org (Postfix) with ESMTP id B506D5F72 for ; Tue, 10 Jul 2018 23:48:16 +0200 (CEST) Received: by mail-pl0-f67.google.com with SMTP id t6-v6so8194444plo.7 for ; Tue, 10 Jul 2018 14:48:16 -0700 (PDT) In-Reply-To: <1531220607-2977-8-git-send-email-jia.guo@intel.com> List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Tue, 10 Jul 2018 19:03:27 +0800 Jeff Guo wrote: > > +/* uio pci device state */ > +enum rte_udev_state { > + RTE_UDEV_PROBED, > + RTE_UDEV_OPENNED, > + RTE_UDEV_RELEASED, > + RTE_UDEV_REMOVED, > +}; > + The states here are a little confusing. especially since pci_release seems to take different actions based on the state. And there is nothing preventing races between unexpected removal (PCI), and removing the device from being used by igb_uio. Would it be possible to only use state variable from the kernel PCI layer where the value is consistent? Also there is refcounting in PCI layer (and locking). Could that be used instead?