All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Burakov, Anatoly" <anatoly.burakov@intel.com>
To: "Tan, Jianfeng" <jianfeng.tan@intel.com>, dev@dpdk.org
Subject: Re: [PATCH] eal/ipc: stop async IPC loop on callback request
Date: Tue, 10 Apr 2018 15:17:14 +0100	[thread overview]
Message-ID: <80b09df6-9c31-dc91-e26b-8dfde14a2fb0@intel.com> (raw)
In-Reply-To: <ec76ea95-1479-f047-1e22-37abf9cbb5b4@intel.com>

On 10-Apr-18 2:53 PM, Tan, Jianfeng wrote:
> 
> 
> On 4/10/2018 6:03 PM, Anatoly Burakov wrote:
>> EAL did not stop processing further asynchronous requests on
>> encountering a request that should trigger the callback. This
>> resulted in erasing valid requests but not triggering them.
> 
> That means one wakeup could process multiple replies, and following 
> process_async_request() will erase some valid requests?

Yes.

> 
>>
>> Fix this by stopping the loop once we have a request that we
>> can trigger. Also, remove unnecessary check for trigger
>> request being NULL.
>>
>> Fixes: f05e26051c15 ("eal: add IPC asynchronous request")
>> Cc: anatoly.burakov@intel.com
>>
>> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> 
> 
>> ---
>>   lib/librte_eal/common/eal_common_proc.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/lib/librte_eal/common/eal_common_proc.c 
>> b/lib/librte_eal/common/eal_common_proc.c
>> index f98622f..1ea3b58 100644
>> --- a/lib/librte_eal/common/eal_common_proc.c
>> +++ b/lib/librte_eal/common/eal_common_proc.c
>> @@ -510,11 +510,11 @@ async_reply_handle(void *arg __rte_unused)
>>                       TAILQ_REMOVE(&pending_requests.requests,
>>                               sr, next);
>>                       free(sr);
>> -                } else if (action == ACTION_TRIGGER &&
>> -                        trigger == NULL) {
>> +                } else if (action == ACTION_TRIGGER) {
>>                       TAILQ_REMOVE(&pending_requests.requests,
>>                               sr, next);
>>                       trigger = sr;
>> +                    break;
> 
> If I understand it correctly above, break here, we will trigger an async 
> action, and then go back to sleep with some ready requests not handled? 
> Seems that we shall unlock, process, and lock here. Right?

Well, we won't go back to sleep - we'll just loop around and come back.

See eal_common_proc.c:472:

	/* sometimes, we don't even wait */
	if (sr->reply_received) {
		nowait = true;
		break;
	}

Followed by line 478:

	if (nowait)
		ret = 0;

Followed by line 495:

	if (ret == 0 || ret == ETIMEDOUT) {

So, having messages with replies already in the queue will cause wait to 
be cancelled. It's not much slower than unlocking, triggering, and 
locking again.

However, if you're OK with lock-loop-unlock-trigger-lock-loop-unlock-... 
sequence until we run out of triggers, then sure, i can add that.

> 
> Thanks,
> Jianfeng
> 
>>                   }
>>               }
>>           }
> 
> 


-- 
Thanks,
Anatoly

  reply	other threads:[~2018-04-10 14:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-10 10:03 [PATCH] eal/ipc: stop async IPC loop on callback request Anatoly Burakov
2018-04-10 13:53 ` Tan, Jianfeng
2018-04-10 14:17   ` Burakov, Anatoly [this message]
2018-04-10 15:16     ` Tan, Jianfeng
2018-04-10 15:28 ` [PATCH v2] " Anatoly Burakov
2018-04-13 15:24   ` Tan, Jianfeng
2018-04-16 23:08     ` Thomas Monjalon

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=80b09df6-9c31-dc91-e26b-8dfde14a2fb0@intel.com \
    --to=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=jianfeng.tan@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.