Skip to contentSkip to conversation

dev: fix hotplug notification to secondary

PATCH Superseded David Marchand 2 participants 5 messages Jul 6 – Jul 8 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dev: fix hotplug notification to secondary

There was a logical error when making some last minute change. Fix the no_shconf evaluation.

Besides, we currently have no unit test checking device hotplug in the fast-tests testsuite.
Instead, we rely on rcX tags validations when non regression tests relying on the multiprocess examples are run.

Add some basic unit test that does not cover all that the examples do yet provide a first gate on multiprocess changes.

Bugzilla ID: 1963

Fixes 1a2e26d8701d ("dev: skip multi-process in hotplug")
---
 MAINTAINERS                     |   1 +
 app/test/meson.build            |   1 +
 app/test/test.c                 |   1 +
 app/test/test.h                 |   1 +
 app/test/test_dev_hotplug.c     | 320 ++++++++++++++++++++++++++++++++
 lib/eal/common/eal_common_dev.c |   4 +-
 6 files changed, 326 insertions(+), 2 deletions(-)
 create mode 100644 app/test/test_dev_hotplug.c
MAINTAINERS +1 -0
index 84c528437f..0d77d9f1e6 100644
@@ -177,6 +177,7 @@ F: app/test/test_common.c
 F: app/test/test_cpuflags.c
 F: app/test/test_cycles.c
 F: app/test/test_debug.c
+F: app/test/test_dev_hotplug.c
 F: app/test/test_devargs.c
 F: app/test/test_eal*
 F: app/test/test_errno.c
app/test/meson.build +1 -0
index 51abeeb732..4047a14586 100644
@@ -61,6 +61,7 @@ source_file_deps = {
     'test_cryptodev_security_tls_record.c': ['cryptodev', 'security'],
     'test_cycles.c': [],
     'test_debug.c': [],
+    'test_dev_hotplug.c': ['net_null'],
     'test_devargs.c': ['kvargs'],
     'test_dispatcher.c': ['dispatcher'],
     'test_distributor.c': ['distributor'],
app/test/test.c +1 -0
index c610c3588e..597f256128 100644
@@ -62,6 +62,7 @@ do_recursive_call(void)
 	} actions[] =  {
 #ifndef RTE_EXEC_ENV_WINDOWS
 			{ "run_secondary_instances", test_mp_secondary },
+			{ "run_hotplug_secondary", test_dev_hotplug_mp },
 #endif
 #ifdef RTE_LIB_PDUMP
 #ifdef RTE_NET_RING
app/test/test.h +1 -0
index b29233bb32..78f42d6177 100644
@@ -216,6 +216,7 @@ int commands_init(void);
 int command_valid(const char *cmd);
 
 int test_exit(void);
+int test_dev_hotplug_mp(void);
 int test_mp_secondary(void);
 int test_panic(void);
 int test_timer_secondary(void);
app/test/test_dev_hotplug.c new file +320 -0

320 lines not on this page · raw message

lib/eal/common/eal_common_dev.c +2 -2
index 9ed62a20e0..b43b0a4bb3 100644
@@ -269,7 +269,7 @@ rte_dev_probe(const char *devargs)
 {
 	const struct internal_config *internal_conf =
 		eal_get_internal_configuration();
-	bool do_mp = !!internal_conf->no_shconf;
+	bool do_mp = internal_conf->no_shconf == 0;
 	struct eal_dev_mp_req req;
 	struct rte_device *dev;
 	int ret;
@@ -428,7 +428,7 @@ rte_dev_remove(struct rte_device *dev)
 {
 	const struct internal_config *internal_conf =
 		eal_get_internal_configuration();
-	bool do_mp = !!internal_conf->no_shconf;
+	bool do_mp = internal_conf->no_shconf == 0;
 	struct eal_dev_mp_req req;
 	char *devargs;
 	int ret;
Signature · 1 line
2.54.0
#1 lore raw
Quoted 9 lines · David Marchand

There was a logical error when making some last minute change. Fix the no_shconf evaluation.

Besides, we currently have no unit test checking device hotplug in the fast-tests testsuite.
Instead, we rely on rcX tags validations when non regression tests relying on the multiprocess examples are run.

Quoted 7 lines

Add some basic unit test that does not cover all that the examples do yet provide a first gate on multiprocess changes.

Bugzilla ID: 1963

Fixes 1a2e26d8701d ("dev: skip multi-process in hotplug")

There are some issues with the added test.

The new test is failing on LoongArch CI.
LoongArch CI seems to have a list of excluded tests, and it excludes multiprocess related tests.
So I guess I'll need LoongArch people to update their tests.

I also have a build issue when disabling net/null.

The AI bot also pointed out some leak in the test exit/error paths.

So I'll send a v2, but I'll separate the EAL fix from the unit test so that I can merge the fix quickly.

Signature · 1 line
David Marchand
#2 lore raw

PATCH v2 1/1 dev: fix hotplug notification to secondary

In reply to David Marchand

There was a logical error when making some last minute change. Fix the no_shconf evaluation.

Bugzilla ID: 1963

Fixes 1a2e26d8701d ("dev: skip multi-process in hotplug")

---
Changes since v1:
- separated the unit test from the fix,

---
 lib/eal/common/eal_common_dev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lib/eal/common/eal_common_dev.c +2 -2
index 9ed62a20e0..b43b0a4bb3 100644
@@ -269,7 +269,7 @@ rte_dev_probe(const char *devargs)
 {
 	const struct internal_config *internal_conf =
 		eal_get_internal_configuration();
-	bool do_mp = !!internal_conf->no_shconf;
+	bool do_mp = internal_conf->no_shconf == 0;
 	struct eal_dev_mp_req req;
 	struct rte_device *dev;
 	int ret;
@@ -428,7 +428,7 @@ rte_dev_remove(struct rte_device *dev)
 {
 	const struct internal_config *internal_conf =
 		eal_get_internal_configuration();
-	bool do_mp = !!internal_conf->no_shconf;
+	bool do_mp = internal_conf->no_shconf == 0;
 	struct eal_dev_mp_req req;
 	char *devargs;
 	int ret;
Signature · 1 line
2.54.0
Reviewed-by on v2 1/1
#3 lore raw
Quoted 37 lines · David Marchand

There was a logical error when making some last minute change. Fix the no_shconf evaluation.

Bugzilla ID: 1963

Fixes 1a2e26d8701d ("dev: skip multi-process in hotplug")

---
Changes since v1:
- separated the unit test from the fix,

---
 lib/eal/common/eal_common_dev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lib/eal/common/eal_common_dev.c +2 -2
index 9ed62a20e0..b43b0a4bb3 100644
@@ -269,7 +269,7 @@ rte_dev_probe(const char *devargs)
 {
 	const struct internal_config *internal_conf =
 		eal_get_internal_configuration();
-	bool do_mp = !!internal_conf->no_shconf;
+	bool do_mp = internal_conf->no_shconf == 0;
 	struct eal_dev_mp_req req;
 	struct rte_device *dev;
 	int ret;
@@ -428,7 +428,7 @@ rte_dev_remove(struct rte_device *dev)
 {
 	const struct internal_config *internal_conf =
 		eal_get_internal_configuration();
-	bool do_mp = !!internal_conf->no_shconf;
+	bool do_mp = internal_conf->no_shconf == 0;
 	struct eal_dev_mp_req req;
 	char *devargs;
 	int ret;