Commit ffebbcd
committed
perftest: fix premature exit when select() is interrupted by SIGALRM
The perftest framework makes extensive use of alarm() to control test
duration (--duration) and to schedule periodic tasks.
Functions such as `run_iter_bw()`, `run_iter_lat_send()`, and
`run_iter_bi()` install a handler via `signal(SIGALRM, catch_alarm)`
when the -D option is used, and then set an alarm.
In `run_iter_bw_server()` and `run_iter_bi()`, a watchdog is also
installed in iterations mode via `signal(SIGALRM, check_alive)`
followed by `alarm(60)` to detect stalled tests.
In the problematic case, `run_iter_bi()` with the -e option invokes
`ctx_notify_send_recv_events()`, which performs a `select()` on two file
descriptors:
`ctx->recv_channel->fd` — CQ receive completion channel
`ctx->send_channel->fd` — CQ send completion channel
When a completion event is generated, the kernel marks the corresponding
file descriptor readable and `select()` returns.
However, due to low processing speed on the some NICs, no completion
event is generated within 60 seconds(test case is not finished under
high pressure test). The watchdog `alarm()` fires, delivering SIGALRM,
which interrupts the blocking `select()` call. The function then exits
with an error instead of retrying.
This behavior exposes a robustness issue in perftest: SIGALRM in this
context is meant only as a check-alive signal, not as a fatal condition.
A `select()` call interrupted by SIGALRM should be restarted rather than
causing an unexpected termination.
This patch updates perftest to properly handle EINTR by retrying
`select()` when it is interrupted by SIGALRM, ensuring correct behavior
even under slow device processing conditions.
Signed-off-by: Ruizhe Zhou <zhouruizhe@resnics.com>1 parent a9f846e commit ffebbcd
3 files changed
Lines changed: 33 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1294 | 1294 | | |
1295 | 1295 | | |
1296 | 1296 | | |
1297 | | - | |
| 1297 | + | |
| 1298 | + | |
1298 | 1299 | | |
1299 | | - | |
| 1300 | + | |
1300 | 1301 | | |
1301 | 1302 | | |
1302 | 1303 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
| 113 | + | |
113 | 114 | | |
114 | 115 | | |
115 | 116 | | |
| |||
6621 | 6622 | | |
6622 | 6623 | | |
6623 | 6624 | | |
| 6625 | + | |
6624 | 6626 | | |
6625 | 6627 | | |
6626 | 6628 | | |
| |||
6648 | 6650 | | |
6649 | 6651 | | |
6650 | 6652 | | |
| 6653 | + | |
6651 | 6654 | | |
6652 | 6655 | | |
6653 | 6656 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
75 | 78 | | |
76 | 79 | | |
77 | 80 | | |
| |||
201 | 204 | | |
202 | 205 | | |
203 | 206 | | |
| 207 | + | |
204 | 208 | | |
205 | 209 | | |
206 | 210 | | |
| |||
942 | 946 | | |
943 | 947 | | |
944 | 948 | | |
| 949 | + | |
945 | 950 | | |
946 | | - | |
947 | | - | |
948 | | - | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
949 | 955 | | |
950 | | - | |
951 | | - | |
952 | | - | |
953 | | - | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
954 | 974 | | |
955 | 975 | | |
956 | 976 | | |
| |||
0 commit comments