Commit 8b85d70
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 07d75db commit 8b85d70
3 files changed
Lines changed: 33 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1125 | 1125 | | |
1126 | 1126 | | |
1127 | 1127 | | |
1128 | | - | |
| 1128 | + | |
| 1129 | + | |
1129 | 1130 | | |
1130 | | - | |
| 1131 | + | |
1131 | 1132 | | |
1132 | 1133 | | |
1133 | 1134 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
108 | 108 | | |
109 | 109 | | |
110 | 110 | | |
| 111 | + | |
111 | 112 | | |
112 | 113 | | |
113 | 114 | | |
| |||
5859 | 5860 | | |
5860 | 5861 | | |
5861 | 5862 | | |
| 5863 | + | |
5862 | 5864 | | |
5863 | 5865 | | |
5864 | 5866 | | |
| |||
5886 | 5888 | | |
5887 | 5889 | | |
5888 | 5890 | | |
| 5891 | + | |
5889 | 5892 | | |
5890 | 5893 | | |
5891 | 5894 | | |
| |||
| 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 | | |
| |||
185 | 188 | | |
186 | 189 | | |
187 | 190 | | |
| 191 | + | |
188 | 192 | | |
189 | 193 | | |
190 | 194 | | |
| |||
865 | 869 | | |
866 | 870 | | |
867 | 871 | | |
| 872 | + | |
868 | 873 | | |
869 | | - | |
870 | | - | |
871 | | - | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
872 | 878 | | |
873 | | - | |
874 | | - | |
875 | | - | |
876 | | - | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
877 | 897 | | |
878 | 898 | | |
879 | 899 | | |
| |||
0 commit comments