[dpdk-dev] [RFC] ethdev: make rte flow API thread safe
Suanming Mou
suanmingm at nvidia.com
Thu Sep 24 03:42:37 CEST 2020
Hi,
> -----Original Message-----
> From: Suanming Mou
> Sent: Wednesday, September 9, 2020 10:26 AM
> To: Stephen Hemminger <stephen at networkplumber.org>; NBU-Contact-
> Thomas Monjalon <thomas at monjalon.net>
> Cc: Ori Kam <orika at mellanox.com>; Matan Azrad <matan at mellanox.com>;
> Shahaf Shuler <shahafs at mellanox.com>; Viacheslav Ovsiienko
> <viacheslavo at mellanox.com>; Ferruh Yigit <ferruh.yigit at intel.com>; Andrew
> Rybchenko <arybchenko at solarflare.com>; dev at dpdk.org;
> joyce.kong at arm.com; phil.yang at arm.com; steve.capper at arm.com;
> honnappa.nagarahalli at arm.com
> Subject: RE: [dpdk-dev] [RFC] ethdev: make rte flow API thread safe
>
> > Would it be possible to push the choice of mutual exclusion down to
> > the device driver? For fast HW devices they could use spinlock and for
> > slow SW devices it would be pthread.
>
> That's a good hint. But that will also introduce the vendor PMD to update. I tried
> to list some points here.
> 1. For single thread case, pthread mutex acts similar as spinlock, spinlock or
> pthread mutex will not make difference here.
> 2. For multiple threads lock contention, spinlock will introduce more CPU usage.
> DPDK applications currently use mutex later get rid of the outer mutex will suffer
> higher CPU usage with the spinlock(fast hardware PMD).
>
> And one more general question, can we find some DPDK applications now use
> spinlock with the rte flow APIs?
Since there's no other suggestions regarding lock chosen, maybe we can keep the default mutex lock in rte flow functions.
For the fast HW devices case as Stephen wrote, these fast HW device PMDs can set the RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE flag, and add the spinlock in the PMD to replace the mutex lock in rte flow functions.
Similarly, if some PMDs prefer other types of lock, just set the RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE flag, and add the needed type of lock to PMD internal.
The default mutex lock in rte flow functions will be replaced easily.
How do you feel like this?
Thanks,
SuanmingMou
More information about the dev
mailing list