DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Burakov, Anatoly" <anatoly.burakov@intel.com>
To: "Tan, Jianfeng" <jianfeng.tan@intel.com>, dev@dpdk.org
Cc: failed@ecsmtp.ir.intel.com, to@ecsmtp.ir.intel.com,
	remove@ecsmtp.ir.intel.com, Directory@ecsmtp.ir.intel.com,
	not@ecsmtp.ir.intel.com, empty@ecsmtp.ir.intel.com,
	konstantin.ananyev@intel.com
Subject: Re: [dpdk-dev] [PATCH v5 2/2] eal: add asynchronous request API to DPDK IPC
Date: Mon, 26 Mar 2018 15:28:23 +0100	[thread overview]
Message-ID: <c230ef61-9cf5-39c1-ab97-4374c65a1f61@intel.com> (raw)
In-Reply-To: <cab9d8f5-3f5c-59f0-65dd-543585668c14@intel.com>

On 26-Mar-18 3:15 PM, Tan, Jianfeng wrote:
> 
> 
> On 3/24/2018 8:46 PM, Anatoly Burakov wrote:
>> This API is similar to the blocking API that is already present,
>> but reply will be received in a separate callback by the caller
>> (callback specified at the time of request, rather than registering
>> for it in advance).
>>
>> Under the hood, we create a separate thread to deal with replies to
>> asynchronous requests, that will just wait to be notified by the
>> main thread, or woken up on a timer.
>>
>> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> 
> Generally, it looks great to me except some trivial nits, so
> 
> Acked-by: Jianfeng Tan <jianfeng.tan@intel.com>

Thanks!

>> +static void
>> +trigger_async_action(struct pending_request *sr)
>> +{
>> +    struct async_request_param *param;
>> +    struct rte_mp_reply *reply;
>> +
>> +    param = sr->async.param;
>> +    reply = &param->user_reply;
>> +
>> +    param->clb(sr->request, reply);
>> +
>> +    /* clean up */
>> +    free(sr->async.param->user_reply.msgs);
> 
> How about simple "free(reply->msgs);"?
> 

I would prefer leaving it as is, as it makes it clear that i'm freeing 
everything to do with sync request.

>> +
>> +    sync_req->type = REQUEST_TYPE_ASYNC;
>> +    strcpy(sync_req->dst, dst);
>> +    sync_req->request = req;
>> +    sync_req->reply = reply_msg;
>> +    sync_req->async.param = param;
>> +
>> +    /* queue already locked by caller */
>> +
>> +    exist = find_sync_request(dst, req->name);
>> +    if (!exist)
>> +        TAILQ_INSERT_TAIL(&pending_requests.requests, sync_req, next);
>> +    if (exist) {
> 
> else?
> 

Will fix in v6

>> @@ -744,9 +1027,155 @@ rte_mp_request(struct rte_mp_msg *req, struct 
>> rte_mp_reply *reply,
>>   }
>>   int __rte_experimental
>> -rte_mp_reply(struct rte_mp_msg *msg, const char *peer)
>> +rte_mp_request_async(struct rte_mp_msg *req, const struct timespec *ts,
>> +        rte_mp_async_reply_t clb)
>>   {
>> +    struct rte_mp_msg *copy;
>> +    struct pending_request *dummy;
>> +    struct async_request_param *param = NULL;
> 
> No need to assign it to NULL.
> 

Will fix in v6.

>> +    /* we have to lock the request queue here, as we will be adding a 
>> bunch
>> +     * of requests to the queue at once, and some of the replies may 
>> arrive
>> +     * before we add all of the requests to the queue.
>> +     */
>> +    pthread_mutex_lock(&pending_requests.lock);
>> +
>> +    /* we have to ensure that callback gets triggered even if we 
>> don't send
>> +     * anything, therefore earlier we have allocated a dummy request. 
>> put it
>> +     * on the queue and fill it. we will remove it once we know we sent
>> +     * something.
>> +     */
> 
> Or we can add this dummy at last if it's necessary, instead of adding 
> firstly and remove if not necessary? No strong option here.
> 

Yep, sure, will fix in v6.

-- 
Thanks,
Anatoly

  reply	other threads:[~2018-03-26 14:28 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-27 14:59 [dpdk-dev] [PATCH] " Anatoly Burakov
2018-02-28 10:22 ` Burakov, Anatoly
2018-03-02 18:06 ` [dpdk-dev] [PATCH v2] " Anatoly Burakov
2018-03-07 16:57   ` [dpdk-dev] [PATCH v3] " Anatoly Burakov
2018-03-13 17:42     ` [dpdk-dev] [PATCH v4] " Anatoly Burakov
2018-03-23 15:38       ` Tan, Jianfeng
2018-03-23 18:21         ` Burakov, Anatoly
2018-03-24 13:22           ` Burakov, Anatoly
2018-03-24 12:46       ` [dpdk-dev] [PATCH v5 1/2] eal: rename IPC sync request to pending request Anatoly Burakov
2018-03-26  7:31         ` Tan, Jianfeng
2018-03-27 13:59         ` [dpdk-dev] [PATCH v6 " Anatoly Burakov
2018-03-27 16:27           ` Thomas Monjalon
2018-03-28  9:15             ` Burakov, Anatoly
2018-03-28 10:08               ` Thomas Monjalon
2018-03-28 10:57                 ` Burakov, Anatoly
2018-03-31 17:06           ` [dpdk-dev] [PATCH v7 1/3] " Anatoly Burakov
2018-03-31 17:06           ` [dpdk-dev] [PATCH v7 2/3] eal: rename mp_request to mp_request_sync Anatoly Burakov
2018-04-02  5:09             ` Tan, Jianfeng
2018-03-31 17:06           ` [dpdk-dev] [PATCH v7 3/3] eal: add asynchronous request API to DPDK IPC Anatoly Burakov
2018-04-04 22:15             ` Thomas Monjalon
2018-03-27 13:59         ` [dpdk-dev] [PATCH v6 2/2] " Anatoly Burakov
2018-03-27 16:33           ` Thomas Monjalon
2018-03-28  2:08             ` Tan, Jianfeng
2018-03-28  7:29               ` Thomas Monjalon
2018-03-28  8:22                 ` Van Haaren, Harry
2018-03-28  8:55                   ` Tan, Jianfeng
2018-03-28  9:10                     ` Van Haaren, Harry
2018-03-28  9:21                     ` Burakov, Anatoly
2018-03-28  9:53                       ` Thomas Monjalon
2018-03-28 10:42                         ` Burakov, Anatoly
2018-03-28 11:26                           ` Thomas Monjalon
2018-03-28 12:21                             ` Burakov, Anatoly
2018-03-28  9:11                 ` Bruce Richardson
2018-03-24 12:46       ` [dpdk-dev] [PATCH v5 " Anatoly Burakov
2018-03-26 14:15         ` Tan, Jianfeng
2018-03-26 14:28           ` Burakov, Anatoly [this message]
2018-03-02 18:48 ` [dpdk-dev] [PATCH] " Stephen Hemminger
2018-03-03 12:29   ` Burakov, Anatoly
2018-03-02 18:51 ` Stephen Hemminger
2018-03-03 13:44   ` Burakov, Anatoly

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=c230ef61-9cf5-39c1-ab97-4374c65a1f61@intel.com \
    --to=anatoly.burakov@intel.com \
    --cc=Directory@ecsmtp.ir.intel.com \
    --cc=dev@dpdk.org \
    --cc=empty@ecsmtp.ir.intel.com \
    --cc=failed@ecsmtp.ir.intel.com \
    --cc=jianfeng.tan@intel.com \
    --cc=konstantin.ananyev@intel.com \
    --cc=not@ecsmtp.ir.intel.com \
    --cc=remove@ecsmtp.ir.intel.com \
    --cc=to@ecsmtp.ir.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 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).