All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Burakov, Anatoly" <anatoly.burakov@intel.com>
To: Thomas Monjalon <thomas@monjalon.net>,
	Stephen Hemminger <stephen@networkplumber.org>
Cc: dev@dpdk.org, Stephen Hemminger <sthemmin@microsoft.com>
Subject: Re: [PATCH 3/4] eal: don't crash if alarm set fails
Date: Thu, 25 Oct 2018 15:04:42 +0100	[thread overview]
Message-ID: <cb645bbd-de30-c2ee-e29e-bc93a03597d6@intel.com> (raw)
In-Reply-To: <1682249.U5QVuGPMnJ@xps>

On 25-Oct-18 12:51 AM, Thomas Monjalon wrote:
> 18/09/2018 12:16, Burakov, Anatoly:
>> On 18-Sep-18 10:43 AM, Thomas Monjalon wrote:
>>> 26/07/2018 11:41, Burakov, Anatoly:
>>>> On 25-Jul-18 7:20 PM, Stephen Hemminger wrote:
>>>>> There is no need to call rte_exit and crash the application here;
>>>>> better to let the application handle the error itself.
>>>>>
>>>>> Remove the gratuitous profanity which would be visible if
>>>>> the rte_exit was still there.
>>>>>
>>>>> Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com>
>>>>> ---
>>>>> --- a/lib/librte_eal/common/eal_common_proc.c
>>>>> +++ b/lib/librte_eal/common/eal_common_proc.c
>>>>> @@ -841,14 +841,12 @@ mp_request_async(const char *dst, struct rte_mp_msg *req,
>>>>>     
>>>>>     	param->user_reply.nb_sent++;
>>>>>     
>>>>> -	if (rte_eal_alarm_set(ts->tv_sec * 1000000 + ts->tv_nsec / 1000,
>>>>> -			      async_reply_handle, pending_req) < 0) {
>>>>> +	ret = rte_eal_alarm_set(ts->tv_sec * 1000000 + ts->tv_nsec / 1000,
>>>>> +				async_reply_handle, pending_req);
>>>>> +	if (ret < 0)
>>>>>     		RTE_LOG(ERR, EAL, "Fail to set alarm for request %s:%s\n",
>>>>>     			dst, req->name);
>>>>> -		rte_panic("Fix the above shit to properly free all memory\n");
>>>>
>>>> Profanity aside, i think the message was trying to tell me something -
>>>> namely, that if alarm_set fails, we're risking to leak this memory if
>>>> reply from the peer never comes, and we're risking leaving the
>>>> application hanging because the timeout never triggers. I'm not sure if
>>>> leaving this "to the user" is the right choice, because there is no way
>>>> for the user to free IPC-internal memory if it leaks.
>>>>
>>>> So i think the proper way to handle this would've been to set the alarm
>>>> first, then, if it fails, don't sent the message in the first place.
>>>
>>> What should be done here? OK to remove rte_panic for now?
>>>
>>
>> As i said, the above fix is wrong because it leaks memory (however
>> unlikely it may be).
>>
>> The alarm set call should be moved to before we do send_msg() call (and
>> goto fail; on failure). That way, even if alarm triggers too early (i.e.
>> immediately), the requests tailq will still be locked until we complete
>> our request sends - so we appropriately free memory on response, on
>> timeout or in our failure handler if alarm set has failed.
> 
> Someone to fix it, please?
> 

I'll do it.

-- 
Thanks,
Anatoly

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

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-25 18:20 [PATCH 0/4] small cleanups Stephen Hemminger
2018-07-25 18:20 ` [PATCH 1/4] arm: remove profanity in comment Stephen Hemminger
2018-10-24 23:50   ` Thomas Monjalon
2018-07-25 18:20 ` [PATCH 2/4] bnx2x: remove profanity Stephen Hemminger
2018-09-18  9:40   ` Thomas Monjalon
2018-09-18 15:07     ` Stephen Hemminger
2018-09-19 16:40       ` Mody, Rasesh
2018-10-16 14:45         ` Ferruh Yigit
2018-10-16 14:52           ` Ferruh Yigit
2018-10-26 14:56   ` Burakov, Anatoly
2018-07-25 18:20 ` [PATCH 3/4] eal: don't crash if alarm set fails Stephen Hemminger
2018-07-26  9:34   ` Burakov, Anatoly
2018-07-26  9:41   ` Burakov, Anatoly
2018-09-18  9:43     ` Thomas Monjalon
2018-09-18 10:16       ` Burakov, Anatoly
2018-10-24 23:51         ` Thomas Monjalon
2018-10-25 14:04           ` Burakov, Anatoly [this message]
2018-10-26 14:55   ` [PATCH] eal/mp: remove rte_panic and profanity Anatoly Burakov
2018-10-26 20:41     ` [dpdk-stable] " Thomas Monjalon
2018-10-30 10:31       ` Burakov, Anatoly
2018-11-13 18:03     ` [PATCH v2] " Anatoly Burakov
2018-11-13 23:03       ` Thomas Monjalon
2018-07-25 18:20 ` [PATCH 4/4] ixgbe: remove mild profanity Stephen Hemminger
2018-10-16 15:00   ` Ferruh Yigit

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=cb645bbd-de30-c2ee-e29e-bc93a03597d6@intel.com \
    --to=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=stephen@networkplumber.org \
    --cc=sthemmin@microsoft.com \
    --cc=thomas@monjalon.net \
    /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.