diff mbox

[v3,1/4] thermal: send notifications for cdev state change

Message ID 1459298497-29481-2-git-send-email-srikars@nvidia.com
State Deferred
Headers show

Commit Message

Srikar Srimath Tirumala March 30, 2016, 12:41 a.m. UTC
Send notifications using sysfs_notify to indicate that a cooling
device cur state has changed. This can alert the listeners that
hardware clocks are about to be throttled.

A listening user space application can use this notification to
perform workload throttling.

Change-Id: I71cd6d11bff87f181fa3b7db36bf6c953d1d77eb
Signed-off-by: Srikar Srimath Tirumala <srikars@nvidia.com>
---
 drivers/thermal/thermal_core.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Matthew Longnecker March 30, 2016, 4:45 p.m. UTC | #1
Looks good to me.

The only platforms I've ever seen with substantial numbers of cooling 
devices whose states change relatively frequently are NVIDIA's. So I 
don't think this will be a performance concern.

-Matt Longnecker

On 03/29/2016 05:41 PM, Srikar Srimath Tirumala wrote:
> Send notifications using sysfs_notify to indicate that a cooling
> device cur state has changed. This can alert the listeners that
> hardware clocks are about to be throttled.
>
> A listening user space application can use this notification to
> perform workload throttling.
>
> Change-Id: I71cd6d11bff87f181fa3b7db36bf6c953d1d77eb
> Signed-off-by: Srikar Srimath Tirumala <srikars@nvidia.com>
> ---
>   drivers/thermal/thermal_core.c | 1 +
>   1 file changed, 1 insertion(+)
>
> diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
> index d4b5465..b09fff1 100644
> --- a/drivers/thermal/thermal_core.c
> +++ b/drivers/thermal/thermal_core.c
> @@ -1642,6 +1642,7 @@ void thermal_cdev_update(struct thermal_cooling_device *cdev)
>   	cdev->updated = true;
>   	trace_cdev_update(cdev, target);
>   	dev_dbg(&cdev->device, "set to state %lu\n", target);
> +	sysfs_notify(&cdev->device.kobj, NULL, "cur_state");
>   }
>   EXPORT_SYMBOL(thermal_cdev_update);
>   

--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c
index d4b5465..b09fff1 100644
--- a/drivers/thermal/thermal_core.c
+++ b/drivers/thermal/thermal_core.c
@@ -1642,6 +1642,7 @@  void thermal_cdev_update(struct thermal_cooling_device *cdev)
 	cdev->updated = true;
 	trace_cdev_update(cdev, target);
 	dev_dbg(&cdev->device, "set to state %lu\n", target);
+	sysfs_notify(&cdev->device.kobj, NULL, "cur_state");
 }
 EXPORT_SYMBOL(thermal_cdev_update);