Patch "net/mlx5: Register a unique thermal zone per device" has been added to the 6.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    net/mlx5: Register a unique thermal zone per device

to the 6.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     net-mlx5-register-a-unique-thermal-zone-per-device.patch
and it can be found in the queue-6.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 52acc5f90291c9483639677ab04e86981279f2ca
Author: Saeed Mahameed <saeedm@xxxxxxxxxx>
Date:   Mon Jun 26 20:36:41 2023 -0700

    net/mlx5: Register a unique thermal zone per device
    
    [ Upstream commit 631079e08aa4a20b73e70de4cf457886194f029f ]
    
    Prior to this patch only one "mlx5" thermal zone could have been
    registered regardless of the number of individual mlx5 devices in the
    system.
    
    To fix this setup a unique name per device to register its own thermal
    zone.
    
    In order to not register a thermal zone for a virtual device (VF/SF) add
    a check for PF device type.
    
    The new name is a concatenation between "mlx5_" and "<PCI_DEV_BDF>", which
    will also help associating a thermal zone with its PCI device.
    
    $ lspci | grep ConnectX
    00:04.0 Ethernet controller: Mellanox Technologies MT2892 Family [ConnectX-6 Dx]
    00:05.0 Ethernet controller: Mellanox Technologies MT2892 Family [ConnectX-6 Dx]
    
    $ cat /sys/devices/virtual/thermal/thermal_zone0/type
    mlx5_0000:00:04.0
    $ cat /sys/devices/virtual/thermal/thermal_zone1/type
    mlx5_0000:00:05.0
    
    Fixes: c1fef618d611 ("net/mlx5: Implement thermal zone")
    CC: Sandipan Patra <spatra@xxxxxxxxxx>
    Signed-off-by: Saeed Mahameed <saeedm@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/thermal.c b/drivers/net/ethernet/mellanox/mlx5/core/thermal.c
index e47fa6fb836f1..89a22ff04cb60 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/thermal.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/thermal.c
@@ -68,14 +68,19 @@ static struct thermal_zone_device_ops mlx5_thermal_ops = {
 
 int mlx5_thermal_init(struct mlx5_core_dev *mdev)
 {
+	char data[THERMAL_NAME_LENGTH];
 	struct mlx5_thermal *thermal;
-	struct thermal_zone_device *tzd;
-	const char *data = "mlx5";
+	int err;
 
-	tzd = thermal_zone_get_zone_by_name(data);
-	if (!IS_ERR(tzd))
+	if (!mlx5_core_is_pf(mdev) && !mlx5_core_is_ecpf(mdev))
 		return 0;
 
+	err = snprintf(data, sizeof(data), "mlx5_%s", dev_name(mdev->device));
+	if (err < 0 || err >= sizeof(data)) {
+		mlx5_core_err(mdev, "Failed to setup thermal zone name, %d\n", err);
+		return -EINVAL;
+	}
+
 	thermal = kzalloc(sizeof(*thermal), GFP_KERNEL);
 	if (!thermal)
 		return -ENOMEM;
@@ -88,10 +93,10 @@ int mlx5_thermal_init(struct mlx5_core_dev *mdev)
 						      &mlx5_thermal_ops,
 						      NULL, 0, MLX5_THERMAL_POLL_INT_MSEC);
 	if (IS_ERR(thermal->tzdev)) {
-		dev_err(mdev->device, "Failed to register thermal zone device (%s) %ld\n",
-			data, PTR_ERR(thermal->tzdev));
+		err = PTR_ERR(thermal->tzdev);
+		mlx5_core_err(mdev, "Failed to register thermal zone device (%s) %d\n", data, err);
 		kfree(thermal);
-		return -EINVAL;
+		return err;
 	}
 
 	mdev->thermal = thermal;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux