Skip to contentSkip to conversation

Revert "mlxsw: core: Use different get_trend() callbacks for different thermal zones"

PATCH Superseded Daniel Lezcano 3 participants 8 messages Aug 1, 2022 – Aug 14, 2022

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Revert "mlxsw: core: Use different get_trend() callbacks for different thermal zones"

This reverts commit 2dc2f760052da4925482ecdcdc5c94d4a599153c.

As discussed in the thread:

https://lore.kernel.org/all/[email protected]/

the feature provided by commits 2dc2f760052da and 6f73862fabd93 is actually already handled by the thermal framework via the cooling device state aggregation, thus all this code is pointless.

No conflict happened when reverting the patch.

---
 .../ethernet/mellanox/mlxsw/core_thermal.c    | 23 ++++---------------
 1 file changed, 4 insertions(+), 19 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/core_thermal.c +4 -19
index 05f54bd982c0..f5751242653b 100644
@@ -345,7 +345,8 @@ static int mlxsw_thermal_set_trip_hyst(struct thermal_zone_device *tzdev,
 static int mlxsw_thermal_trend_get(struct thermal_zone_device *tzdev,
 				   int trip, enum thermal_trend *trend)
 {
-	struct mlxsw_thermal *thermal = tzdev->devdata;
+	struct mlxsw_thermal_module *tz = tzdev->devdata;
+	struct mlxsw_thermal *thermal = tz->parent;
 
 	if (trip < 0 || trip >= MLXSW_THERMAL_NUM_TRIPS)
 		return -EINVAL;
@@ -537,22 +538,6 @@ mlxsw_thermal_module_trip_hyst_set(struct thermal_zone_device *tzdev, int trip,
 	return 0;
 }
 
-static int mlxsw_thermal_module_trend_get(struct thermal_zone_device *tzdev,
-					  int trip, enum thermal_trend *trend)
-{
-	struct mlxsw_thermal_module *tz = tzdev->devdata;
-	struct mlxsw_thermal *thermal = tz->parent;
-
-	if (trip < 0 || trip >= MLXSW_THERMAL_NUM_TRIPS)
-		return -EINVAL;
-
-	if (tzdev == thermal->tz_highest_dev)
-		return 1;
-
-	*trend = THERMAL_TREND_STABLE;
-	return 0;
-}
-
 static struct thermal_zone_device_ops mlxsw_thermal_module_ops = {
 	.bind		= mlxsw_thermal_module_bind,
 	.unbind		= mlxsw_thermal_module_unbind,
@@ -562,7 +547,7 @@ static struct thermal_zone_device_ops mlxsw_thermal_module_ops = {
 	.set_trip_temp	= mlxsw_thermal_module_trip_temp_set,
 	.get_trip_hyst	= mlxsw_thermal_module_trip_hyst_get,
 	.set_trip_hyst	= mlxsw_thermal_module_trip_hyst_set,
-	.get_trend	= mlxsw_thermal_module_trend_get,
+	.get_trend	= mlxsw_thermal_trend_get,
 };
 
 static int mlxsw_thermal_gearbox_temp_get(struct thermal_zone_device *tzdev,
@@ -599,7 +584,7 @@ static struct thermal_zone_device_ops mlxsw_thermal_gearbox_ops = {
 	.set_trip_temp	= mlxsw_thermal_module_trip_temp_set,
 	.get_trip_hyst	= mlxsw_thermal_module_trip_hyst_get,
 	.set_trip_hyst	= mlxsw_thermal_module_trip_hyst_set,
-	.get_trend	= mlxsw_thermal_module_trend_get,
+	.get_trend	= mlxsw_thermal_trend_get,
 };
 
 static int mlxsw_thermal_get_max_state(struct thermal_cooling_device *cdev,
Signature · 1 line
2.25.1
#1 lore raw

PATCH 2/2 Revert "mlxsw: core: Add the hottest thermal zone detection"

This reverts commit 6f73862fabd93213de157d9cc6ef76084311c628.

As discussed in the thread:

https://lore.kernel.org/all/[email protected]/

the feature provided by commits 2dc2f760052da and 6f73862fabd93 is actually already handled by the thermal framework via the cooling device state aggregation, thus all this code is pointless.

The revert conflicts with the following changes:
- 7f4957be0d5b8: thermal: Use mode helpers in drivers
- 6a79507cfe94c: mlxsw: core: Extend thermal module with per QSFP module thermal zones

These conflicts were fixed and the resulting changes are in this patch.

---
 .../ethernet/mellanox/mlxsw/core_thermal.c    | 59 +------------------
 1 file changed, 2 insertions(+), 57 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/core_thermal.c +2 -57
index f5751242653b..373a77c3da02 100644
@@ -22,7 +22,6 @@
 #define MLXSW_THERMAL_HYSTERESIS_TEMP	5000	/* 5C */
 #define MLXSW_THERMAL_MODULE_TEMP_SHIFT	(MLXSW_THERMAL_HYSTERESIS_TEMP * 2)
 #define MLXSW_THERMAL_ZONE_MAX_NAME	16
-#define MLXSW_THERMAL_TEMP_SCORE_MAX	GENMASK(31, 0)
 #define MLXSW_THERMAL_MAX_STATE	10
 #define MLXSW_THERMAL_MIN_STATE	2
 #define MLXSW_THERMAL_MAX_DUTY	255
@@ -96,8 +95,6 @@ struct mlxsw_thermal {
 	u8 tz_module_num;
 	struct mlxsw_thermal_module *tz_gearbox_arr;
 	u8 tz_gearbox_num;
-	unsigned int tz_highest_score;
-	struct thermal_zone_device *tz_highest_dev;
 };
 
 static inline u8 mlxsw_state_to_duty(int state)
@@ -186,34 +183,6 @@ mlxsw_thermal_module_trips_update(struct device *dev, struct mlxsw_core *core,
 	return 0;
 }
 
-static void mlxsw_thermal_tz_score_update(struct mlxsw_thermal *thermal,
-					  struct thermal_zone_device *tzdev,
-					  struct mlxsw_thermal_trip *trips,
-					  int temp)
-{
-	struct mlxsw_thermal_trip *trip = trips;
-	unsigned int score, delta, i, shift = 1;
-
-	/* Calculate thermal zone score, if temperature is above the hot
-	 * threshold score is set to MLXSW_THERMAL_TEMP_SCORE_MAX.
-	 */
-	score = MLXSW_THERMAL_TEMP_SCORE_MAX;
-	for (i = MLXSW_THERMAL_TEMP_TRIP_NORM; i < MLXSW_THERMAL_NUM_TRIPS;
-	     i++, trip++) {
-		if (temp < trip->temp) {
-			delta = DIV_ROUND_CLOSEST(temp, trip->temp - temp);
-			score = delta * shift;
-			break;
-		}
-		shift *= 256;
-	}
-
-	if (score > thermal->tz_highest_score) {
-		thermal->tz_highest_score = score;
-		thermal->tz_highest_dev = tzdev;
-	}
-}
-
 static int mlxsw_thermal_bind(struct thermal_zone_device *tzdev,
 			      struct thermal_cooling_device *cdev)
 {
@@ -278,10 +247,8 @@ static int mlxsw_thermal_get_temp(struct thermal_zone_device *tzdev,
 		dev_err(dev, "Failed to query temp sensor\n");
 		return err;
 	}
+
 	mlxsw_reg_mtmp_unpack(mtmp_pl, &temp, NULL, NULL, NULL, NULL);
-	if (temp > 0)
-		mlxsw_thermal_tz_score_update(thermal, tzdev, thermal->trips,
-					      temp);
 
 	*p_temp = temp;
 	return 0;
@@ -342,22 +309,6 @@ static int mlxsw_thermal_set_trip_hyst(struct thermal_zone_device *tzdev,
 	return 0;
 }
 
-static int mlxsw_thermal_trend_get(struct thermal_zone_device *tzdev,
-				   int trip, enum thermal_trend *trend)
-{
-	struct mlxsw_thermal_module *tz = tzdev->devdata;
-	struct mlxsw_thermal *thermal = tz->parent;
-
-	if (trip < 0 || trip >= MLXSW_THERMAL_NUM_TRIPS)
-		return -EINVAL;
-
-	if (tzdev == thermal->tz_highest_dev)
-		return 1;
-
-	*trend = THERMAL_TREND_STABLE;
-	return 0;
-}
-
 static struct thermal_zone_params mlxsw_thermal_params = {
 	.no_hwmon = true,
 };
@@ -371,7 +322,6 @@ static struct thermal_zone_device_ops mlxsw_thermal_ops = {
 	.set_trip_temp	= mlxsw_thermal_set_trip_temp,
 	.get_trip_hyst	= mlxsw_thermal_get_trip_hyst,
 	.set_trip_hyst	= mlxsw_thermal_set_trip_hyst,
-	.get_trend	= mlxsw_thermal_trend_get,
 };
 
 static int mlxsw_thermal_module_bind(struct thermal_zone_device *tzdev,
@@ -473,8 +423,6 @@ static int mlxsw_thermal_module_temp_get(struct thermal_zone_device *tzdev,
 	/* Update trip points. */
 	err = mlxsw_thermal_module_trips_update(dev, thermal->core, tz,
 						crit_temp, emerg_temp);
-	if (!err && temp > 0)
-		mlxsw_thermal_tz_score_update(thermal, tzdev, tz->trips, temp);
 
 	return 0;
 }
@@ -547,7 +495,6 @@ static struct thermal_zone_device_ops mlxsw_thermal_module_ops = {
 	.set_trip_temp	= mlxsw_thermal_module_trip_temp_set,
 	.get_trip_hyst	= mlxsw_thermal_module_trip_hyst_get,
 	.set_trip_hyst	= mlxsw_thermal_module_trip_hyst_set,
-	.get_trend	= mlxsw_thermal_trend_get,
 };
 
 static int mlxsw_thermal_gearbox_temp_get(struct thermal_zone_device *tzdev,
@@ -568,8 +515,6 @@ static int mlxsw_thermal_gearbox_temp_get(struct thermal_zone_device *tzdev,
 		return err;
 
 	mlxsw_reg_mtmp_unpack(mtmp_pl, &temp, NULL, NULL, NULL, NULL);
-	if (temp > 0)
-		mlxsw_thermal_tz_score_update(thermal, tzdev, tz->trips, temp);
 
 	*p_temp = temp;
 	return 0;
@@ -584,7 +529,6 @@ static struct thermal_zone_device_ops mlxsw_thermal_gearbox_ops = {
 	.set_trip_temp	= mlxsw_thermal_module_trip_temp_set,
 	.get_trip_hyst	= mlxsw_thermal_module_trip_hyst_get,
 	.set_trip_hyst	= mlxsw_thermal_module_trip_hyst_set,
-	.get_trend	= mlxsw_thermal_trend_get,
 };
 
 static int mlxsw_thermal_get_max_state(struct thermal_cooling_device *cdev,
@@ -667,6 +611,7 @@ mlxsw_thermal_module_tz_init(struct mlxsw_thermal_module *module_tz)
 							MLXSW_THERMAL_TRIP_MASK,
 							module_tz,
 							&mlxsw_thermal_module_ops,
+
 							&mlxsw_thermal_params,
 							0,
 							module_tz->parent->polling_delay);
Signature · 1 line
2.25.1
Tested-by on v1 2/2
#2 lore raw

RE: [PATCH 2/2] Revert "mlxsw: core: Add the hottest thermal zone detection"

Quoted 25 lines

-----Original Message-----
From: Daniel Lezcano <[email protected]>
Sent: Monday, August 1, 2022 12:56 PM
To: [email protected]; [email protected]
Cc: Vadim Pasternak <[email protected]>; [email protected]; [email protected]; [email protected]; Ido Schimmel <[email protected]>; Petr Machata <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>
Subject: [PATCH 2/2] Revert "mlxsw: core: Add the hottest thermal zone detection"

This reverts commit 6f73862fabd93213de157d9cc6ef76084311c628.

As discussed in the thread:

https://lore.kernel.org/all/f3c62ebe-7d59-c537-a010-
[email protected]/

the feature provided by commits 2dc2f760052da and 6f73862fabd93 is actually already handled by the thermal framework via the cooling device state aggregation, thus all this code is pointless.

Quoted 8 lines

The revert conflicts with the following changes:
- 7f4957be0d5b8: thermal: Use mode helpers in drivers
- 6a79507cfe94c: mlxsw: core: Extend thermal module with per QSFP module
thermal zones

These conflicts were fixed and the resulting changes are in this patch.

Daniel,
Could you, please, re-base the patch on top of net-next as Jakub mentioned? Or do you want me to do it?

There is also redundant blank line in this patch:
&mlxsw_thermal_module_ops,
+
&mlxsw_thermal_params,

Quoted 169 lines
---
 .../ethernet/mellanox/mlxsw/core_thermal.c    | 59 +------------------
 1 file changed, 2 insertions(+), 57 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/core_thermal.c +0 -1
index f5751242653b..373a77c3da02 100644
@@ -22,7 +22,6 @@
 #define MLXSW_THERMAL_HYSTERESIS_TEMP	5000	/* 5C */
 #define MLXSW_THERMAL_MODULE_TEMP_SHIFT
 	(MLXSW_THERMAL_HYSTERESIS_TEMP * 2)
 #define MLXSW_THERMAL_ZONE_MAX_NAME	16
-#define MLXSW_THERMAL_TEMP_SCORE_MAX	GENMASK(31, 0)
 #define MLXSW_THERMAL_MAX_STATE	10
 #define MLXSW_THERMAL_MIN_STATE	2

#define MLXSW_THERMAL_MAX_DUTY 255

drivers/net/ethernet/mellanox/mlxsw/core_thermal.c +0 -2
@@ -96,8 +95,6 @@ struct mlxsw_thermal {
 	u8 tz_module_num;
 	struct mlxsw_thermal_module *tz_gearbox_arr;
 	u8 tz_gearbox_num;
-	unsigned int tz_highest_score;
-	struct thermal_zone_device *tz_highest_dev;
 };
 
 static inline u8 mlxsw_state_to_duty(int state) @@ -186,34 +183,6 @@

mlxsw_thermal_module_trips_update(struct device *dev, struct mlxsw_core *core,

drivers/net/ethernet/mellanox/mlxsw/core_thermal.c +0 -1
 	return 0;
 }
 
-static void mlxsw_thermal_tz_score_update(struct mlxsw_thermal

*thermal,

drivers/net/ethernet/mellanox/mlxsw/core_thermal.c +0 -12
-					  struct thermal_zone_device *tzdev,
-					  struct mlxsw_thermal_trip *trips,
-					  int temp)
-{
-	struct mlxsw_thermal_trip *trip = trips;
-	unsigned int score, delta, i, shift = 1;
-
-	/* Calculate thermal zone score, if temperature is above the hot
-	 * threshold score is set to MLXSW_THERMAL_TEMP_SCORE_MAX.
-	 */
-	score = MLXSW_THERMAL_TEMP_SCORE_MAX;
-	for (i = MLXSW_THERMAL_TEMP_TRIP_NORM; i <

MLXSW_THERMAL_NUM_TRIPS;

drivers/net/ethernet/mellanox/mlxsw/core_thermal.c +0 -3
-	     i++, trip++) {
-		if (temp < trip->temp) {
-			delta = DIV_ROUND_CLOSEST(temp, trip->temp -

temp);

drivers/net/ethernet/mellanox/mlxsw/core_thermal.c +0 -12
-			score = delta * shift;
-			break;
-		}
-		shift *= 256;
-	}
-
-	if (score > thermal->tz_highest_score) {
-		thermal->tz_highest_score = score;
-		thermal->tz_highest_dev = tzdev;
-	}
-}
-
 static int mlxsw_thermal_bind(struct thermal_zone_device *tzdev,
 			      struct thermal_cooling_device *cdev)  { @@ -

278,10 +247,8 @@ static int mlxsw_thermal_get_temp(struct thermal_zone_device *tzdev,

drivers/net/ethernet/mellanox/mlxsw/core_thermal.c +1 -0
 		dev_err(dev, "Failed to query temp sensor\n");
 		return err;
 	}
+
 	mlxsw_reg_mtmp_unpack(mtmp_pl, &temp, NULL, NULL, NULL,

NULL);

drivers/net/ethernet/mellanox/mlxsw/core_thermal.c +0 -2
-	if (temp > 0)
-		mlxsw_thermal_tz_score_update(thermal, tzdev, thermal-
Quoted 1 line

trips,

drivers/net/ethernet/mellanox/mlxsw/core_thermal.c +0 -17
-					      temp);
 
 	*p_temp = temp;
 	return 0;
@@ -342,22 +309,6 @@ static int mlxsw_thermal_set_trip_hyst(struct
 thermal_zone_device *tzdev,
 	return 0;
 }
 
-static int mlxsw_thermal_trend_get(struct thermal_zone_device *tzdev,
-				   int trip, enum thermal_trend *trend)
-{
-	struct mlxsw_thermal_module *tz = tzdev->devdata;
-	struct mlxsw_thermal *thermal = tz->parent;
-
-	if (trip < 0 || trip >= MLXSW_THERMAL_NUM_TRIPS)
-		return -EINVAL;
-
-	if (tzdev == thermal->tz_highest_dev)
-		return 1;
-
-	*trend = THERMAL_TREND_STABLE;
-	return 0;
-}
-
 static struct thermal_zone_params mlxsw_thermal_params = {
 	.no_hwmon = true,

};

drivers/net/ethernet/mellanox/mlxsw/core_thermal.c +0 -1
@@ -371,7 +322,6 @@ static struct thermal_zone_device_ops
 mlxsw_thermal_ops = {
 	.set_trip_temp	= mlxsw_thermal_set_trip_temp,
 	.get_trip_hyst	= mlxsw_thermal_get_trip_hyst,
 	.set_trip_hyst	= mlxsw_thermal_set_trip_hyst,
-	.get_trend	= mlxsw_thermal_trend_get,
 };
 

static int mlxsw_thermal_module_bind(struct thermal_zone_device *tzdev,

drivers/net/ethernet/mellanox/mlxsw/core_thermal.c +0 -2
@@ -473,8 +423,6 @@ static int mlxsw_thermal_module_temp_get(struct
 thermal_zone_device *tzdev,
 	/* Update trip points. */
 	err = mlxsw_thermal_module_trips_update(dev, thermal->core, tz,
 						crit_temp, emerg_temp);
-	if (!err && temp > 0)
-		mlxsw_thermal_tz_score_update(thermal, tzdev, tz->trips,
 temp);
 
drivers/net/ethernet/mellanox/mlxsw/core_thermal.c +0 -1
 	return 0;
 }
@@ -547,7 +495,6 @@ static struct thermal_zone_device_ops
 mlxsw_thermal_module_ops = {
 	.set_trip_temp	= mlxsw_thermal_module_trip_temp_set,
 	.get_trip_hyst	= mlxsw_thermal_module_trip_hyst_get,
 	.set_trip_hyst	= mlxsw_thermal_module_trip_hyst_set,
-	.get_trend	= mlxsw_thermal_trend_get,
 };
 

static int mlxsw_thermal_gearbox_temp_get(struct thermal_zone_device
*tzdev, @@ -568,8 +515,6 @@ static int mlxsw_thermal_gearbox_temp_get(struct thermal_zone_device *tzdev,

drivers/net/ethernet/mellanox/mlxsw/core_thermal.c +0 -0
 		return err;
 
 	mlxsw_reg_mtmp_unpack(mtmp_pl, &temp, NULL, NULL, NULL,

NULL);

drivers/net/ethernet/mellanox/mlxsw/core_thermal.c +0 -2
-	if (temp > 0)
-		mlxsw_thermal_tz_score_update(thermal, tzdev, tz->trips,

temp);

drivers/net/ethernet/mellanox/mlxsw/core_thermal.c +0 -1
 	*p_temp = temp;
 	return 0;
@@ -584,7 +529,6 @@ static struct thermal_zone_device_ops
 mlxsw_thermal_gearbox_ops = {
 	.set_trip_temp	= mlxsw_thermal_module_trip_temp_set,
 	.get_trip_hyst	= mlxsw_thermal_module_trip_hyst_get,
 	.set_trip_hyst	= mlxsw_thermal_module_trip_hyst_set,
-	.get_trend	= mlxsw_thermal_trend_get,
 };
 

static int mlxsw_thermal_get_max_state(struct thermal_cooling_device
*cdev, @@ -667,6 +611,7 @@ mlxsw_thermal_module_tz_init(struct mlxsw_thermal_module *module_tz)

MLXSW_THERMAL_TRIP_MASK,
module_tz,

&mlxsw_thermal_module_ops,
+

&mlxsw_thermal_params,

drivers/net/ethernet/mellanox/mlxsw/core_thermal.c +0 -0
 							0,
 							module_tz->parent-
Quoted 1 line

polling_delay);

--
2.25.1

#3 lore raw

Re: [PATCH 2/2] Revert "mlxsw: core: Add the hottest thermal zone detection"

Hi Vadim,

Quoted 30 lines · Vadim Pasternak
Quoted 30 lines

-----Original Message-----
From: Daniel Lezcano <[email protected]>
Sent: Monday, August 1, 2022 12:56 PM
To: [email protected]; [email protected]
Cc: Vadim Pasternak <[email protected]>; [email protected]; [email protected]; [email protected]; Ido Schimmel <[email protected]>; Petr Machata <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>
Subject: [PATCH 2/2] Revert "mlxsw: core: Add the hottest thermal zone detection"

This reverts commit 6f73862fabd93213de157d9cc6ef76084311c628.

As discussed in the thread:

https://lore.kernel.org/all/f3c62ebe-7d59-c537-a010-
[email protected]/

the feature provided by commits 2dc2f760052da and 6f73862fabd93 is actually already handled by the thermal framework via the cooling device state aggregation, thus all this code is pointless.

The revert conflicts with the following changes:
- 7f4957be0d5b8: thermal: Use mode helpers in drivers
- 6a79507cfe94c: mlxsw: core: Extend thermal module with per QSFP module
thermal zones

Quoted 4 lines
Quoted 3 lines

These conflicts were fixed and the resulting changes are in this patch.

Thanks for testing

Quoted 3 lines

Daniel,
Could you, please, re-base the patch on top of net-next as Jakub mentioned? Or do you want me to do it?

It is fine, I can do it. The conflict is trivial.

However, I would have preferred to have the patch in my tree so I can continue the consolidation work.

Is it ok if I pick the patch and the conflict being simple, that can be handle at merge time, no?

Quoted 4 lines

There is also redundant blank line in this patch:
&mlxsw_thermal_module_ops,
+
&mlxsw_thermal_params,

Yeah, thanks.

Signature · 5 lines
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog
#4 lore raw

RE: [PATCH 2/2] Revert "mlxsw: core: Add the hottest thermal zone detection"

Quoted 61 lines

-----Original Message-----
From: Daniel Lezcano <[email protected]>
Sent: Friday, August 5, 2022 7:07 PM
To: Vadim Pasternak <[email protected]>; [email protected]
Cc: [email protected]; [email protected]; linux- [email protected]; Ido Schimmel <[email protected]>; Petr Machata <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>
Subject: Re: [PATCH 2/2] Revert "mlxsw: core: Add the hottest thermal zone detection"

Hi Vadim,

Quoted 10 lines · Vadim Pasternak
Quoted 10 lines

-----Original Message-----
From: Daniel Lezcano <[email protected]>
Sent: Monday, August 1, 2022 12:56 PM
To: [email protected]; [email protected]
Cc: Vadim Pasternak <[email protected]>; [email protected]; [email protected]; [email protected]; Ido Schimmel <[email protected]>; Petr Machata <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo

Abeni

Quoted 20 lines
Quoted 20 lines

<[email protected]>
Subject: [PATCH 2/2] Revert "mlxsw: core: Add the hottest thermal zone detection"

This reverts commit 6f73862fabd93213de157d9cc6ef76084311c628.

As discussed in the thread:

https://lore.kernel.org/all/f3c62ebe-7d59-c537-a010-
[email protected]/

the feature provided by commits 2dc2f760052da and 6f73862fabd93 is actually already handled by the thermal framework via the cooling device state aggregation, thus all this code is pointless.

The revert conflicts with the following changes:
- 7f4957be0d5b8: thermal: Use mode helpers in drivers
- 6a79507cfe94c: mlxsw: core: Extend thermal module with per QSFP
module thermal zones

Quoted 4 lines
Quoted 3 lines

These conflicts were fixed and the resulting changes are in this patch.

Thanks for testing

Quoted 2 lines

Daniel,
Could you, please, re-base the patch on top of net-next as Jakub

mentioned?

Quoted 1 line

Or do you want me to do it?

Quoted 7 lines

It is fine, I can do it. The conflict is trivial.

However, I would have preferred to have the patch in my tree so I can continue the consolidation work.

Is it ok if I pick the patch and the conflict being simple, that can be handle at merge time, no?

Hi Daniel,

Sorry for the delay.

Yes, it is OK. There are no plans to make changes in 'core_thermal.c' module In current cycle, so it should be fine.

Thanks,
Vadim.

Quoted 16 lines
Quoted 3 lines

There is also redundant blank line in this patch:

&mlxsw_thermal_module_ops,

Quoted 2 lines

+

&mlxsw_thermal_params,

Yeah, thanks.

--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter | <http://www.linaro.org/linaro-
blog/> Blog

#5 lore raw
In reply to Daniel Lezcano
Quoted 18 lines

-----Original Message-----
From: Daniel Lezcano <[email protected]>
Sent: Monday, August 1, 2022 12:56 PM
To: [email protected]; [email protected]
Cc: Vadim Pasternak <[email protected]>; [email protected]; [email protected]; [email protected]; Ido Schimmel <[email protected]>; Petr Machata <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>
Subject: [PATCH 1/2] Revert "mlxsw: core: Use different get_trend() callbacks for different thermal zones"

This reverts commit 2dc2f760052da4925482ecdcdc5c94d4a599153c.

As discussed in the thread:

Quoted 8 lines

https://lore.kernel.org/all/f3c62ebe-7d59-c537-a010-
[email protected]/

the feature provided by commits 2dc2f760052da and 6f73862fabd93 is actually already handled by the thermal framework via the cooling device state aggregation, thus all this code is pointless.

No conflict happened when reverting the patch.

Hi Daniel,

I am sorry, I didn't run emulation yet to validate this change. Will do it in tomorrow and will send ACK if it is OK.

Thanks,
Vadim.

Quoted 70 lines
---
 .../ethernet/mellanox/mlxsw/core_thermal.c    | 23 ++++---------------
 1 file changed, 4 insertions(+), 19 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/core_thermal.c +0 -0
index 05f54bd982c0..f5751242653b 100644
@@ -345,7 +345,8 @@ static int mlxsw_thermal_set_trip_hyst(struct

thermal_zone_device *tzdev, static int mlxsw_thermal_trend_get(struct thermal_zone_device *tzdev,

drivers/net/ethernet/mellanox/mlxsw/core_thermal.c +2 -17
 				   int trip, enum thermal_trend *trend)  {
-	struct mlxsw_thermal *thermal = tzdev->devdata;
+	struct mlxsw_thermal_module *tz = tzdev->devdata;
+	struct mlxsw_thermal *thermal = tz->parent;
 
 	if (trip < 0 || trip >= MLXSW_THERMAL_NUM_TRIPS)
 		return -EINVAL;
@@ -537,22 +538,6 @@ mlxsw_thermal_module_trip_hyst_set(struct
 thermal_zone_device *tzdev, int trip,
 	return 0;
 }
 
-static int mlxsw_thermal_module_trend_get(struct thermal_zone_device
 *tzdev,
-					  int trip, enum thermal_trend
 *trend)
-{
-	struct mlxsw_thermal_module *tz = tzdev->devdata;
-	struct mlxsw_thermal *thermal = tz->parent;
-
-	if (trip < 0 || trip >= MLXSW_THERMAL_NUM_TRIPS)
-		return -EINVAL;
-
-	if (tzdev == thermal->tz_highest_dev)
-		return 1;
-
-	*trend = THERMAL_TREND_STABLE;
-	return 0;
-}
-

static struct thermal_zone_device_ops mlxsw_thermal_module_ops = {

drivers/net/ethernet/mellanox/mlxsw/core_thermal.c +1 -1
 	.bind		= mlxsw_thermal_module_bind,
 	.unbind		= mlxsw_thermal_module_unbind,
@@ -562,7 +547,7 @@ static struct thermal_zone_device_ops
 mlxsw_thermal_module_ops = {
 	.set_trip_temp	= mlxsw_thermal_module_trip_temp_set,
 	.get_trip_hyst	= mlxsw_thermal_module_trip_hyst_get,
 	.set_trip_hyst	= mlxsw_thermal_module_trip_hyst_set,
-	.get_trend	= mlxsw_thermal_module_trend_get,
+	.get_trend	= mlxsw_thermal_trend_get,
 };
 

static int mlxsw_thermal_gearbox_temp_get(struct thermal_zone_device
*tzdev, @@ -599,7 +584,7 @@ static struct thermal_zone_device_ops mlxsw_thermal_gearbox_ops = {

drivers/net/ethernet/mellanox/mlxsw/core_thermal.c +1 -1
 	.set_trip_temp	= mlxsw_thermal_module_trip_temp_set,
 	.get_trip_hyst	= mlxsw_thermal_module_trip_hyst_get,
 	.set_trip_hyst	= mlxsw_thermal_module_trip_hyst_set,
-	.get_trend	= mlxsw_thermal_module_trend_get,
+	.get_trend	= mlxsw_thermal_trend_get,
 };
 
 static int mlxsw_thermal_get_max_state(struct thermal_cooling_device

*cdev,
--
2.25.1

maintainer
#6 lore raw
Quoted 7 lines · On Mon, 1 Aug 2022 11:13:36 +0000 Vadim Pasternak wrote:
Quoted 7 lines

This reverts commit 2dc2f760052da4925482ecdcdc5c94d4a599153c.

As discussed in the thread:

https://lore.kernel.org/all/f3c62ebe-7d59-c537-a010-
[email protected]/

Quoted 8 lines
Quoted 5 lines

the feature provided by commits 2dc2f760052da and 6f73862fabd93 is actually already handled by the thermal framework via the cooling device state aggregation, thus all this code is pointless.

No conflict happened when reverting the patch.

I am sorry, I didn't run emulation yet to validate this change. Will do it in tomorrow and will send ACK if it is OK.

We'll also need a rebase on top of net-next, the patch as is does not apply to either of the networking trees.

Tested-by on v1 1/2
#7 lore raw
In reply to Daniel Lezcano
Quoted 21 lines

-----Original Message-----
From: Daniel Lezcano <[email protected]>
Sent: Monday, August 1, 2022 12:56 PM
To: [email protected]; [email protected]
Cc: Vadim Pasternak <[email protected]>; [email protected]; [email protected]; [email protected]; Ido Schimmel <[email protected]>; Petr Machata <[email protected]>; Eric Dumazet <[email protected]>; Jakub Kicinski <[email protected]>; Paolo Abeni <[email protected]>
Subject: [PATCH 1/2] Revert "mlxsw: core: Use different get_trend() callbacks for different thermal zones"

This reverts commit 2dc2f760052da4925482ecdcdc5c94d4a599153c.

As discussed in the thread:

https://lore.kernel.org/all/f3c62ebe-7d59-c537-a010-
[email protected]/

Quoted 7 lines

the feature provided by commits 2dc2f760052da and 6f73862fabd93 is actually already handled by the thermal framework via the cooling device state aggregation, thus all this code is pointless.

No conflict happened when reverting the patch.

Quoted 68 lines
---
 .../ethernet/mellanox/mlxsw/core_thermal.c    | 23 ++++---------------
 1 file changed, 4 insertions(+), 19 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/core_thermal.c +0 -0
index 05f54bd982c0..f5751242653b 100644
@@ -345,7 +345,8 @@ static int mlxsw_thermal_set_trip_hyst(struct

thermal_zone_device *tzdev, static int mlxsw_thermal_trend_get(struct thermal_zone_device *tzdev,

drivers/net/ethernet/mellanox/mlxsw/core_thermal.c +2 -17
 				   int trip, enum thermal_trend *trend)  {
-	struct mlxsw_thermal *thermal = tzdev->devdata;
+	struct mlxsw_thermal_module *tz = tzdev->devdata;
+	struct mlxsw_thermal *thermal = tz->parent;
 
 	if (trip < 0 || trip >= MLXSW_THERMAL_NUM_TRIPS)
 		return -EINVAL;
@@ -537,22 +538,6 @@ mlxsw_thermal_module_trip_hyst_set(struct
 thermal_zone_device *tzdev, int trip,
 	return 0;
 }
 
-static int mlxsw_thermal_module_trend_get(struct thermal_zone_device
 *tzdev,
-					  int trip, enum thermal_trend
 *trend)
-{
-	struct mlxsw_thermal_module *tz = tzdev->devdata;
-	struct mlxsw_thermal *thermal = tz->parent;
-
-	if (trip < 0 || trip >= MLXSW_THERMAL_NUM_TRIPS)
-		return -EINVAL;
-
-	if (tzdev == thermal->tz_highest_dev)
-		return 1;
-
-	*trend = THERMAL_TREND_STABLE;
-	return 0;
-}
-

static struct thermal_zone_device_ops mlxsw_thermal_module_ops = {

drivers/net/ethernet/mellanox/mlxsw/core_thermal.c +1 -1
 	.bind		= mlxsw_thermal_module_bind,
 	.unbind		= mlxsw_thermal_module_unbind,
@@ -562,7 +547,7 @@ static struct thermal_zone_device_ops
 mlxsw_thermal_module_ops = {
 	.set_trip_temp	= mlxsw_thermal_module_trip_temp_set,
 	.get_trip_hyst	= mlxsw_thermal_module_trip_hyst_get,
 	.set_trip_hyst	= mlxsw_thermal_module_trip_hyst_set,
-	.get_trend	= mlxsw_thermal_module_trend_get,
+	.get_trend	= mlxsw_thermal_trend_get,
 };
 

static int mlxsw_thermal_gearbox_temp_get(struct thermal_zone_device
*tzdev, @@ -599,7 +584,7 @@ static struct thermal_zone_device_ops mlxsw_thermal_gearbox_ops = {

drivers/net/ethernet/mellanox/mlxsw/core_thermal.c +1 -1
 	.set_trip_temp	= mlxsw_thermal_module_trip_temp_set,
 	.get_trip_hyst	= mlxsw_thermal_module_trip_hyst_get,
 	.set_trip_hyst	= mlxsw_thermal_module_trip_hyst_set,
-	.get_trend	= mlxsw_thermal_module_trend_get,
+	.get_trend	= mlxsw_thermal_trend_get,
 };
 
 static int mlxsw_thermal_get_max_state(struct thermal_cooling_device

*cdev,
--
2.25.1