Skip to contentSkip to conversation

common/mlx5: fix error handling in multi-class probe

PATCH In review [email protected] 4 participants 4 messages Nov 24, 2021 – Jan 6, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 common/mlx5: fix error handling in multi-class probe

From: Michael Baum <[email protected]>

The common drivers_probe function calls in a loop to all probe functions for classes requested by the user. After it manages to probe them all, it updates this on the device in the "classes_loaded" field.

If one of them fails, all those probed to it are remove using the drivers_remove function. However, this function only releases the classes in the "classes_loaded" field on the given device and misses the newly probed classes.

This patch removes the condition from the release function, and ensures that the caller function sends a more accurate parameter.

Fixes 8a41f4deccc3 ("common/mlx5: introduce layer for multiple class drivers")
---
 drivers/common/mlx5/mlx5_common.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/common/mlx5/mlx5_common.c +4 -3
index f1650f94c6..faa3d65ab3 100644
@@ -616,7 +616,6 @@ drivers_remove(struct mlx5_common_device *cdev, uint32_t enabled_classes)
 	unsigned int i = 0;
 	int ret = 0;
 
-	enabled_classes &= cdev->classes_loaded;
 	while (enabled_classes) {
 		driver = driver_get(RTE_BIT64(i));
 		if (driver != NULL) {
@@ -665,9 +664,11 @@ drivers_probe(struct mlx5_common_device *cdev, uint32_t user_classes)
 	cdev->classes_loaded |= enabled_classes;
 	return 0;
 probe_err:
-	/* Only unload drivers which are enabled which were enabled
-	 * in this probe instance.
+	/*
+	 * Need to remove only drivers which were not probed before this probe
+	 * instance, but have already been probed before this failure.
 	 */
+	enabled_classes &= ~cdev->classes_loaded;
 	drivers_remove(cdev, enabled_classes);
 	return ret;
 }
Signature · 1 line
2.25.1
#1 lore raw

24/11/2021 23:02, [email protected]:

Quoted 11 lines

From: Michael Baum <[email protected]>

The common drivers_probe function calls in a loop to all probe functions for classes requested by the user. After it manages to probe them all, it updates this on the device in the "classes_loaded" field.

If one of them fails, all those probed to it are remove using the drivers_remove function. However, this function only releases the classes in the "classes_loaded" field on the given device and misses the newly probed classes.

Quoted 8 lines

This patch removes the condition from the release function, and ensures that the caller function sends a more accurate parameter.

Fixes 8a41f4deccc3 ("common/mlx5: introduce layer for multiple class drivers")

How well it has been tested?
How critical it is to have in 21.11?

#2 lore raw

From: Thomas Monjalon

Quoted 15 lines

24/11/2021 23:02, [email protected]:

Quoted 14 lines

From: Michael Baum <[email protected]>

The common drivers_probe function calls in a loop to all probe functions for classes requested by the user. After it manages to probe them all, it updates this on the device in the "classes_loaded" field.

If one of them fails, all those probed to it are remove using the drivers_remove function. However, this function only releases the classes in the "classes_loaded" field on the given device and misses the newly probed classes.

This patch removes the condition from the release function, and ensures that the caller function sends a more accurate parameter.

Quoted 8 lines
Quoted 6 lines
Fixes 8a41f4deccc3 ("common/mlx5: introduce layer for multiple class

drivers")
Cc: [email protected]

How well it has been tested?

It was tested carefully for all the remove cases.

Quoted 1 line

How critical it is to have in 21.11?

It is error flow issue, not critical.

Quoted 1 line
#3 lore raw
In reply to [email protected]

Hi,

Quoted 23 lines

-----Original Message-----
From: Michael Baum <[email protected]>
Sent: Thursday, November 25, 2021 12:03 AM
To: [email protected]
Cc: Matan Azrad <[email protected]>; Raslan Darawsheh <[email protected]>; Slava Ovsiienko <[email protected]>; Michael Baum <[email protected]>; [email protected]
Subject: [PATCH] common/mlx5: fix error handling in multi-class probe

From: Michael Baum <[email protected]>

The common drivers_probe function calls in a loop to all probe functions for classes requested by the user. After it manages to probe them all, it updates this on the device in the "classes_loaded" field.

If one of them fails, all those probed to it are remove using the drivers_remove function. However, this function only releases the classes in the "classes_loaded" field on the given device and misses the newly probed classes.

This patch removes the condition from the release function, and ensures that the caller function sends a more accurate parameter.

Quoted 6 lines
Fixes 8a41f4deccc3 ("common/mlx5: introduce layer for multiple class

drivers")
Cc: [email protected]

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh