DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@intel.com>
To: Ziyang Xuan <xuanziyang2@huawei.com>, dev@dpdk.org
Cc: cloud.wangxiaoyun@huawei.com, luoxianjun@huawei.com,
	tanya.brokhman@huawei.com
Subject: Re: [dpdk-dev] [PATCH v2 1/1] net/hinic: use mutex replace spin lock
Date: Mon, 8 Jul 2019 19:15:49 +0100	[thread overview]
Message-ID: <ebecaf53-84b7-7e7f-6eb5-f4c4a49686e3@intel.com> (raw)
In-Reply-To: <1562309267-65831-1-git-send-email-xuanziyang2@huawei.com>

On 7/5/2019 7:47 AM, Ziyang Xuan wrote:
> Using spin lock to protect critical resources
> of sending mgmt messages. This will make high
> CPU usage for rte_delay_ms when sending mgmt
> messages frequently. We can use mutex to protect
> the critical resources and usleep to reduce CPU
> usage while keep functioning properly.
> 
> Signed-off-by: Ziyang Xuan <xuanziyang2@huawei.com>

<...>

> +static inline int hinic_mutex_init(pthread_mutex_t *pthreadmutex,
> +					const pthread_mutexattr_t *mattr)
> +{
> +	int err;
> +
> +	err = pthread_mutex_init(pthreadmutex, mattr);
> +	if (unlikely(err))
> +		PMD_DRV_LOG(ERR, "Fail to initialize mutex, error: %d", err);
> +
> +	return err;
> +}
> +
> +static inline int hinic_mutex_destroy(pthread_mutex_t *pthreadmutex)
> +{
> +	int err;
> +
> +	err = pthread_mutex_destroy(pthreadmutex);
> +	if (unlikely(err))
> +		PMD_DRV_LOG(ERR, "Fail to destroy mutex, error: %d", err);
> +
> +	return err;
> +}
> +

There was a comment from Stephen to use pthread APIs directly, can you please
comment on that?


> @@ -713,7 +718,7 @@ int hinic_aeq_poll_msg(struct hinic_eq *eq, u32 timeout, void *param)
>  			}
>  
>  			if (timeout != 0)
> -				rte_delay_ms(1);
> +				usleep(1000);

Why is this change required? Aren't these are same?

  reply	other threads:[~2019-07-08 18:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-05  6:47 Ziyang Xuan
2019-07-08 18:15 ` Ferruh Yigit [this message]
2019-07-10  8:06 ` Ferruh Yigit
2019-07-09 12:20 Xuanziyang (William, Chip Application Design Logic and Hardware Development Dept IT_Products & Solutions)

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=ebecaf53-84b7-7e7f-6eb5-f4c4a49686e3@intel.com \
    --to=ferruh.yigit@intel.com \
    --cc=cloud.wangxiaoyun@huawei.com \
    --cc=dev@dpdk.org \
    --cc=luoxianjun@huawei.com \
    --cc=tanya.brokhman@huawei.com \
    --cc=xuanziyang2@huawei.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).