From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by dpdk.org (Postfix) with ESMTP id 3DA451B598 for ; Wed, 4 Jul 2018 04:19:53 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id A6A1921BA5; Tue, 3 Jul 2018 22:19:52 -0400 (EDT) Received: from web4 ([10.202.2.214]) by compute1.internal (MEProxy); Tue, 03 Jul 2018 22:19:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fridaylinux.org; h=cc:content-transfer-encoding:content-type:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=NHTmrfJ9uJWr6+fdO beQM3srfkF3ZgA5VgJMKsRgkeY=; b=R5KYDdhdWi67FPY9d7pYhHMYSqvhbyPG6 w9yuelqCwPVXrTLEaAU3tclBEszXD2iStEthw/JPGZPBWJUWFJdZagdRN/oD1wV6 zdrCF1P1O0IMasSGCeoXFNjF6UciE3zYdbkHTfKElFM2BCThUC1V5pg0gXBnqMMu AGQYxxD+qfJCCBUsOLWeWZjDq5Tbr+a+NzoJwDnAv//1fFxgFbQFjNhBgG/5aku4 m3MdJfPqgK2ByLIujkRtjKN7L8hmFHK+n1EroP0/flJDRFnnfOd22KGo5htvhcO2 Po4a1D9A+YxNQljd749vdOjYieHlj4Uu67IaoSCJUfFfwx4H6JxoA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=NHTmrf J9uJWr6+fdObeQM3srfkF3ZgA5VgJMKsRgkeY=; b=WjNuIKZlm1Z62jQbrHX6zZ DmA3QrJHBjYGdcfRo+P0hVmi8HnU/Tu1JVmtJzrUIKOuWAX2rLc1m6WxhmMvIOuO 7PFhEAnHdrSBcEex4VOUaZ5ZTiFoFgYSZ4kDFGxyfv+LQO3PoZADq6qLzvDdiGs9 cQ0nPKJq6QLKNdriVoXYiUUOqyXf05WPY9a84OP//rOQSBX3cuZW2ra5u5xV2vwj 0Ec2dkuTOHLalHbQmSFfWD86Fv5q7c7wEQEszZaJVaC+cim/2FVpWQUF3OfEMZh5 ueVJOHav63qHIPNw2yNSS7SIsNBDRDzG58sonMJPawAQbt/ennhg5qa8jUHlPIYg == X-ME-Proxy: X-ME-Sender: Received: by mailuser.nyi.internal (Postfix, from userid 99) id D829EBA4CF; Tue, 3 Jul 2018 22:19:51 -0400 (EDT) Message-Id: <1530670791.2539856.1429311576.7CE52942@webmail.messagingengine.com> From: Yuanhan Liu To: Qi Zhang , thomas@monjalon.net, anatoly.burakov@intel.com Cc: konstantin.ananyev@intel.com, dev@dpdk.org, bruce.richardson@intel.com, ferruh.yigit@intel.com, benjamin.h.shelton@intel.com, narender.vangati@intel.com MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" X-Mailer: MessagingEngine.com Webmail Interface - ajax-0d8ea36c References: <20180607123849.14439-1-qi.z.zhang@intel.com> <20180702054450.29269-1-qi.z.zhang@intel.com> <20180702054450.29269-5-qi.z.zhang@intel.com> Date: Wed, 04 Jul 2018 10:19:51 +0800 In-Reply-To: <20180702054450.29269-5-qi.z.zhang@intel.com> Subject: Re: [dpdk-dev] [PATCH v8 04/19] ethdev: introduce device lock 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, 04 Jul 2018 02:19:53 -0000 On Mon, Jul 2, 2018, at 1:44 PM, Qi Zhang wrote: > Introduce API rte_eth_dev_lock and rte_eth_dev_unlock to let > application lock or unlock on specific ethdev, a locked device > can't be detached, this help applicaiton to prevent unexpected > device detaching, especially in multi-process envrionment. I'm just wondering why the need of introducing such 2 (very specific) APIs, judging that it looks like a ref count could solve this kind of issues perfectly. Also, the API name (_dev_lock/unlock) looks like an over killing, judging that you just want to pin a device (if I understand this commit log correctly). What firstly comes to my mind when I see "lock" was "no one can *access* a device after another has grabbed the lock", which doesn't quite match what you described here. That said, if I were you, I would go with introducing few generic refcount APIs. --yliu > > Aslo introduce the new API rte_eth_dev_lock_with_callback and > rte_eth_dev_unlock_with callback to let application to register > a callback function which will be invoked before a device is going > to be detached, the return value of the function will decide if > device will continue be detached or not, this support application > to do condition check at runtime. > > Signed-off-by: Qi Zhang > Reviewed-by: Anatoly Burakov