* [PATCH] eal/linux: harden uevent recv error handling
@ 2026-08-13 20:16 Randy Tice
2026-08-13 22:57 ` Stephen Hemminger
0 siblings, 1 reply; 2+ messages in thread
From: Randy Tice @ 2026-08-13 20:16 UTC (permalink / raw)
To: dev; +Cc: Randy Tice
The Linux uevent handler is harded for non-blocking receive behavior
Signed-off-by: Randy Tice <rtice@cisco.com>
---
lib/eal/linux/eal_dev.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/lib/eal/linux/eal_dev.c b/lib/eal/linux/eal_dev.c
index ec408649d0..29a889800a 100644
--- a/lib/eal/linux/eal_dev.c
+++ b/lib/eal/linux/eal_dev.c
@@ -241,9 +241,14 @@ dev_uev_handler(__rte_unused void *param)
ret = recv(rte_intr_fd_get(intr_handle), buf, EAL_UEV_MSG_LEN,
MSG_DONTWAIT);
- if (ret < 0 && errno == EAGAIN)
+ if (ret < 0 &&
+ (errno == EAGAIN || errno == EWOULDBLOCK))
return;
- else if (ret <= 0) {
+ else if (ret < 0 &&
+ (errno == ENOBUFS || errno == ENOMEM)) {
+ EAL_LOG(ERR, "unexpected error on uvent recv: %d", errno);
+ return;
+ } else if (ret <= 0) {
/* connection is closed or broken, can not up again. */
EAL_LOG(ERR, "uevent socket connection is broken.");
rte_eal_alarm_set(1, dev_delayed_unregister, NULL);
--
2.51.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] eal/linux: harden uevent recv error handling
2026-08-13 20:16 [PATCH] eal/linux: harden uevent recv error handling Randy Tice
@ 2026-08-13 22:57 ` Stephen Hemminger
0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2026-08-13 22:57 UTC (permalink / raw)
To: Randy Tice; +Cc: dev
On Thu, 13 Aug 2026 16:16:56 -0400
Randy Tice <rtice@cisco.com> wrote:
> The Linux uevent handler is harded for non-blocking receive behavior
>
> Signed-off-by: Randy Tice <rtice@cisco.com>
> ---
Good idea, but the code needs to unregister the uevent fd on error.
Also, fix spelling error, decode error message, and handle odd
case where recv() got interrupted.
Something like (untested):
diff --git a/lib/eal/linux/eal_dev.c b/lib/eal/linux/eal_dev.c
index ec408649d0..1985d5e122 100644
--- a/lib/eal/linux/eal_dev.c
+++ b/lib/eal/linux/eal_dev.c
@@ -241,11 +241,17 @@ dev_uev_handler(__rte_unused void *param)
ret = recv(rte_intr_fd_get(intr_handle), buf, EAL_UEV_MSG_LEN,
MSG_DONTWAIT);
- if (ret < 0 && errno == EAGAIN)
- return;
- else if (ret <= 0) {
- /* connection is closed or broken, can not up again. */
- EAL_LOG(ERR, "uevent socket connection is broken.");
+ if (ret <= 0) {
+ if (ret < 0) {
+ /* non blocking or interrupted */
+ if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR)
+ return;
+ EAL_ERR(ERR, "unexpected error on uevent: %s",
+ strerror(errno));
+ } else {
+ /* zero length recv is end of file */
+ EAL_LOG(ERR, "uevent socket connection is broken.");
+ }
rte_eal_alarm_set(1, dev_delayed_unregister, NULL);
return;
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-08-13 22:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-13 20:16 [PATCH] eal/linux: harden uevent recv error handling Randy Tice
2026-08-13 22:57 ` Stephen Hemminger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox