* 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
2026-08-17 18:53 ` [PATCH v2] " Randy Tice
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ 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] 5+ messages in thread* [PATCH v2] 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
@ 2026-08-17 18:53 ` Randy Tice
2026-08-17 19:23 ` [PATCH v3] " Randy Tice
2026-08-17 20:16 ` [PATCH v4] " Randy Tice
3 siblings, 0 replies; 5+ messages in thread
From: Randy Tice @ 2026-08-17 18:53 UTC (permalink / raw)
To: dev; +Cc: Randy Tice
The Linux uevent handler is harded for non-blocking receive behavior
and transient ENOBUF issue during hot plug/unplug testing with MANA.
Signed-off-by: Randy Tice <rtice@cisco.com>
---
v2:
Addressed review comments regarding spelling and missing code comments.
Limited the transient memory issue to just ENOBUF which was the only
original error observed.
---
lib/eal/linux/eal_dev.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/lib/eal/linux/eal_dev.c b/lib/eal/linux/eal_dev.c
index ec408649d0..f1d2bc3d34 100644
--- a/lib/eal/linux/eal_dev.c
+++ b/lib/eal/linux/eal_dev.c
@@ -241,9 +241,16 @@ 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 || EINTR)) {
+ /* non-blocking or interrupted */
return;
- else if (ret <= 0) {
+ } else if (ret < 0 && (errno == ENOBUFS)) {
+ /* non-fatal transient memory condition */
+ EAL_LOG(ERR, "unexpected error on uevent recv: %s",
+ strerror(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] 5+ messages in thread* [PATCH v3] 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
2026-08-17 18:53 ` [PATCH v2] " Randy Tice
@ 2026-08-17 19:23 ` Randy Tice
2026-08-17 20:16 ` [PATCH v4] " Randy Tice
3 siblings, 0 replies; 5+ messages in thread
From: Randy Tice @ 2026-08-17 19:23 UTC (permalink / raw)
To: dev; +Cc: Randy Tice
The Linux uevent handler is harded for non-blocking receive behavior
and transient ENOBUF issue during hot plug/unplug testing with MANA.
Signed-off-by: Randy Tice <rtice@cisco.com>
---
v3:
Fixed build issue with bitwise operator vs test against errno.
v2:
Addressed review comments regarding spelling and missing code comments.
Limited the transient memory issue to just ENOBUF which was the only
original error observed.
---
lib/eal/linux/eal_dev.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/lib/eal/linux/eal_dev.c b/lib/eal/linux/eal_dev.c
index ec408649d0..f1d2bc3d34 100644
--- a/lib/eal/linux/eal_dev.c
+++ b/lib/eal/linux/eal_dev.c
@@ -241,9 +241,16 @@ 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 || EINTR)) {
+ /* non-blocking or interrupted */
return;
- else if (ret <= 0) {
+ } else if (ret < 0 && (errno == ENOBUFS)) {
+ /* non-fatal transient memory condition */
+ EAL_LOG(ERR, "unexpected error on uevent recv: %s",
+ strerror(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] 5+ messages in thread* [PATCH v4] eal/linux: harden uevent recv error handling
2026-08-13 20:16 [PATCH] eal/linux: harden uevent recv error handling Randy Tice
` (2 preceding siblings ...)
2026-08-17 19:23 ` [PATCH v3] " Randy Tice
@ 2026-08-17 20:16 ` Randy Tice
3 siblings, 0 replies; 5+ messages in thread
From: Randy Tice @ 2026-08-17 20:16 UTC (permalink / raw)
To: dev; +Cc: Randy Tice
The Linux uevent handler is harded for non-blocking receive behavior
and transient ENOBUF issue during hot plug/unplug testing with MANA.
Signed-off-by: Randy Tice <rtice@cisco.com>
---
v4:
Wrong patch submitted
v3:
Fixed build issue with bitwise operator vs test against errno.
v2:
Addressed review comments regarding spelling and missing code comments.
Limited the transient memory issue to just ENOBUF which was the only
original error observed.
---
lib/eal/linux/eal_dev.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/lib/eal/linux/eal_dev.c b/lib/eal/linux/eal_dev.c
index ec408649d0..5b3e9dea9f 100644
--- a/lib/eal/linux/eal_dev.c
+++ b/lib/eal/linux/eal_dev.c
@@ -241,9 +241,16 @@ 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 || errno == EINTR)) {
+ /* non-blocking or interrupted */
return;
- else if (ret <= 0) {
+ } else if (ret < 0 && (errno == ENOBUFS)) {
+ /* non-fatal transient memory condition */
+ EAL_LOG(ERR, "unexpected error on uevent recv: %s",
+ strerror(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] 5+ messages in thread