|SUCCESS| [13/13] examples/eventdev_pipeline: make signal handler safe

dpdklab at iol.unh.edu dpdklab at iol.unh.edu
Mon Sep 7 01:56:34 CEST 2026


Test-Label: ai-code-review
Test-Status: SUCCESS
https://dpdk.org/patch/169134

_AI Code Review_

=== Patch Review: series.patch (via Claude) ===
Review date: 2026-09-06

# Review of DPDK Patch Series: Signal Handler Safety

## Overview

This patch series addresses signal handling safety issues across multiple DPDK applications and examples. The changes correctly move non-async-signal-safe operations (printf, teardown code, exit) out of signal handlers into the main control flow.

---

## PATCH 01/13: graph: do not call printf in signal

**Status: CORRECT**

No issues found. The patch removes `printf()` from the signal handler and only sets the `force_quit` flag, which is appropriate.

---

## PATCH 02/13: examples: remove printf from signal handler

**Status: CORRECT**

No issues found. Removes `printf()` calls from signal handlers in multiple examples and marks unused `sig_num` parameter with `__rte_unused` in one case.

---

## PATCH 03/13: examples/vmdq: do not print from signal handler

**Status: CORRECT with INFO**

The implementation is correct: sets `stats_requested` flag in the SIGHUP handler, checks it in the main forwarding loop, and prints stats from the main lcore.

**Info:**
- The `stats_requested` flag is `volatile sig_atomic_t`, which is correct for signal handler communication.
- The flag is checked only on the main lcore (`lcore_id == rte_get_main_lcore()`), which is appropriate since only one lcore should respond to the signal.

---

## PATCH 04/13: examples/symmetric_mp: do not print or exit in handler

**Status: CORRECT**

No issues found. The patch:
- Removes `printf()` and `exit()` from the signal handler
- Sets a `quit` flag (`volatile sig_atomic_t`)
- Modifies the forwarding loop to check the flag and return
- Calls `print_stats()` and `rte_eal_mp_wait_lcore()` in main after the workers return

---

## PATCH 05/13: examples/vdpa: make signal handler safe

**Status: CORRECT**

No issues found. The patch:
- Sets a `quit` flag in the signal handler
- Breaks the `scanf()` loop when `quit` is set
- Calls `vdpa_sample_quit()` after the loop exits, whether from signal or 'q' input

---

## PATCH 06/13: examples/vhost: make signal handler safe

**Status: CORRECT**

No issues found. The patch:
- Sets a `quit` flag (`volatile sig_atomic_t`) in the signal handler
- Modifies `switch_worker()` to check the flag
- Calls `unregister_drivers()` in main after `rte_eal_wait_lcore()`

---

## PATCH 07/13: examples/vhost_blk: do not tear down from signal handler

**Status: CORRECT**

No issues found. The patch:
- Sets a `quit` flag in the signal handler
- Breaks the `sleep(1)` loop when `quit` is set
- Destroys the controller in main after the loop exits

---

## PATCH 08/13: examples/ntb: do not print and re-raise from signal handler

**Status: CORRECT**

No issues found. The patch:
- Removes `printf()`, `signal()`, and `kill()` from the signal handler
- Sets `conf->stopped = 1` for each worker lcore with streams
- The existing `conf->stopped` check in the forwarding loop will cause the workers to return
- The field is correctly changed from `uint8_t` to `volatile uint8_t` since it is now written from signal context

---

## PATCH 09/13: examples/ipsecgw: do not print from signal handler

**Status: CORRECT**

No issues found. Removes `printf()` from the signal handler, only sets `force_quit`.

---

## PATCH 10/13: examples/l2fwd-macsec: remove print in signal handler

**Status: CORRECT**

No issues found. Removes `printf()` from the signal handler, only sets `force_quit`.

---

## PATCH 11/13: examples/ethtool: fix exit flag and unchecked cmdline

**Status: CORRECT**

The patch addresses two issues:
1. Changes `exit_now` from `int` to `volatile int` since it is polled on one lcore and set on another.
2. Adds a NULL check for `cmdline_stdin_new()` return value.

Both changes are correct. Note: the guidelines state that `bool` would be preferred over `int` for the flag, but this is an existing field and changing its type would be a larger refactor; the volatile qualification is the necessary fix here.

---

## PATCH 12/13: examples/vmdq_dcb: allow exit on signal

**Status: CORRECT**

No issues found. The patch:
- Adds a `quit` flag (`volatile sig_atomic_t`) set by SIGINT/SIGTERM
- Modifies the forwarding loop to check the flag
- Adds `rte_eal_wait_lcore()` calls before cleanup
- Returns 0 from `lcore_main()` instead of running forever

---

## PATCH 13/13: examples/eventdev_pipeline: make signal handler safe

**Status: CORRECT with INFO**

The patch correctly addresses signal handler safety:
- Removes `rte_exit()` and `rte_event_dev_dump()` from the signal handler
- Changes the second-signal path to `_exit()`, which is async-signal-safe
- Moves the `--dump-dev` dump to main after `rte_eal_mp_wait_lcore()`
- For SIGTSTP, sets `cdata.dump_dev_signal`, which is already checked by `schedule_devices()`
- Correctly changes `dump_dev_signal` from `int` to `volatile sig_atomic_t`

**Info:**
- The commit message notes that the SIGTSTP dump now depends on a scheduler lcore being configured. This is a behavior change (the old code always dumped on SIGTSTP regardless of scheduler presence), but it aligns with the existing `schedule_devices()` check for `cdata.dump_dev_signal`. If this is unintended, the authors may want to add a fallback dump path in the signal handler for configurations without a scheduler lcore, but that would require keeping some dump logic in the handler, which is generally undesirable. The current approach is consistent with the "move everything out of the handler" philosophy.

---

## Summary

All 13 patches are **CORRECT**. The series systematically removes non-async-signal-safe operations from signal handlers across the DPDK codebase and moves them into the main control flow where they belong. The changes improve code quality and eliminate undefined behavior flagged by GCC's analyzer.

**No errors or warnings to report.**


More information about the test-report mailing list