patch 'dev: fix callback lookup when unregistering device' has been queued to stable release 21.11.9

Kevin Traynor ktraynor at redhat.com
Wed Nov 27 18:17:13 CET 2024


Hi,

FYI, your patch has been queued to stable release 21.11.9

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 12/02/24. So please
shout if anyone has objections.

Also note that after the patch there's a diff of the upstream commit vs the
patch applied to the branch. This will indicate if there was any rebasing
needed to apply to the stable branch. If there were code changes for rebasing
(ie: not only metadata diffs), please double check that the rebase was
correctly done.

Queued patches are on a temporary branch at:
https://github.com/kevintraynor/dpdk-stable

This queued commit can be viewed at:
https://github.com/kevintraynor/dpdk-stable/commit/525bfcf6b4664eb6f7bee6935f679ec57d9ec804

Thanks.

Kevin

---
>From 525bfcf6b4664eb6f7bee6935f679ec57d9ec804 Mon Sep 17 00:00:00 2001
From: Malcolm Bumgardner <mbumgard at cisco.com>
Date: Thu, 18 Jul 2024 12:37:28 -0700
Subject: [PATCH] dev: fix callback lookup when unregistering device

[ upstream commit 66fd2cc2e47c69ee57f0fe32558e55b085c2e32d ]

In the device event unregister code, it unconditionally removes all
callbacks which are registered with device_name set to NULL.
This results in many callbacks incorrectly removed.

Fix this by only removing callbacks with matching cb_fn and cb_arg.

Fixes: a753e53d517b ("eal: add device event monitor framework")

Signed-off-by: Malcolm Bumgardner <mbumgard at cisco.com>
Signed-off-by: Long Li <longli at microsoft.com>
Reviewed-by: Stephen Hemminger <stephen at networkplumber.org>
---
 .mailmap                        |  1 +
 lib/eal/common/eal_common_dev.c | 13 +++++++------
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/.mailmap b/.mailmap
index d1b9f266b5..39f81c0e7d 100644
--- a/.mailmap
+++ b/.mailmap
@@ -823,4 +823,5 @@ Mahipal Challa <mchalla at marvell.com>
 Mah Yock Gen <yock.gen.mah at intel.com>
 Mairtin o Loingsigh <mairtin.oloingsigh at intel.com>
+Malcolm Bumgardner <mbumgard at cisco.com>
 Mallesham Jatharakonda <mjatharakonda at oneconvergence.com>
 Mallesh Koujalagi <malleshx.koujalagi at intel.com>
diff --git a/lib/eal/common/eal_common_dev.c b/lib/eal/common/eal_common_dev.c
index 07f285f862..80d6396462 100644
--- a/lib/eal/common/eal_common_dev.c
+++ b/lib/eal/common/eal_common_dev.c
@@ -513,14 +513,15 @@ rte_dev_event_callback_unregister(const char *device_name,
 
 		if (device_name != NULL && event_cb->dev_name != NULL) {
-			if (!strcmp(event_cb->dev_name, device_name)) {
-				if (event_cb->cb_fn != cb_fn ||
-				    (cb_arg != (void *)-1 &&
-				    event_cb->cb_arg != cb_arg))
-					continue;
-			}
+			if (strcmp(event_cb->dev_name, device_name))
+				continue;
 		} else if (device_name != NULL) {
 			continue;
 		}
 
+		/* Remove only matching callback with arg */
+		if (event_cb->cb_fn != cb_fn ||
+		    (cb_arg != (void *)-1 && event_cb->cb_arg != cb_arg))
+			continue;
+
 		/*
 		 * if this callback is not executing right now,
-- 
2.47.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2024-11-27 17:17:38.534977001 +0000
+++ 0006-dev-fix-callback-lookup-when-unregistering-device.patch	2024-11-27 17:17:38.158269026 +0000
@@ -1 +1 @@
-From 66fd2cc2e47c69ee57f0fe32558e55b085c2e32d Mon Sep 17 00:00:00 2001
+From 525bfcf6b4664eb6f7bee6935f679ec57d9ec804 Mon Sep 17 00:00:00 2001
@@ -5,0 +6,2 @@
+[ upstream commit 66fd2cc2e47c69ee57f0fe32558e55b085c2e32d ]
+
@@ -13 +14,0 @@
-Cc: stable at dpdk.org
@@ -24 +25 @@
-index a66da3c8cb..8004772125 100644
+index d1b9f266b5..39f81c0e7d 100644
@@ -27 +28 @@
-@@ -887,4 +887,5 @@ Mahmoud Maatuq <mahmoudmatook.mm at gmail.com>
+@@ -823,4 +823,5 @@ Mahipal Challa <mchalla at marvell.com>
@@ -34 +35 @@
-index a99252b02f..70aa04dcd9 100644
+index 07f285f862..80d6396462 100644
@@ -37 +38 @@
-@@ -551,14 +551,15 @@ rte_dev_event_callback_unregister(const char *device_name,
+@@ -513,14 +513,15 @@ rte_dev_event_callback_unregister(const char *device_name,



More information about the stable mailing list