DPDK patches and discussions
 help / color / mirror / Atom feed
From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: "Liu, Changpeng" <changpeng.liu@intel.com>,
	Stephen Hemminger <stephen@networkplumber.org>
Cc: "dev@dpdk.org" <dev@dpdk.org>, "Xia, Chenbo" <chenbo.xia@intel.com>
Subject: Re: [PATCH] vhost: use try_lock in rte_vhost_vring_call
Date: Tue, 20 Sep 2022 09:12:51 +0200	[thread overview]
Message-ID: <8be85d76-2671-57e1-58c2-30070428a66c@redhat.com> (raw)
In-Reply-To: <PH0PR11MB5093BD8DD6FEF5506F52B897EE419@PH0PR11MB5093.namprd11.prod.outlook.com>



On 9/7/22 02:40, Liu, Changpeng wrote:
> 
> 
>> -----Original Message-----
>> From: Stephen Hemminger <stephen@networkplumber.org>
>> Sent: Wednesday, September 7, 2022 5:16 AM
>> To: Liu, Changpeng <changpeng.liu@intel.com>
>> Cc: dev@dpdk.org; Maxime Coquelin <maxime.coquelin@redhat.com>; Xia,
>> Chenbo <chenbo.xia@intel.com>
>> Subject: Re: [PATCH] vhost: use try_lock in rte_vhost_vring_call
>>
>> On Tue,  6 Sep 2022 10:22:25 +0800
>> Changpeng Liu <changpeng.liu@intel.com> wrote:
>>
>>> Note that this function is in data path, so the thread context
>>> may not same as socket messages processing context, by using
>>> try_lock here, users can have another try in case of VQ's access
>>> lock is held by `vhost-events` thread.
>>>
>>> Signed-off-by: Changpeng Liu <changpeng.liu@intel.com>
>>> ---
>>>   lib/vhost/vhost.c | 6 +++++-
>>>   1 file changed, 5 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/lib/vhost/vhost.c b/lib/vhost/vhost.c
>>> index 60cb05a0ff..072d2acb7b 100644
>>> --- a/lib/vhost/vhost.c
>>> +++ b/lib/vhost/vhost.c
>>> @@ -1329,7 +1329,11 @@ rte_vhost_vring_call(int vid, uint16_t vring_idx)
>>>   	if (!vq)
>>>   		return -1;
>>>
>>> -	rte_spinlock_lock(&vq->access_lock);
>>> +	if (!rte_spinlock_trylock(&vq->access_lock)) {
>>> +		VHOST_LOG_CONFIG(dev->ifname, DEBUG,
>>> +			"failed to kick guest, virtqueue busy.\n");
>>> +		return -1;
>>> +	}
>>>
>>
>> If it is a race, logging a message is not a good idea; the log will fill
>> with this noise.
>>
>> Instead make it statistic that can be seen by xstats.
> It's a DEBUG log, users can't see it in practice.
> 

Having an xstat would enable live debugging & post-mortem analysis.
You can have both the stats and the debug log.

Regards,
Maxime


  reply	other threads:[~2022-09-20  7:12 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-06  2:22 Changpeng Liu
2022-09-06 21:15 ` Stephen Hemminger
2022-09-07  0:40   ` Liu, Changpeng
2022-09-20  7:12     ` Maxime Coquelin [this message]
2022-09-20  2:24 ` Xia, Chenbo
2022-09-20  2:34   ` Liu, Changpeng
2022-09-20  2:53     ` Xia, Chenbo
2022-09-20  3:00       ` Liu, Changpeng
2022-09-20  7:23       ` Maxime Coquelin
2022-09-20  7:30         ` Maxime Coquelin
2022-09-20  7:19 ` Maxime Coquelin
2022-09-20  7:29   ` Liu, Changpeng
2022-09-20  7:34     ` Maxime Coquelin
2022-09-20  7:45       ` Liu, Changpeng
2022-09-20  8:12         ` Maxime Coquelin
2022-09-20  8:43           ` Liu, Changpeng
2022-09-21  9:41             ` Maxime Coquelin
2022-09-21  9:52               ` Liu, Changpeng
2022-10-11 11:56                 ` Maxime Coquelin
2022-10-12  6:40 ` [PATCH v2] vhost: add new `rte_vhost_vring_call_nonblock` API Changpeng Liu
2022-10-13  7:56   ` Maxime Coquelin
2022-10-17  6:46   ` Xia, Chenbo
2022-10-17  7:17     ` Liu, Changpeng
2022-10-17  7:14   ` [PATCH v3] " Changpeng Liu
2022-10-17  7:39     ` Xia, Chenbo
2022-10-17  7:50       ` Liu, Changpeng
2022-10-17  7:48     ` [PATCH v4] " Changpeng Liu
2022-10-19  5:27       ` Xia, Chenbo
2022-10-26  9:24       ` Xia, Chenbo

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=8be85d76-2671-57e1-58c2-30070428a66c@redhat.com \
    --to=maxime.coquelin@redhat.com \
    --cc=changpeng.liu@intel.com \
    --cc=chenbo.xia@intel.com \
    --cc=dev@dpdk.org \
    --cc=stephen@networkplumber.org \
    /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).