From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758939AbcBXUYO (ORCPT ); Wed, 24 Feb 2016 15:24:14 -0500 Received: from mga11.intel.com ([192.55.52.93]:6877 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758568AbcBXUYM (ORCPT ); Wed, 24 Feb 2016 15:24:12 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.22,494,1449561600"; d="scan'208";a="752635479" From: "Pandruvada, Srinivas" To: "linux-kernel@vger.kernel.org" , "srikars@nvidia.com" , "linux-pm@vger.kernel.org" , "linux-tegra@vger.kernel.org" Subject: Re: [RFC][PATCH] thermal: add sysfs_notify on some attributes Thread-Topic: [RFC][PATCH] thermal: add sysfs_notify on some attributes Thread-Index: AQHRb0FRoEQydFPzNE+sLV3qrkfvTQ== Date: Wed, 24 Feb 2016 20:24:09 +0000 Message-ID: <1456345360.3860.9.camel@intel.com> References: <1456287118-32510-1-git-send-email-srikars@nvidia.com> In-Reply-To: <1456287118-32510-1-git-send-email-srikars@nvidia.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.7.199.80] Content-Type: text/plain; charset="utf-8" Content-ID: <2FC03F7A5377734CBB8CFE0D8ED61845@intel.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id u1OKOJNC026886 On Tue, 2016-02-23 at 20:11 -0800, Srikar Srimath Tirumala wrote: > Add a sysfs_notify on thermal_zone*/temp and cooling_device*/ > cur_state whenever a passive or critical trip is triggered. > > This change allows usermode apps to register itself to get notified, > when certain thermal conditions occur and reduce their workload. > This workload throttling can reduce\prevent throttling of hardware > clocks while allowing some other critical apps to run longer > reliably. > Signed-off-by: Srikar Srimath Tirumala > --- >  drivers/thermal/thermal_core.c | 3 +++ >  1 file changed, 3 insertions(+) > > diff --git a/drivers/thermal/thermal_core.c > b/drivers/thermal/thermal_core.c > index a0a8fd1..d8d257d 100644 > --- a/drivers/thermal/thermal_core.c > +++ b/drivers/thermal/thermal_core.c > @@ -567,6 +567,8 @@ void thermal_zone_device_update(struct > thermal_zone_device *tz) >   >   for (count = 0; count < tz->trips; count++) >   handle_thermal_trip(tz, count); > + > + sysfs_notify(&tz->device.kobj, NULL, "temp"); When user space governor is used this will result in two notifications to user space. Also you want when a trip is violated. For some driver there will be too many calls from irq thread, so you may want in handle_thermal_trip when a trip is violated. Thanks, Srinivas >  } >  EXPORT_SYMBOL_GPL(thermal_zone_device_update); >   > @@ -1638,6 +1640,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); >