DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Suanming Mou <suanmingm@nvidia.com>, Ori Kam <orika@nvidia.com>,
	Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,
	Thomas Monjalon <thomas@monjalon.net>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	Stephen Hemminger <stephen@networkplumber.org>
Subject: Re: [dpdk-dev] [PATCH 1/2] ethdev: make flow API primary/secondary process safe
Date: Wed, 14 Apr 2021 14:06:58 +0100
Message-ID: <7106da73-95a1-30ae-f949-87ecca05b24d@intel.com> (raw)
In-Reply-To: <BL0PR12MB2577BE52E5BCA3A585D9DFB8C16B9@BL0PR12MB2577.namprd12.prod.outlook.com>

On 3/16/2021 11:48 PM, Suanming Mou wrote:
> Hi Stephen,
> 
>> -----Original Message-----
>> From: Stephen Hemminger <stephen@networkplumber.org>
>> Sent: Tuesday, March 16, 2021 3:27 AM
>> To: dev@dpdk.org
>> Cc: Stephen Hemminger <stephen@networkplumber.org>; Suanming Mou
>> <suanmingm@nvidia.com>
>> Subject: [PATCH 1/2] ethdev: make flow API primary/secondary process safe
>>
>> Posix mutex are not by default safe for protecting for usage from multiple
>> processes. The flow ops mutex could be used by both primary and secondary
>> processes.
> 
> Process safe is something more widely scope. I assume it should be another feature but not a bugfix for thread-safe?
> And the fag RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE we have added is just thread safe.
> 

Hi Suanming,

I think 'RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE' flag and what this patch address are 
different issues.

'RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE' is to add/remove synchronization support for 
flow APIs, that is for thread safety as flag name suggests.

This patch is to solve the problem for multi process, where commit log describes 
as posix mutex is not safe for multiple process.


Stephen,
Are you aware of any downside setting 'PTHREAD_PROCESS_SHARED' attribute to the 
mutex? Any possible performance implications?

Ori,
Since mlx is heavily using the flow API, is it possible to test this patch? If 
there is no negative impact, I think we can get this patch, what do you think?

>>
>> Bugzilla ID: 662
>> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
>> Fixes: 80d1a9aff7f6 ("ethdev: make flow API thread safe")
>> Cc: suanmingm@nvidia.com
>> ---
>>   lib/librte_ethdev/rte_ethdev.c | 6 +++++-
>>   1 file changed, 5 insertions(+), 1 deletion(-)
>>
>> diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index
>> 6f514c388b4e..d1024df408a5 100644
>> --- a/lib/librte_ethdev/rte_ethdev.c
>> +++ b/lib/librte_ethdev/rte_ethdev.c
>> @@ -470,6 +470,7 @@ rte_eth_dev_allocate(const char *name)  {
>>   	uint16_t port_id;
>>   	struct rte_eth_dev *eth_dev = NULL;
>> +	pthread_mutexattr_t attr;
>>   	size_t name_len;
>>
>>   	name_len = strnlen(name, RTE_ETH_NAME_MAX_LEN); @@ -506,7
>> +507,10 @@ rte_eth_dev_allocate(const char *name)
>>   	strlcpy(eth_dev->data->name, name, sizeof(eth_dev->data->name));
>>   	eth_dev->data->port_id = port_id;
>>   	eth_dev->data->mtu = RTE_ETHER_MTU;
>> -	pthread_mutex_init(&eth_dev->data->flow_ops_mutex, NULL);
>> +
>> +	pthread_mutexattr_init(&attr);
>> +	pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED);
>>
>> +	pthread_mutex_init(&eth_dev->data->flow_ops_mutex, &attr);
>>
>>   unlock:
>>   	rte_spinlock_unlock(&eth_dev_shared_data->ownership_lock);
>> --
>> 2.30.2
> 


  parent reply	other threads:[~2021-04-14 13:07 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-15 19:27 [dpdk-dev] [PATCH 0/2] Mark shared pthread mutex Stephen Hemminger
2021-03-15 19:27 ` [dpdk-dev] [PATCH 1/2] ethdev: make flow API primary/secondary process safe Stephen Hemminger
2021-03-16 23:48   ` Suanming Mou
2021-03-17  0:13     ` Stephen Hemminger
2021-03-17  0:32       ` Suanming Mou
2021-04-14 13:06     ` Ferruh Yigit [this message]
2021-04-15  2:55       ` Suanming Mou
2021-04-15  3:17         ` Stephen Hemminger
2021-04-15  7:42         ` Ferruh Yigit
2021-04-15 20:04           ` Stephen Hemminger
2021-04-16  0:57           ` Suanming Mou
2021-04-16  3:19           ` Ajit Khaparde
2021-04-16  1:41       ` fengchengwen
2021-04-16  8:12         ` Ferruh Yigit
2021-04-16  8:18   ` Ferruh Yigit
2021-04-19 17:14   ` Thomas Monjalon
2021-04-19 17:45     ` Stephen Hemminger
2021-04-19 18:09       ` Thomas Monjalon
2021-06-08  8:07   ` Andrew Rybchenko
2021-03-15 19:27 ` [dpdk-dev] [PATCH 2/2] net/failsafe: fix primary/secondary mutex Stephen Hemminger
2021-04-14 13:10   ` Ferruh Yigit
2021-04-16  8:19     ` Ferruh Yigit
2021-04-19 17:08   ` Thomas Monjalon
2021-06-08  8:00     ` Andrew Rybchenko
2021-06-08 15:42       ` Stephen Hemminger
2021-06-08 15:55         ` Andrew Rybchenko
2021-06-08 20:48           ` Stephen Hemminger
2021-06-09 10:04             ` Andrew Rybchenko
2021-06-14 14:43               ` Gaëtan Rivet
2021-03-15 19:45 ` [dpdk-dev] [PATCH 0/2] Mark shared pthread mutex Stephen Hemminger
2021-03-16 16:28 ` Stephen Hemminger
2021-04-16  8:25   ` Ferruh Yigit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7106da73-95a1-30ae-f949-87ecca05b24d@intel.com \
    --to=ferruh.yigit@intel.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=orika@nvidia.com \
    --cc=stephen@networkplumber.org \
    --cc=suanmingm@nvidia.com \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git