[dpdk-dev] [PATCH v7 04/19] ethdev: introduce device lock

Andrew Rybchenko arybchenko at solarflare.com
Thu Jun 28 18:46:36 CEST 2018


On 06/28/2018 03:56 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 think that locking deserves a bit more details on why it is needed.
When/why should it be used by applications or other libraries.
Right now the description is too generic and real usecases are unclear.
Should applications always lock device if some data cores are polling
its Rx/Tx queues? Does it imply that all apps which would like to be
hotplug-aware should be updated accordingly?
Do you have guidelines or is it too early stage for now?

> 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.

What should/will happen if two callbacks are registered and the
first says OK, but the second denies detach. The device will be
detached from the first callback point of view, but finally remains.

> Signed-off-by: Qi Zhang <qi.z.zhang at intel.com>
> Reviewed-by: Anatoly Burakov <anatoly.burakov at intel.com>


More information about the dev mailing list