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: konstantin.ananyev@intel.com
Subject: Re: [dpdk-dev] [PATCH v4] eal: add asynchronous request API to DPDK IPC
Date: Sat, 24 Mar 2018 13:22:08 +0000	[thread overview]
Message-ID: <26e4659f-03a2-f426-7062-4e47e6a090c2@intel.com> (raw)
In-Reply-To: <8046b5ca-08d7-50f4-4917-e23950ac5856@intel.com>

A few of my yesterday's replies made no sense... Lesson learned: don't 
reply to code review comments on a late friday evening :)

On 23-Mar-18 6:21 PM, Burakov, Anatoly wrote:
> On 23-Mar-18 3:38 PM, Tan, Jianfeng wrote:
> 
> We do. However, we have to wait for *something* if there aren't any 
> asynchronous requests pending. There isn't a way to put "wait infinite 
> amount" as a time value, so i opted for next best thing - large enough 
> to not cause any performance issues. The timeout is arbitrary.
> 

Didn't realize we were holding the lock, so we could choose between wait 
and timed wait. Fixed in v5.

>>>   /** Double linked list of actions. */
>>> @@ -60,13 +65,37 @@ struct mp_msg_internal {
>>>       struct rte_mp_msg msg;
>>>   };
>>> +enum mp_request_type {
>>> +    REQUEST_TYPE_SYNC,
>>> +    REQUEST_TYPE_ASYNC
>>> +};
>>> +
>>> +struct async_request_shared_param {
>>> +    struct rte_mp_reply *user_reply;
>>> +    struct timespec *end;
>>
>> Why we have to make these two as pointers? Operating on pointers 
>> introduce unnecessary complexity.
> 
> Because those are shared between different pending requests. Each 
> pending request gets its own entry in the queue (because it expects 
> answer from a particular process), but the request data (callback, 
> number of requests processed, etc.) is shared between all requests for 
> this sync operation. We don't have the luxury of storing all of that in 
> a local variable like we do with synchronous requests :)

Missed the fact that you weren't referring to the need of storing these 
in shared_param but rather to the fact that i was storing 
malloc-allocated values that are shared, as pointers in shared param 
structure, when i could just as easily store actual structs there. Fixed 
in v5.


>> Too many structs are defined? How about just putting it like this:
>>
>> struct pending_request {
>>          TAILQ_ENTRY(sync_request) next;
>>          enum mp_request_type type;
>>          char dst[PATH_MAX];
>>          struct rte_mp_msg *request;
>>          struct rte_mp_msg *reply_msg;
>>          int reply_received;
>>          RTE_STD_C11
>>          union {
>>                  /* for sync request */
>>                  struct {
>>                          pthread_cond_t cond; /* used for mp thread to 
>> wake up requesting thread */
>>                  };
>>
>>                  /* for async request */
>>                  struct {
>>                          struct rte_mp_reply user_reply;
>>                          struct timespec end;
>>                          int n_requests_processed; /* store how 
>> requests */
>>                  };
>>          };
>> };
> 
> That can work, sure. However, i actually think that my approach is 
> clearer, because when you're working with autocomplete and a proper IDE, 
> it's clear which values are for which case (and i would argue it makes 
> the code more readable as well).

Again, didn't realize that you were referring to defining all of the 
structs and values outside of pending request, rather than storing them 
as anonymous structs (which would indeed cause problems with 
autocomplete and readability). Fixed in v5.

Thanks again for your review!

-- 
Thanks,
Anatoly

  reply	other threads:[~2018-03-24 13:22 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 [this message]
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
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=26e4659f-03a2-f426-7062-4e47e6a090c2@intel.com \
    --to=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=jianfeng.tan@intel.com \
    --cc=konstantin.ananyev@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).