From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 61461A0524;
	Thu,  4 Feb 2021 13:53:43 +0100 (CET)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id CDF6324058E;
	Thu,  4 Feb 2021 13:53:42 +0100 (CET)
Received: from us-smtp-delivery-124.mimecast.com
 (us-smtp-delivery-124.mimecast.com [216.205.24.124])
 by mails.dpdk.org (Postfix) with ESMTP id 9314D240586
 for <dev@dpdk.org>; Thu,  4 Feb 2021 13:53:41 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1612443220;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 content-transfer-encoding:content-transfer-encoding:
 in-reply-to:in-reply-to:references:references;
 bh=oYp7P5WZIRvK8jISYcfs/VIFnzPyhRmr2UUcxDXpOPM=;
 b=bJBeJZ2nlvN2oaKJxlHpv1G5KLkMbgW74NLCl2g46vJz3MR2GW9N+mZ6bLI/QiTRq9kahP
 y6baVEwpibTlXJArJEV7reHKQHz5yQfwxxusIoInzcUoJpwj+08u51doS7H8LkWjrs2fKC
 poSfe5K6hBftSu/T5HAtT+vmV3OgaIY=
Received: from mail-ua1-f71.google.com (mail-ua1-f71.google.com
 [209.85.222.71]) (Using TLS) by relay.mimecast.com with ESMTP id
 us-mta-319-p9FuROO3O0aj5ZAVuo7FiQ-1; Thu, 04 Feb 2021 07:53:38 -0500
X-MC-Unique: p9FuROO3O0aj5ZAVuo7FiQ-1
Received: by mail-ua1-f71.google.com with SMTP id d9so856879uaf.18
 for <dev@dpdk.org>; Thu, 04 Feb 2021 04:53:38 -0800 (PST)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc:content-transfer-encoding;
 bh=oYp7P5WZIRvK8jISYcfs/VIFnzPyhRmr2UUcxDXpOPM=;
 b=Yd0jiSy8QreEGMpE4Q6G8GmuWulCdY8MMEj8bS1mdWooJjycD9VHxk1REbxUtFWAIX
 YIG45fIbSsh24AQpqN5MdxAtSR5QOS/XLWMB4vQ8KljgiZfPWpUjRfV7OEUA5M5LzUjr
 W8It1/rMpK0w9aOCileL+VIN04/gnIs0a3HU677itSKUvCY8O+HdfRIa/CmR711eeCcG
 JoZP5Y2lEF0rBu03Ikw7zB2UcgXXufJ9M9aq81LlmrlE0KhnkagKk9E5xe71OCnibKeN
 HqNkQiHrLRB+2b07t1QUeLy0xWja77NdTeoVCXb5eYQ2XcmNFFq804N7J66lc54AaE8I
 CNzg==
X-Gm-Message-State: AOAM530sIu1GF1wAXAl2Z31iqmklUV+ihq0hmwcor2k3aLHyBsIslJrC
 UVhXXHne8qybqGM5ckoZqszL6oM6r9kTkwZVbnrz8/k8P26OHI1AFRBf0+9Yl3+WwUfdVWZYJsb
 CkICSb15cYzIDydhngsk=
X-Received: by 2002:a1f:2b4d:: with SMTP id r74mr4751682vkr.17.1612443217653; 
 Thu, 04 Feb 2021 04:53:37 -0800 (PST)
X-Google-Smtp-Source: ABdhPJxrPenS2wAftsGijxqGeMRsvcyXVZwGC5WiB7OsJLnMu/Ultch3f5O59aoBQ4RWA582ls9LgzGJvJ4EOGYPOmo=
X-Received: by 2002:a1f:2b4d:: with SMTP id r74mr4751677vkr.17.1612443217377; 
 Thu, 04 Feb 2021 04:53:37 -0800 (PST)
MIME-Version: 1.0
References: <20200826055233.26075-1-rohit.raj@nxp.com>
 <20201008153048.19369-1-rohit.raj@nxp.com>
 <20201008153048.19369-2-rohit.raj@nxp.com>
 <CAJFAV8yHGX2uOs1HQL4p+tXtAb-keVtvORPbtSa9bLMaRtOkbg@mail.gmail.com>
 <0c5203ec-2497-0be0-925a-834aa95fcc5a@huawei.com>
In-Reply-To: <0c5203ec-2497-0be0-925a-834aa95fcc5a@huawei.com>
From: David Marchand <david.marchand@redhat.com>
Date: Thu, 4 Feb 2021 13:53:26 +0100
Message-ID: <CAJFAV8xtc88ycbN40YGNi1YMiLYf8XGbX0ff1Gi7aM6Mb75teQ@mail.gmail.com>
To: oulijun <oulijun@huawei.com>
Cc: dev <dev@dpdk.org>
Authentication-Results: relay.mimecast.com;
 auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dmarchan@redhat.com
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Subject: Re: [dpdk-dev] [PATCH v4 2/5] examples/multi_process: cleanup bus
 objects while terminating app
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

On Mon, Jan 25, 2021 at 12:07 PM oulijun <oulijun@huawei.com> wrote:
> >> +static void
> >> +signal_handler(int signal)
> >> +{
> >> +       if (signal =3D=3D SIGINT)
> >> +               rte_eal_cleanup();
> >> +       exit(0);
> >> +}
> >
> > Calling rte_eal_cleanup from a signal handler is a bad idea.
> > In most cases, you are racing with other threads still using DPDK resou=
rces.
> > https://git.dpdk.org/dpdk/commit?id=3D2c434431f4
> > https://git.dpdk.org/dpdk/commit?id=3D613ce6691c
> >
> > This might not be a problem in this multi_process example, but let's
> > keep a consistent way across all examples.
> > Thanks.
> Hi=EF=BC=8C
>    I want to know why you don't think he's a problem. recently, we use
> the patch
> https://patchwork.dpdk.org/patch/86988/
> startup with multiprocess. Use the tester to send traffic and kill the
> slave process repeatedly.
> The coredump exception occurs. According to my analysis, the cause is
> that resources are not released after the slave process is killed.
>

Not sure I get your question and I don't see the relation with the
testpmd patch.
I did not say we must not release resources.

Just to rephrase my previous mail:

Generally speaking, calling rte_eal_cleanup() from a signal handler is
wrong since it creates races with other threads.
I recommend putting in place a synchronisation mechanism so that all
worker threads break out of their processing loop and the main thread
synchronizes/joins with them before calling rte_eal_cleanup() in its
exit path.

Now, for this patch, in
examples/multi_process/client_server_mp/mp_client/client.c, this
secondary process code seems to only have one thread (but I might be
wrong).
If this is true, then no race in theory =3D> my comment "This might not
be a problem in this multi_process example".


--=20
David Marchand