X86 platform drivers
 help / color / mirror / Atom feed
From: Hans de Goede <hdegoede@redhat.com>
To: Mark Pearson <markpearson@lenovo.com>,
	Benjamin Berg <bberg@redhat.com>,
	Bastien Nocera <hadess@hadess.net>,
	Elia Devito <eliadevito@gmail.com>,
	Mark Pearson <mpearson@lenovo.com>
Cc: Jared Dominguez <jaredz@redhat.com>,
	platform-driver-x86@vger.kernel.org,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: Re: [External] Re: RFC: offering a standardized (/sys/class) userspace API for selecting system/laptop performance-profiles
Date: Tue, 22 Sep 2020 12:30:40 +0200	[thread overview]
Message-ID: <9d473bcb-9773-6ee6-d60c-e180e3bb8e0a@redhat.com> (raw)
In-Reply-To: <3ed9ac0a-2e24-7d3a-f264-c3bb03b846d9@lenovo.com>

Hi,

On 9/17/20 7:16 PM, Mark Pearson wrote:
> 
> On 9/17/2020 1:03 PM, Hans de Goede wrote:
>> Hi Mark,
>>
>> On 9/17/20 6:58 PM, Mark Pearson wrote:
>>> On 9/17/2020 10:10 AM, Benjamin Berg wrote:
>>>> Hi,
>>>>
>>>> On Thu, 2020-09-17 at 15:54 +0200, Hans de Goede wrote:
>>>>> Hi,
>>>>>
>>>>> On 9/17/20 3:50 PM, Benjamin Berg wrote:
>>>>>> On Thu, 2020-09-17 at 14:51 +0200, Hans de Goede wrote:
>>>>>>>> Compared to the WIP lenovo-dytc "perfmode" driver, we're missing
>>>>>>>> something to advertise the unavailability of a profile, and the reason
>>>>>>>> for that unavailability.
>>>>>>>
>>>>>>> UGh, do we really need to export this though. We have the lap_mode thing
>>>>>>> already; and that is something which we will need for other reasons in
>>>>>>> the future too. Any UI for selecting performance modes can display a
>>>>>>> warning when lap_mode is true saying that: "The laptop has detected that it
>>>>>>> is sitting on someone's lap and that performance may be limited
>>>>>>> because of this." (feel free to improve the text).
>>>>>>
>>>>>> Well, for dytc_perfmode there are actually always the three states
>>>>>> L/M/H. It just happens that the kernel will write "H*" (was "M*" until
>>>>>> yesterday) when the performance mode is degraded due to lap detection.
>>>>>>
>>>>>> Think of dytc_perfmode as a profile that sets a number of things:
>>>>>>    * Thermal Limits
>>>>>>    * Fan Behaviour
>>>>>>    * possibly more
>>>>>>
>>>>>> While dytc_lapmode will only enforce a change to the thermal limit.
>>>>>> So "performance" (H) is technically a valid mode even when the lap is
>>>>>> detected.
>>>>>>
>>>>>>> I guess we could split the "value" attribute from my reply to Benjamin's
>>>>>>> email into "configured_value" (rw) and "actual_value" (rw) attributes.
>>>>>>> If we have the info we might as well export it I guess,.
>>>>>>
>>>>>> I consider the "*" purely a curtsey to users that read the attribute
>>>>>> directly using e.g. cat to help with the interpretation. It probably is
>>>>>> not interesting to userspace applications/daemons.
>>>>>
>>>>> So if there is a difference between M and H and H* then I think we should
>>>>> just do the KISS thing and only have a single value attribute and in the
>>>>> new interface handle the H* like H (p-p-d can still check the lap_mode
>>>>> attribute to differentiate the 2 if it wants to).
>>>>
>>>> I guess you are saying to drop "H*" and only have "L"/"M"/"H"? If so,
>>>> fine with me, but we probably need that input in reply to
>>>>    https://patchwork.kernel.org/patch/11730133/#23618881
>>>> then :)
>>>>
>>>> In principle it could be useful for userspace to know that performance
>>>> is or would be dramatically impacted. i.e. when dytc_lapmode is 1, then
>>>> you might want to say something like:
>>>>
>>>>    performance states >= 75 are impacted due to "lapmode"
>>>>
>>>> But, not sure if a kernel interface for that is useful or whether we
>>>> should just put that kind of knowledge into userspace.
>>>>
>>>> Benjamin
>>>>
>>> I don't have a strong opinion on this but the kernel driver is already knowledgeable about the quirks of what does and doesn't work on the system so it seems like a good place to have that logic.
>>>
>>> What if we have an API for "configured" and "actual" - and if they differ userspace knows it should figure out why (likely lapmode, but if the HW vendor adds a new setting related to "position of sun in the sky" or "how much money is in your account and can you afford the electricity bill?" that could be added too....)
>>
>> As I understand the problem with the configured and actual value/performance_level ideas is that if I understand things correctly that H* is not the same as M,
>> it behaves close-ish to M because of the lower thermal-limits from lapmode, but if I understood Benjamin correctly is is not exactly the same, so if we were
>> to advertise "M" in the actual_performance_level sysfs-attribute then that would not really be correct ?
>>
> 
> Just a small clarification - in our case High performance is only for deskmode. It drops to Medium in lapmode.
> Medium mode is slightly different in power rating between lap and desk mode (e.g on X1Carbon 14.5W on lap, 15W on desk). I haven't really worried about this in my patch implementation - it's still "medium"
> 
> Does that make it better or more confusing?

I think that calling both medium is fair in this case.

The big question is, do we want to expose that even though the user configured
a performance-profile of high, the user is only getting medium atm because of
reasons?

Note I say "because of reasons" specifically, because things become even more
complicated if we want to spell out the reasons in the sysfs interface too.

I mean high will give different results even when in desk mode, depending
on if there is a cloth on the desk (bad) or if the table is a metal picknick
table full of round holes to drain the rain (allowing more airflow to the
bottom of the laptop) not to mention that the ambient temperature in which
the laptop is used can probably vary from 15 to 35 degrees celcius.

IOW there can be many factors why high may not really lead to high turbo
clocks; or why it leads to higher turbo clocks then normally expected...

I still have the feeling that it would be best to drop the UI requirement
to show being in a degraded performance mode, because the performance
with modern laptops is just very variable and dependent on many factors.

If we drop that UI requirement; then there also is no need to advertise
configured vs actual performance profile in the sysfs interface.

Users who really want to know what is going on will get much more
detailed and useful information when using something like turbostat
(or a UI for that) anyways.

Regards,

Hans


  parent reply	other threads:[~2020-09-22 10:30 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-17 11:22 RFC: offering a standardized (/sys/class) userspace API for selecting system/laptop performance-profiles Hans de Goede
2020-09-17 11:50 ` Bastien Nocera
2020-09-17 12:51   ` Hans de Goede
2020-09-17 13:00     ` Bastien Nocera
2020-09-17 13:50     ` Benjamin Berg
2020-09-17 13:54       ` Hans de Goede
2020-09-17 14:10         ` Benjamin Berg
2020-09-17 16:58           ` [External] " Mark Pearson
2020-09-17 17:03             ` Hans de Goede
2020-09-17 17:16               ` Mark Pearson
2020-09-17 18:16                 ` Benjamin Berg
2020-09-21  9:03                   ` Elia Devito
2020-09-22 10:43                     ` Hans de Goede
2020-09-24  2:10                       ` Mark Pearson
2020-09-24  8:21                         ` Hans de Goede
2020-09-24 11:48                     ` Benjamin Berg
2020-09-22 10:30                 ` Hans de Goede [this message]
2020-09-24  1:44                   ` Mark Pearson
2020-09-17 13:36   ` Mark Pearson
2020-09-17 14:04     ` Hans de Goede
2020-09-17 16:51       ` Mark Pearson
2020-09-17 12:22 ` Benjamin Berg
2020-09-17 12:45   ` Hans de Goede
2020-09-17 13:07     ` Bastien Nocera
2020-09-17 13:46       ` Hans de Goede
2020-09-17 13:02 ` Barnabás Pőcze
2020-09-17 13:24   ` Hans de Goede
2020-09-17 13:28     ` Bastien Nocera
2020-09-17 13:51       ` Hans de Goede
2020-09-17 13:59     ` Benjamin Berg

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=9d473bcb-9773-6ee6-d60c-e180e3bb8e0a@redhat.com \
    --to=hdegoede@redhat.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=bberg@redhat.com \
    --cc=eliadevito@gmail.com \
    --cc=hadess@hadess.net \
    --cc=jaredz@redhat.com \
    --cc=markpearson@lenovo.com \
    --cc=mpearson@lenovo.com \
    --cc=platform-driver-x86@vger.kernel.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