mbox series

[0/2] Mark shared pthread mutex

Message ID 20210315192722.35490-1-stephen@networkplumber.org (mailing list archive)
Headers
Series Mark shared pthread mutex |

Message

Stephen Hemminger March 15, 2021, 7:27 p.m. UTC
  This fixes two places where pthread_mutex was being unsafely
used between primary secondary process.

These patches are necessary but not sufficient to address Bug 662

Stephen Hemminger (2):
  ethdev: make flow API primary/secondary process safe
  net/failsafe: fix primary/secondary mutex

 drivers/net/failsafe/failsafe.c | 5 +++++
 lib/librte_ethdev/rte_ethdev.c  | 6 +++++-
 2 files changed, 10 insertions(+), 1 deletion(-)
  

Comments

Stephen Hemminger March 15, 2021, 7:45 p.m. UTC | #1
On Mon, 15 Mar 2021 12:27:20 -0700
Stephen Hemminger <stephen@networkplumber.org> wrote:

> This fixes two places where pthread_mutex was being unsafely
> used between primary secondary process.
> 
> These patches are necessary but not sufficient to address Bug 662
> 
> Stephen Hemminger (2):
>   ethdev: make flow API primary/secondary process safe
>   net/failsafe: fix primary/secondary mutex
> 
>  drivers/net/failsafe/failsafe.c | 5 +++++
>  lib/librte_ethdev/rte_ethdev.c  | 6 +++++-
>  2 files changed, 10 insertions(+), 1 deletion(-)

Side note:

While looking at the code, many places are checking for error
conditions that can never occur..

RETURN VALUE
       pthread_mutex_init always returns 0. The other mutex functions return 0
       on success and a non-zero error code on error.
  
Stephen Hemminger March 16, 2021, 4:28 p.m. UTC | #2
On Mon, 15 Mar 2021 12:27:20 -0700
Stephen Hemminger <stephen@networkplumber.org> wrote:

> This fixes two places where pthread_mutex was being unsafely
> used between primary secondary process.
> 
> These patches are necessary but not sufficient to address Bug 662
> 
> Stephen Hemminger (2):
>   ethdev: make flow API primary/secondary process safe
>   net/failsafe: fix primary/secondary mutex
> 
>  drivers/net/failsafe/failsafe.c | 5 +++++
>  lib/librte_ethdev/rte_ethdev.c  | 6 +++++-
>  2 files changed, 10 insertions(+), 1 deletion(-)
> 

The following drivers have the same kind of issue.

Drivers with unsafe pthread_mutex:

net/
	af_xdp
	atlantic
	axgbe
	bnxt
	ena
	failsafe (see patch #2)
	hinic
	mlx5
	qede
	vhost
	virtio

raw/	
	ifpga
vdpa/
	ifc
	mlx5


Another alternative would be to create a DPDK wrapper (rte_mutex?)
which had the proper semantics. That might make the Windows port easier.
But it would make backport to stable harder.


If this does not get fixed in April, we should change documentation
to warn users.
  
Ferruh Yigit April 16, 2021, 8:25 a.m. UTC | #3
On 3/16/2021 4:28 PM, Stephen Hemminger wrote:
> On Mon, 15 Mar 2021 12:27:20 -0700
> Stephen Hemminger <stephen@networkplumber.org> wrote:
> 
>> This fixes two places where pthread_mutex was being unsafely
>> used between primary secondary process.
>>
>> These patches are necessary but not sufficient to address Bug 662
>>
>> Stephen Hemminger (2):
>>    ethdev: make flow API primary/secondary process safe
>>    net/failsafe: fix primary/secondary mutex
>>
>>   drivers/net/failsafe/failsafe.c | 5 +++++
>>   lib/librte_ethdev/rte_ethdev.c  | 6 +++++-
>>   2 files changed, 10 insertions(+), 1 deletion(-)
>>
> 
> The following drivers have the same kind of issue.
> 
> Drivers with unsafe pthread_mutex:
> 
> net/
> 	af_xdp
> 	atlantic
> 	axgbe
> 	bnxt
> 	ena
> 	failsafe (see patch #2)
> 	hinic
> 	mlx5
> 	qede
> 	vhost
> 	virtio
> 
> raw/	
> 	ifpga
> vdpa/
> 	ifc
> 	mlx5
> 
> 
> Another alternative would be to create a DPDK wrapper (rte_mutex?)
> which had the proper semantics. That might make the Windows port easier.
> But it would make backport to stable harder.
> 
> 
> If this does not get fixed in April, we should change documentation
> to warn users.
> 
> 

+Anatoly as our multi process maintainer.

And most of the above nics already doesn't claim the multi process support (in 
.ini files), the ones that claims the support:
mlx[45]
bnxt
hinic
qede
virtio