* [PATCH] doc/eal: add signal safety warning
@ 2022-06-10 15:23 Stephen Hemminger
2022-06-10 22:53 ` Tyler Retzlaff
` (3 more replies)
0 siblings, 4 replies; 14+ messages in thread
From: Stephen Hemminger @ 2022-06-10 15:23 UTC (permalink / raw)
To: dev; +Cc: anatoly.burakov, 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>
---
doc/guides/prog_guide/env_abstraction_layer.rst | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/doc/guides/prog_guide/env_abstraction_layer.rst b/doc/guides/prog_guide/env_abstraction_layer.rst
index 5f0748fba1c0..36ab4b5ba9b6 100644
--- a/doc/guides/prog_guide/env_abstraction_layer.rst
+++ b/doc/guides/prog_guide/env_abstraction_layer.rst
@@ -732,6 +732,19 @@ controlled with tools like taskset (Linux) or cpuset (FreeBSD),
- with affinity restricted to 2-3, the Control Threads will end up on
CPU 2 (main lcore, which is the default when no CPU is available).
+Signal Safety
+~~~~~~~~~~~~~
+
+The DPDK functions in general can not be safely called from a signal handler.
+Most functions are not async-signal-safe because they can acquire locks
+and other resources that make them nonrentrant.
+
+To avoid problems with unsafe functions, can be avoided if required
+signals are blocked and a mechanism such as signalfd (Linux) is used
+to convert the asynchronous signals into messages that are processed
+by a EAL thread.
+
+
.. _known_issue_label:
Known Issues
--
2.35.1
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] doc/eal: add signal safety warning
2022-06-10 15:23 [PATCH] doc/eal: add signal safety warning Stephen Hemminger
@ 2022-06-10 22:53 ` Tyler Retzlaff
2022-06-10 23:38 ` Stephen Hemminger
2022-06-10 23:42 ` Tyler Retzlaff
` (2 subsequent siblings)
3 siblings, 1 reply; 14+ messages in thread
From: Tyler Retzlaff @ 2022-06-10 22:53 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: dev, anatoly.burakov
On Fri, Jun 10, 2022 at 08:23:43AM -0700, Stephen Hemminger wrote:
> 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>
> ---
> doc/guides/prog_guide/env_abstraction_layer.rst | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/doc/guides/prog_guide/env_abstraction_layer.rst b/doc/guides/prog_guide/env_abstraction_layer.rst
> index 5f0748fba1c0..36ab4b5ba9b6 100644
> --- a/doc/guides/prog_guide/env_abstraction_layer.rst
> +++ b/doc/guides/prog_guide/env_abstraction_layer.rst
> @@ -732,6 +732,19 @@ controlled with tools like taskset (Linux) or cpuset (FreeBSD),
> - with affinity restricted to 2-3, the Control Threads will end up on
> CPU 2 (main lcore, which is the default when no CPU is available).
>
> +Signal Safety
> +~~~~~~~~~~~~~
> +
> +The DPDK functions in general can not be safely called from a signal handler.
> +Most functions are not async-signal-safe because they can acquire locks
> +and other resources that make them nonrentrant.
> +
> +To avoid problems with unsafe functions, can be avoided if required
^^^^^^^^^^^^^^^^^^^^^^^^^
above doesn't quite read right for me, maybe a missing word / needs
re-wording?
> +signals are blocked and a mechanism such as signalfd (Linux) is used
> +to convert the asynchronous signals into messages that are processed
> +by a EAL thread.
> +
> +
> .. _known_issue_label:
>
> Known Issues
> --
> 2.35.1
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] doc/eal: add signal safety warning
2022-06-10 22:53 ` Tyler Retzlaff
@ 2022-06-10 23:38 ` Stephen Hemminger
0 siblings, 0 replies; 14+ messages in thread
From: Stephen Hemminger @ 2022-06-10 23:38 UTC (permalink / raw)
To: Tyler Retzlaff; +Cc: dev, anatoly.burakov
On Fri, 10 Jun 2022 15:53:34 -0700
Tyler Retzlaff <roretzla@linux.microsoft.com> wrote:
> On Fri, Jun 10, 2022 at 08:23:43AM -0700, Stephen Hemminger wrote:
> > 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>
> > ---
> > doc/guides/prog_guide/env_abstraction_layer.rst | 13 +++++++++++++
> > 1 file changed, 13 insertions(+)
> >
> > diff --git a/doc/guides/prog_guide/env_abstraction_layer.rst b/doc/guides/prog_guide/env_abstraction_layer.rst
> > index 5f0748fba1c0..36ab4b5ba9b6 100644
> > --- a/doc/guides/prog_guide/env_abstraction_layer.rst
> > +++ b/doc/guides/prog_guide/env_abstraction_layer.rst
> > @@ -732,6 +732,19 @@ controlled with tools like taskset (Linux) or cpuset (FreeBSD),
> > - with affinity restricted to 2-3, the Control Threads will end up on
> > CPU 2 (main lcore, which is the default when no CPU is available).
> >
> > +Signal Safety
> > +~~~~~~~~~~~~~
> > +
> > +The DPDK functions in general can not be safely called from a signal handler.
> > +Most functions are not async-signal-safe because they can acquire locks
> > +and other resources that make them nonrentrant.
> > +
> > +To avoid problems with unsafe functions, can be avoided if required
> ^^^^^^^^^^^^^^^^^^^^^^^^^
>
> above doesn't quite read right for me, maybe a missing word / needs
> re-wording?
Yes, will reword that
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] doc/eal: add signal safety warning
2022-06-10 15:23 [PATCH] doc/eal: add signal safety warning Stephen Hemminger
2022-06-10 22:53 ` Tyler Retzlaff
@ 2022-06-10 23:42 ` Tyler Retzlaff
2022-06-11 1:37 ` fengchengwen
2022-06-11 16:50 ` Mattias Rönnblom
2022-07-05 20:44 ` [PATCH v2] " Stephen Hemminger
3 siblings, 1 reply; 14+ messages in thread
From: Tyler Retzlaff @ 2022-06-10 23:42 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: dev, anatoly.burakov
On Fri, Jun 10, 2022 at 08:23:43AM -0700, Stephen Hemminger wrote:
> 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>
> ---
> doc/guides/prog_guide/env_abstraction_layer.rst | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/doc/guides/prog_guide/env_abstraction_layer.rst b/doc/guides/prog_guide/env_abstraction_layer.rst
> index 5f0748fba1c0..36ab4b5ba9b6 100644
> --- a/doc/guides/prog_guide/env_abstraction_layer.rst
> +++ b/doc/guides/prog_guide/env_abstraction_layer.rst
> @@ -732,6 +732,19 @@ controlled with tools like taskset (Linux) or cpuset (FreeBSD),
> - with affinity restricted to 2-3, the Control Threads will end up on
> CPU 2 (main lcore, which is the default when no CPU is available).
>
> +Signal Safety
> +~~~~~~~~~~~~~
> +
> +The DPDK functions in general can not be safely called from a signal handler.
> +Most functions are not async-signal-safe because they can acquire locks
> +and other resources that make them nonrentrant.
> +
> +To avoid problems with unsafe functions, can be avoided if required
> +signals are blocked and a mechanism such as signalfd (Linux) is used
> +to convert the asynchronous signals into messages that are processed
> +by a EAL thread.
> +
> +
> .. _known_issue_label:
>
> Known Issues
> --
> 2.35.1
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] doc/eal: add signal safety warning
2022-06-10 23:42 ` Tyler Retzlaff
@ 2022-06-11 1:37 ` fengchengwen
0 siblings, 0 replies; 14+ messages in thread
From: fengchengwen @ 2022-06-11 1:37 UTC (permalink / raw)
To: Tyler Retzlaff, Stephen Hemminger; +Cc: dev, anatoly.burakov
On 2022/6/11 7:42, Tyler Retzlaff wrote:
> On Fri, Jun 10, 2022 at 08:23:43AM -0700, Stephen Hemminger wrote:
>> 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 | 13 +++++++++++++
>> 1 file changed, 13 insertions(+)
>>
>> diff --git a/doc/guides/prog_guide/env_abstraction_layer.rst b/doc/guides/prog_guide/env_abstraction_layer.rst
>> index 5f0748fba1c0..36ab4b5ba9b6 100644
>> --- a/doc/guides/prog_guide/env_abstraction_layer.rst
>> +++ b/doc/guides/prog_guide/env_abstraction_layer.rst
>> @@ -732,6 +732,19 @@ controlled with tools like taskset (Linux) or cpuset (FreeBSD),
>> - with affinity restricted to 2-3, the Control Threads will end up on
>> CPU 2 (main lcore, which is the default when no CPU is available).
>>
>> +Signal Safety
>> +~~~~~~~~~~~~~
>> +
>> +The DPDK functions in general can not be safely called from a signal handler.
>> +Most functions are not async-signal-safe because they can acquire locks
>> +and other resources that make them nonrentrant.
>> +
>> +To avoid problems with unsafe functions, can be avoided if required
>> +signals are blocked and a mechanism such as signalfd (Linux) is used
>> +to convert the asynchronous signals into messages that are processed
>> +by a EAL thread.
>> +
>> +
>> .. _known_issue_label:
>>
>> Known Issues
>> --
>> 2.35.1
>
> .
>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] doc/eal: add signal safety warning
2022-06-10 15:23 [PATCH] doc/eal: add signal safety warning Stephen Hemminger
2022-06-10 22:53 ` Tyler Retzlaff
2022-06-10 23:42 ` Tyler Retzlaff
@ 2022-06-11 16:50 ` Mattias Rönnblom
2022-07-05 20:44 ` [PATCH v2] " Stephen Hemminger
3 siblings, 0 replies; 14+ messages in thread
From: Mattias Rönnblom @ 2022-06-11 16:50 UTC (permalink / raw)
To: Stephen Hemminger, dev; +Cc: anatoly.burakov
On 2022-06-10 17:23, Stephen Hemminger wrote:
> 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>
> ---
> doc/guides/prog_guide/env_abstraction_layer.rst | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
>
> diff --git a/doc/guides/prog_guide/env_abstraction_layer.rst b/doc/guides/prog_guide/env_abstraction_layer.rst
> index 5f0748fba1c0..36ab4b5ba9b6 100644
> --- a/doc/guides/prog_guide/env_abstraction_layer.rst
> +++ b/doc/guides/prog_guide/env_abstraction_layer.rst
> @@ -732,6 +732,19 @@ controlled with tools like taskset (Linux) or cpuset (FreeBSD),
> - with affinity restricted to 2-3, the Control Threads will end up on
> CPU 2 (main lcore, which is the default when no CPU is available).
>
> +Signal Safety
> +~~~~~~~~~~~~~
> +
> +The DPDK functions in general can not be safely called from a signal handler.
> +Most functions are not async-signal-safe because they can acquire locks
> +and other resources that make them nonrentrant.
> +
> +To avoid problems with unsafe functions, can be avoided if required
> +signals are blocked and a mechanism such as signalfd (Linux) is used
> +to convert the asynchronous signals into messages that are processed
> +by a EAL thread.
> +
Should we instead actually try to figure out what part of the API is and
should remain async-signal-safe? And then say "nothing else is".
Without an exhaustive list, we will leave the user to guessing, or going
into the current implementation to find out if a particular function is
currently async-signal-safe. When that code changes in a future
supposed-to-be-backward-compatible DPDK release, the application will break.
> +
> .. _known_issue_label:
>
> Known Issues
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v2] doc/eal: add signal safety warning
2022-06-10 15:23 [PATCH] doc/eal: add signal safety warning Stephen Hemminger
` (2 preceding siblings ...)
2022-06-11 16:50 ` Mattias Rönnblom
@ 2022-07-05 20:44 ` Stephen Hemminger
2022-07-11 21:15 ` Thomas Monjalon
` (2 more replies)
3 siblings, 3 replies; 14+ messages in thread
From: Stephen Hemminger @ 2022-07-05 20:44 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Tyler Retzlaff, Chengwen Feng, Anatoly Burakov
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.
+
+.. 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.
+
+
cgroup control
~~~~~~~~~~~~~~
--
2.35.1
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2] doc/eal: add signal safety warning
2022-07-05 20:44 ` [PATCH v2] " Stephen Hemminger
@ 2022-07-11 21:15 ` Thomas Monjalon
2022-07-11 21:31 ` Stephen Hemminger
2022-10-21 19:58 ` Stephen Hemminger
2022-07-11 23:02 ` [PATCH v3] " Stephen Hemminger
2022-07-11 23:04 ` [PATCH v4] " Stephen Hemminger
2 siblings, 2 replies; 14+ messages in thread
From: Thomas Monjalon @ 2022-07-11 21:15 UTC (permalink / raw)
To: Stephen Hemminger
Cc: dev, Tyler Retzlaff, Chengwen Feng, Anatoly Burakov,
david.marchand, bruce.richardson
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?
Note: the use of [#] is probably limited to a single usage in the page?
> +
> +.. 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.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2] doc/eal: add signal safety warning
2022-07-11 21:15 ` Thomas Monjalon
@ 2022-07-11 21:31 ` Stephen Hemminger
2022-10-21 19:58 ` Stephen Hemminger
1 sibling, 0 replies; 14+ messages in thread
From: Stephen Hemminger @ 2022-07-11 21:31 UTC (permalink / raw)
To: Thomas Monjalon
Cc: dev, Tyler Retzlaff, Chengwen Feng, Anatoly Burakov,
david.marchand, bruce.richardson
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.
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v3] doc/eal: add signal safety warning
2022-07-05 20:44 ` [PATCH v2] " Stephen Hemminger
2022-07-11 21:15 ` Thomas Monjalon
@ 2022-07-11 23:02 ` Stephen Hemminger
2022-07-11 23:04 ` [PATCH v4] " Stephen Hemminger
2 siblings, 0 replies; 14+ messages in thread
From: Stephen Hemminger @ 2022-07-11 23:02 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Tyler Retzlaff, Chengwen Feng, Anatoly Burakov
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.
+
+.. 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.
+
+
cgroup control
~~~~~~~~~~~~~~
--
2.35.1
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH v4] doc/eal: add signal safety warning
2022-07-05 20:44 ` [PATCH v2] " Stephen Hemminger
2022-07-11 21:15 ` Thomas Monjalon
2022-07-11 23:02 ` [PATCH v3] " Stephen Hemminger
@ 2022-07-11 23:04 ` Stephen Hemminger
2022-11-09 23:17 ` Stephen Hemminger
2022-11-15 16:21 ` David Marchand
2 siblings, 2 replies; 14+ messages in thread
From: Stephen Hemminger @ 2022-07-11 23:04 UTC (permalink / raw)
To: dev; +Cc: Stephen Hemminger, Tyler Retzlaff, Chengwen Feng, Anatoly Burakov
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>
---
v4 - add more functions and clarify
v3 - mistake (ignore it)
.../prog_guide/env_abstraction_layer.rst | 70 +++++++++++++++++++
1 file changed, 70 insertions(+)
diff --git a/doc/guides/prog_guide/env_abstraction_layer.rst b/doc/guides/prog_guide/env_abstraction_layer.rst
index 67842ae27207..35fbebe1be04 100644
--- a/doc/guides/prog_guide/env_abstraction_layer.rst
+++ b/doc/guides/prog_guide/env_abstraction_layer.rst
@@ -818,6 +818,76 @@ 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 Posix API defines an async-signal-safe function as one that can be safely
+ called from with a signal handler. Many DPDK functions are non-reentrant and
+ therefore are unsafe to call from a signal handler.
+
+ 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. For example, calling ``rte_mempool_lookup()`` from a signal
+ would deadlock if the signal happened during previous call ``rte_mempool``
+ routines.
+
+ Other functions are not signal safe because they use one or more
+ library routines that are not themselves signal safe.
+ For example, calling ``rte_panic()`` is not safe in a signal handler
+ because it uses ``rte_log()`` and ``rte_log()`` calls the
+ ``syslog()`` library function which is in the list of
+ signal safe functions in
+ `Signal-Safety manual page <https://man7.org/linux/man-pages/man7/signal-safety.7.html>`_.
+
+ The set of functions that are expected to be async-signal-safe in DPDK
+ is shown in the following table. The functions not otherwise noted
+ are not async-signal-safe.
+
+.. csv-table:: **Signal Safe Functions**
+ :header: "Function"
+ :widths: 32
+
+ rte_dump_stack
+ rte_eal_get_lcore_state
+ rte_eal_get_runtime_dir
+ rte_eal_has_hugepages
+ rte_eal_has_pci
+ rte_eal_lcore_role
+ rte_eal_process_type
+ rte_eal_using_phys_addrs
+ rte_get_hpet_cycles
+ rte_get_hpet_hz
+ rte_get_main_lcore
+ rte_get_next_lcore
+ rte_get_tsc_hz
+ rte_hypervisor_get
+ rte_hypervisor_get_name
+ rte_lcore_count
+ rte_lcore_cpuset
+ rte_lcore_has_role
+ rte_lcore_index
+ rte_lcore_is_enabled
+ rte_lcore_to_cpu_id
+ rte_lcore_to_socket_id
+ rte_log_get_global_level
+ rte_log_get_level
+ rte_memory_get_nchannel
+ rte_memory_get_nrank
+ rte_reciprocal_value
+ rte_reciprocal_value_u64
+ rte_socket_count
+ rte_socket_id
+ rte_socket_id_by_idx
+ rte_strerror
+ rte_strscpy
+ rte_strsplit
+ rte_sys_gettid
+ rte_uuid_compare
+ rte_uuid_is_null
+ rte_uuid_parse
+ rte_uuid_unparse
+
+
cgroup control
~~~~~~~~~~~~~~
--
2.35.1
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v2] doc/eal: add signal safety warning
2022-07-11 21:15 ` Thomas Monjalon
2022-07-11 21:31 ` Stephen Hemminger
@ 2022-10-21 19:58 ` Stephen Hemminger
1 sibling, 0 replies; 14+ messages in thread
From: Stephen Hemminger @ 2022-10-21 19:58 UTC (permalink / raw)
To: Thomas Monjalon
Cc: dev, Tyler Retzlaff, Chengwen Feng, Anatoly Burakov,
david.marchand, bruce.richardson
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?
>
> Note: the use of [#] is probably limited to a single usage in the page?
Yes. this is true, please apply this patch.
It is not safe to call functions that do any of the following:
printf
malloc
according to Linux async-signal-safe documentation
And because these all have locking or equivalent atomic the following
in DPDK are unsafe.
rte_ring
rte_timer
rte_spinlock, rte_rwlock, ...
any PMD operations
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v4] doc/eal: add signal safety warning
2022-07-11 23:04 ` [PATCH v4] " Stephen Hemminger
@ 2022-11-09 23:17 ` Stephen Hemminger
2022-11-15 16:21 ` David Marchand
1 sibling, 0 replies; 14+ messages in thread
From: Stephen Hemminger @ 2022-11-09 23:17 UTC (permalink / raw)
To: dev; +Cc: Tyler Retzlaff, Chengwen Feng, Anatoly Burakov
On Mon, 11 Jul 2022 16:04:48 -0700
Stephen Hemminger <stephen@networkplumber.org> wrote:
> 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>
There have been reports of this problem, multiple ack's of this patch
but it is still not merged. It documents a real problem that will trap
users.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH v4] doc/eal: add signal safety warning
2022-07-11 23:04 ` [PATCH v4] " Stephen Hemminger
2022-11-09 23:17 ` Stephen Hemminger
@ 2022-11-15 16:21 ` David Marchand
1 sibling, 0 replies; 14+ messages in thread
From: David Marchand @ 2022-11-15 16:21 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: dev, Tyler Retzlaff, Chengwen Feng, Anatoly Burakov
On Tue, Jul 12, 2022 at 1:05 AM Stephen Hemminger
<stephen@networkplumber.org> wrote:
>
> 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>
Applied, thanks.
--
David Marchand
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2022-11-15 16:21 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-10 15:23 [PATCH] doc/eal: add signal safety warning Stephen Hemminger
2022-06-10 22:53 ` Tyler Retzlaff
2022-06-10 23:38 ` Stephen Hemminger
2022-06-10 23:42 ` Tyler Retzlaff
2022-06-11 1:37 ` fengchengwen
2022-06-11 16:50 ` Mattias Rönnblom
2022-07-05 20:44 ` [PATCH v2] " Stephen Hemminger
2022-07-11 21:15 ` Thomas Monjalon
2022-07-11 21:31 ` Stephen Hemminger
2022-10-21 19:58 ` Stephen Hemminger
2022-07-11 23:02 ` [PATCH v3] " Stephen Hemminger
2022-07-11 23:04 ` [PATCH v4] " Stephen Hemminger
2022-11-09 23:17 ` Stephen Hemminger
2022-11-15 16:21 ` David Marchand
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).