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 25E2B1BE9C for ; Tue, 3 Jul 2018 11:56:07 +0200 (CEST) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id C506321EAB; Tue, 3 Jul 2018 05:56:06 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Tue, 03 Jul 2018 05:56:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; 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=mesmtp; bh=XlY1NyXW0y7IFQgKGRkRevkayO 1eC8PKyNdlG+80Dks=; b=fmTRClw+DY7j+UGN/8uSbc2A6LcPFOcPgBbgZy4+UF JZ93OicjpXnMh1XqGurJFsOqbSenRpIVkKyXDJKDPF/dOjIl7+DvTiVVPjoGAEre mqhOVCR+u5la0m4Gv7z60xHVttwoYyRZZ/I1un/7Baci/un1xGdeDGm5g5IW+wXK 4= 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=XlY1Ny XW0y7IFQgKGRkRevkayO1eC8PKyNdlG+80Dks=; b=Voy2NPqKO7YGPYpz68ctyv 5JOumABL9XlkYGyZVQgUo2/UrdWEzXuQ6dUv7xtKVVB9qxqI0wi/cphqVFovlE+Y Eef5RuQlUT37okpdvuLS3mif18bEZa1UU1A7b6gbQertspEv1WXVrkwdjnT5uH7P cSa6e3r+hevGa/hqRa8kIioFcxVQAcvPRTfhPPDJIJYwcECaXggiWrQAyi0xvTVn cxLvmYs4IEJ7txnNrQi024LxW88nqULJhkLrDjlgp1OaPhYw3dK5CcCzL4jaqsZ3 H3TEfwwCAUKm6JoI+rsNDhDpAI8sxsUzQCbHNzSg9BOIJQkXbByNAaLWY4vaONBA == X-ME-Proxy: X-ME-Sender: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 99C9C10377; Tue, 3 Jul 2018 05:56:05 -0400 (EDT) From: Thomas Monjalon To: Qi Zhang Cc: dev@dpdk.org, anatoly.burakov@intel.com, konstantin.ananyev@intel.com, bruce.richardson@intel.com, ferruh.yigit@intel.com, benjamin.h.shelton@intel.com, narender.vangati@intel.com Date: Tue, 03 Jul 2018 11:56:04 +0200 Message-ID: <3478184.SidI6Nhsfv@xps> In-Reply-To: <20180702054450.29269-5-qi.z.zhang@intel.com> 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> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" 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: Tue, 03 Jul 2018 09:56:07 -0000 02/07/2018 07:44, Qi Zhang: > 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. Trying to understand: a process of an application could try to detach a port while another process is against this decision. Why an application needs to be protected against itself? I guess it is only an application inter-process management. If we really want to provide such helper in DPDK, it should not be limited to ethdev. (for info, see class implementation: https://patches.dpdk.org/patch/41605/) What about hardware unplug? Can we detach the locked ports associated to the unplugged device? > 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. You don't need 2 flavors for the lock. We can have only the "_with_callback" flavour and provide a default callback which says always no.