mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: Eduardo Valentin <evalenti@kernel.org>
Cc: eduval@amazon.com, rafael@kernel.org, linux-pm@vger.kernel.org,
	linux-kernel@vger.kernel.org, Amit Kucheria <amitk@kernel.org>,
	Zhang Rui <rui.zhang@intel.com>
Subject: Re: [PATCH 1/1] thermal: sysfs: avoid actual readings from sysfs
Date: Mon, 12 Jun 2023 10:17:51 +0200	[thread overview]
Message-ID: <7616fd9d-aa0d-2ecd-8751-894b1c9073c0@linaro.org> (raw)
In-Reply-To: <ZIITZINvtPfjuhS6@uf8f119305bce5e.ant.amazon.com>


Hi Eduardo,

On 08/06/2023 19:44, Eduardo Valentin wrote:

[ ... ]

>> Do you have a use case with some measurements to spot an issue or is it
>> a potential issue you identified ?
> 
> 
> yes, a governor that is using I2C device as input, behind I2C fast mode (100KHz)
> and needs to update the zone every 100ms. Each read in this bus, if done alone
> would be around 500us, takes 10bytes to read the device, it is 10 clocks per byte,
> well technically 9, but rounding for the sake of the example, which gets you
> 50 / 100KHz = 500 us. That is for a single read. You add one single extra
> userspace read triggering an unused device update, that is already a 1ms drift.
> Basically you looking at 0.5% for each extra userspace read competing in this
> sysfs node. You add extra devices in the same I2C bus, your governor is looking
> at more than 1% overhead. And I am talking also about a main CPU of ~800MHz.
> I did not even include the lock overhead considered for this CPU ;-)
> 
> Again, this is not about controlling the DIE temperature of the CPU you
> are running the thermal subsystem. This is about controlling
> a target device.

Ok. The target device is on a bus which is slow and prone to contention.

This hardware is not designed to be monitored with a high precision, so 
reading the temperature at a high rate does not really make sense.

Moreover (putting apart a potential contention), the delayed read does 
not change the time interval, which remains the same from the governor 
point of view.

In addition, i2c sensors are usually handled in the hwmon subsystem 
which are registered in the thermal framework from there. Those have 
most of their 'read' callback with a cached value in a jiffies based way 
eg. [1].

So the feature already exists for slow devices and are handled in the 
drivers directly via the hwmon subsystem.

 From my POV, the feature is not needed in the thermal framework.



[1] 
https://git.kernel.org/pub/scm/linux/kernel/git/thermal/linux.git/tree/drivers/hwmon/lm95234.c#n163



-- 
<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


  reply	other threads:[~2023-06-12  8:18 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-07  0:37 Eduardo Valentin
2023-06-07  6:32 ` Zhang, Rui
2023-06-07 16:28   ` Eduardo Valentin
2023-06-07  9:24 ` Daniel Lezcano
2023-06-07 16:38   ` Eduardo Valentin
2023-06-07 18:23     ` Daniel Lezcano
2023-06-08 17:44       ` Eduardo Valentin
2023-06-12  8:17         ` Daniel Lezcano [this message]
2023-06-21  5:06           ` Eduardo Valentin
2023-06-21 11:43             ` Daniel Lezcano
2023-06-22  4:56               ` Eduardo Valentin
2023-06-23 17:31                 ` Rafael J. Wysocki
2023-06-28 21:10                   ` Eduardo Valentin
2023-06-30  8:16                     ` Rafael J. Wysocki
2023-06-30 10:11                       ` Daniel Lezcano
2023-06-30 10:46                         ` Rafael J. Wysocki
2023-06-30 12:09                           ` Daniel Lezcano
2023-07-01  1:49                             ` Eduardo Valentin
2023-07-01  7:28                               ` Daniel Lezcano
2023-07-05 22:49                                 ` Eduardo Valentin
2023-07-06 13:22                                   ` Rafael J. Wysocki
2023-07-07 17:14                                     ` Eduardo Valentin
2023-07-01  1:38                         ` Eduardo Valentin
2023-07-01 14:20                           ` Daniel Lezcano
2023-07-01  1:37                       ` Eduardo Valentin
2023-07-06 13:02                         ` Rafael J. Wysocki
2023-06-10 17:24     ` Russell Haley

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=7616fd9d-aa0d-2ecd-8751-894b1c9073c0@linaro.org \
    --to=daniel.lezcano@linaro.org \
    --cc=amitk@kernel.org \
    --cc=eduval@amazon.com \
    --cc=evalenti@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rafael@kernel.org \
    --cc=rui.zhang@intel.com \
    /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

all inboxes | Powered by JetHome®