linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Srikar Srimath Tirumala <srikars-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
To: Eduardo Valentin
	<edubezval-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	"Pandruvada,
	Srinivas"
	<srinivas.pandruvada-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: "Zhang, Rui" <rui.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	"linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"mlongnecker-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org"
	<mlongnecker-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
Subject: Re: [PATCH v2] thermal: add sysfs_notify on some attributes
Date: Tue, 29 Mar 2016 19:53:40 -0700	[thread overview]
Message-ID: <56FB3FB4.1010308@nvidia.com> (raw)
In-Reply-To: <20160329013540.GA15615-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>

On 03/28/2016 06:35 PM, Eduardo Valentin wrote:
> On Tue, Mar 15, 2016 at 11:08:00PM +0000, Pandruvada, Srinivas wrote:
>> On Mon, 2016-03-14 at 11:12 -0700, Srikar Srimath Tirumala wrote:
>>> Add a sysfs_notify on thermal_zone*/temp and cooling_device*/
>>> cur_state whenever any trip is triggered or cur state is changed.
>>>
>>> This change allows usermode apps to register themselves to get
>>> notified, when certain thermal conditions occur and reduce their
>>> workload. This workload throttling allows usermode to react before
>>> hardware clocks are throttled and keep some critical apps running
>>> reliably longer.
>> I think we need a combination of proposal in
>> https://patchwork.kernel.org/patch/7876351/ and this.
>>
>> For example this patch notifies that some trip is violated, but that is
>> not enough for user space application to take any action. Some trips
>> violations user space may not care as this may be a transient one. The
>> patch from Eduardo address that by providing trip, temperature and last
>> temperature information. But that patch only address hot trips. I
>> understand why Eduardo doesn't want to be notified for passive trips as
>> there will be too many.
>>
>
> Yeah, my original intention was to avoid flooding userland, specially
> through a pipe like the sysfs netlink, which is in use to deal with
> other stuff.
>

How about if the number of notifications were to be reduced like in v3 
of this patch? Or is the consensus not to use sysfs_notify or uevents at 
all?

>> So IMO we need some mechanism to turn off notification and decide what
>> notification will result in user space notifications.
>> On some x86 systems we have 10+ passive/active trips, this will results
>> in too many notifications. We may be in thermally sensitive zone, where
>> more code excecution is more heat.
>>
>
> Exactly, that has direct impact not only on the process waiting for
> thermal notifications, but also on other process listening to sysfs.
>
>> We may have some mask of trips for which will result in notifications.
>> By default no notifications, unless some user space requests.
>>
>
> The complexity of such communication (or even the current status of
> sysfs ABI) starts to reach limit of such channel. We may definitely
> consider other means, such as /dev interface, just like IIO does.
>

I agree with your point about the overhead of generating these events 
and thought maybe the problem could be partially addressed by reducing 
the number of notifications being sent. So with that in mind I created a 
V3 of the patches which does this. Please do take a look at it when you 
get a chance.

>> During last LPC we discussed about using IIO for temperature threshold
>> notifications and I submitted multiple changes for that. Looks like we
>> also care of trip point changes. So I think we need more comprehensive
>> mechanism to address this.
>>
>> May be we should have thermal mini summit during LPC again and decide a
>> comprehensive plan to address all asynchronous thermal notifications.
>>
>
> I have created a wiki for LPC 2016
> http://wiki.linuxplumbersconf.org/2016:thermal
>
> Overall I believe we need to solve the (temperature) sensing in a more
> structured way within the kernel. We have three subsystem that allow
> performing temperature sensing. They are different in design and
> concept, but still solve similar problems.
>

I went through the LPC presentation/patches and had a couple of questions.

The thermal iio device seems perfectly suited for sending large amounts 
of thermal data from the kernel framework to user space. Are there a lot 
of platforms where thermal throttling happens in user space? If so, Is 
this an indication that passive thermal throttling is going into the 
user space some time in the future?

Our use cases don't really require too many notifications. But there 
seem to be other use cases out there that require lot more thermal info 
from the kernel. Just trying to understand what those are and what needs 
to be done to arrive at a solution that benefits all.

> I would still prefer to get this better architectured.
>
> Of course, we do not need to wait until LPC to start drafting this.
>
> Again, please lets generate enough quorum to run the micro conf.
>
> BR,
>
> Eduardo Valentin
>

Much appreciate your comments and inputs.
Best Regards
Srikar

  parent reply	other threads:[~2016-03-30  2:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-14 18:12 [PATCH v2] thermal: add sysfs_notify on some attributes Srikar Srimath Tirumala
     [not found] ` <1457979156-10972-1-git-send-email-srikars-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2016-03-15 23:08   ` Pandruvada, Srinivas
     [not found]     ` <1458079520.4486.39.camel-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2016-03-29  1:35       ` Eduardo Valentin
     [not found]         ` <20160329013540.GA15615-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2016-03-30  2:53           ` Srikar Srimath Tirumala [this message]
2016-03-30 15:45             ` Pandruvada, Srinivas
2016-03-30 17:06           ` Srinivas Pandruvada

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56FB3FB4.1010308@nvidia.com \
    --to=srikars-ddmlm1+adcrqt0dzr+alfa@public.gmane.org \
    --cc=edubezval-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mlongnecker-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org \
    --cc=rui.zhang-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=srinivas.pandruvada-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).