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 96790A0032;
	Mon, 11 Jul 2022 23:31:25 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 3573640687;
	Mon, 11 Jul 2022 23:31:25 +0200 (CEST)
Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com
 [209.85.214.177])
 by mails.dpdk.org (Postfix) with ESMTP id E728C40156
 for <dev@dpdk.org>; Mon, 11 Jul 2022 23:31:23 +0200 (CEST)
Received: by mail-pl1-f177.google.com with SMTP id v21so3035765plo.0
 for <dev@dpdk.org>; Mon, 11 Jul 2022 14:31:23 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=networkplumber-org.20210112.gappssmtp.com; s=20210112;
 h=date:from:to:cc:subject:message-id:in-reply-to:references
 :mime-version:content-transfer-encoding;
 bh=vaycnrQT5FHGHX9O8ABdc/4LATEky4wNesQbClZxC5U=;
 b=2FAsozNX/8E/tc49Sf4+LigyOOILYIn9xGrQM15u+HBaf95I1h5USlKCnoZ4bFZWtv
 bqj0QHIsHsl/46CfJsvJz0f5mwRCgmbWTFTKFXm/tH2hwopw7sbcccRPbw2Umjn2S9ud
 HesGIcbDLJOmV+Xf+YEmahwa0HXP8j4GjZVqmWLnrBVWSYBqbuwzzXRchGVJperTKZ0A
 l3MzJoymIy3cAyLR29+0LG8A9h+papz5LuvgYLY5ko3DKO/R65LhjmPwtrPfm9J6yZ7y
 Cz4dVrLfbDzZjVh4k+yt3KCmuS8C15165VEFZltVAikLC11V3FAxJTjKAtFoGjqieNbd
 9WmQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to
 :references:mime-version:content-transfer-encoding;
 bh=vaycnrQT5FHGHX9O8ABdc/4LATEky4wNesQbClZxC5U=;
 b=1IQd/hj9RE5DlCVZa3lMON+xvHb+FjmZIRnSNQh1wwvWAAjxa5EzCguuBuatt4jd+p
 AgzhmoIs6lQkz5ruRzHjicBcPKsUAEdVbfyj+ce0uUJeygMSmNry8gpvvSec/CquSPJ5
 tdamiDywUoqJlAZDUMRB75daYrvAU8Eq8ywwRioJXZVtVNZYyiMCl3b/Id3/bsk+0WQh
 YMrgoXXkrjubrvpdC6P/mpMVym3J1NXFykGj/rSkCcWEhqXEXdGqhRUJELVBe1ycnFTy
 8KQFlVzZzogGVoAUD6/M6gzZVI/Xj5l+SSRLCp6AnszrjxoXI63so+LdshALus9NNchk
 gKAA==
X-Gm-Message-State: AJIora/InsMtTo9/OL73bJLvnyNHk0fpZM6sStR8TTrLg4HLqAR8HC8b
 IXxKxAn9BcNYYzUdKxmHJU0p/A==
X-Google-Smtp-Source: AGRyM1uuAJZ1o+xEropmBGtXQSUe9FZ2kqXVu2/xSlpDRyfo48UwqNEXKiu0aZsJePKmzV3ZRms1mw==
X-Received: by 2002:a17:90b:1e0e:b0:1ef:97f9:dfb5 with SMTP id
 pg14-20020a17090b1e0e00b001ef97f9dfb5mr405091pjb.217.1657575083028; 
 Mon, 11 Jul 2022 14:31:23 -0700 (PDT)
Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199])
 by smtp.gmail.com with ESMTPSA id
 n16-20020a170902d2d000b0016bee3caabesm5238102plc.270.2022.07.11.14.31.22
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 11 Jul 2022 14:31:22 -0700 (PDT)
Date: Mon, 11 Jul 2022 14:31:19 -0700
From: Stephen Hemminger <stephen@networkplumber.org>
To: Thomas Monjalon <thomas@monjalon.net>
Cc: dev@dpdk.org, Tyler Retzlaff <roretzla@linux.microsoft.com>, Chengwen
 Feng <fengchengwen@huawei.com>, Anatoly Burakov
 <anatoly.burakov@intel.com>, david.marchand@redhat.com,
 bruce.richardson@intel.com
Subject: Re: [PATCH v2] doc/eal: add signal safety warning
Message-ID: <20220711143119.3894d80f@hermes.local>
In-Reply-To: <3005473.57xzQst1vy@thomas>
References: <20220610152343.38455-1-stephen@networkplumber.org>
 <20220705204401.158650-1-stephen@networkplumber.org>
 <3005473.57xzQst1vy@thomas>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
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

On Mon, 11 Jul 2022 23:15:26 +0200
Thomas Monjalon <thomas@monjalon.net> wrote:

> 05/07/2022 22:44, Stephen Hemminger:
> > The DPDK is not designed to be used from a signal handler.
> > Add a notice in the documentation describing this limitation,
> > similar to Linux signal-safety manual page.
> > 
> > Bugzilla ID: 1030
> > Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> > Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
> > Acked-by: Chengwen Feng <fengchengwen@huawei.com>
> > ---
> >  doc/guides/prog_guide/env_abstraction_layer.rst | 15 +++++++++++++++
> >  1 file changed, 15 insertions(+)
> > 
> > diff --git a/doc/guides/prog_guide/env_abstraction_layer.rst b/doc/guides/prog_guide/env_abstraction_layer.rst
> > index 67842ae27207..de7ee92bba39 100644
> > --- a/doc/guides/prog_guide/env_abstraction_layer.rst
> > +++ b/doc/guides/prog_guide/env_abstraction_layer.rst
> > @@ -818,6 +818,21 @@ Known Issues
> >  
> >    The debug statistics of rte_ring, rte_mempool and rte_timer are not supported in an unregistered non-EAL pthread.
> >  
> > ++ signal safety
> > +
> > +  The DPDK library is not designed to be async-signal-safe.
> > +  Except where explicitly stated otherwise [#]_, the DPDK functions are nonreentrant and are unsafe to call from a signal handler.
> > +
> > +.. [#] Only the function ``rte_dump_stack()`` can safely be called from signal handler in this version of DPDK.  
> 
> Really? Are you sure?

There are some trivial ones that are signal safe that are pure functions.
Like the bitfield and string functions.

But any function that matters such as rte_log, rte_mbuf, rte_mempool,
and any driver function are going to be problematic.

> 
> Note: the use of [#] is probably limited to a single usage in the page?

Isn't it supposed to autonumber?

> 
> > +
> > +.. note::
> > +  The kinds of issues that make DPDK functions unsafe can be understood when
> > +  one considers that much of the code in DPDK uses locks and other shared
> > +  resources. If a device driver holding a ``rte_spinlock`` is interrupted
> > +  by a signal and control operation is then performed that would acquire
> > +  the same lock, a deadlock would result.  
> 
> I find this note quite confusing.

I based it off what signal-safety says. Yes it really is that bad.