Linux Hardware Monitor development
 help / color / mirror / Atom feed
From: "Kallas, Pawel" <pawel.kallas@intel.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: <jdelvare@suse.com>, <corbet@lwn.net>,
	<linux-hwmon@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-doc@vger.kernel.org>, <iwona.winiarska@intel.com>
Subject: Re: [PATCH 0/3] hwmon: (pmbus) add power from energy readings
Date: Thu, 7 Jul 2022 16:01:54 +0200	[thread overview]
Message-ID: <dc8771ad-b48b-317d-b132-47208ef58710@intel.com> (raw)
In-Reply-To: <20220706131758.GA652205@roeck-us.net>

On 06-Jul-22 3:17 PM, Guenter Roeck wrote:
> On Wed, Jul 06, 2022 at 12:40:21PM +0200, Kallas, Pawel wrote:
>> Add support for reading EIN or EOUT registers and expose power calculated
>> from energy. This is more accurate than PIN and POUT power readings.
>> Readings are exposed in new hwmon files power1_average and power2_average.
>> Also add support for QUERY command that is needed to check availability
>> of EIN and EOUT reads and its data format. Only direct data format is
>> supported due to lack of test devices supporting other formats.
>>
> I don't think this is a good idea. EIN/EOUT report energy consumption,
> not power.

According to PMBus-Specification-Rev-1-3-1-Part-II-20150313 "READ_EIN and
READ_EOUT commands provide information that can be used to calculate power
consumption". That is accumulator summing instantaneous input power
expressed in "watt-samples" and counter indicating number of samples.
The only reasonable thing that can be done with those values is 
calculating power.

> The "average" attributes as implemented don't really report
> a reliable number since the averaging period is not defined.

Agree, it is calculating average power since last read, which could be
incorrect with multiple consumers. However, this is the only possibility
without adding some timer logic.

> Also, kernel
> drivers should not make up such numbers. I don't mind adding energy
> attribute support, but that should be reported as what it is, energy.
> What userspace does with it would then be a userspace concern; it can
> calculate all kinds of averages from it as much as it wants.

Returning direct value of read registers would also work for our use case,
but it is not in line with sysfs interface.

> Also, new attributes should not depend on query command support.
> I don't mind adding support for that, but it would have to be independent
> of energy attribute support.
>
> Thanks,
> Guenter
>
>> Kallas, Pawel (3):
>>    hwmon: (pmbus) add support for QUERY command
>>    hwmon: (pmbus) refactor sensor initialization
>>    hwmon: (pmbus) add EIN and EOUT readings
>>
>>   Documentation/hwmon/pmbus-core.rst |   7 +
>>   drivers/hwmon/pmbus/pmbus.c        |  20 +++
>>   drivers/hwmon/pmbus/pmbus.h        |  19 +++
>>   drivers/hwmon/pmbus/pmbus_core.c   | 261 +++++++++++++++++++++++++++--
>>   4 files changed, 291 insertions(+), 16 deletions(-)
>>
>>
>> base-commit: 7c1de25c06f31b04744beae891baf147af9ba0cb

  reply	other threads:[~2022-07-07 14:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-06 10:40 [PATCH 0/3] hwmon: (pmbus) add power from energy readings Kallas, Pawel
2022-07-06 10:40 ` [PATCH 1/3] hwmon: (pmbus) add support for QUERY command Kallas, Pawel
2022-07-06 10:40 ` [PATCH 2/3] hwmon: (pmbus) refactor sensor initialization Kallas, Pawel
2022-07-06 10:40 ` [PATCH 3/3] hwmon: (pmbus) add EIN and EOUT readings Kallas, Pawel
2022-07-06 13:17 ` [PATCH 0/3] hwmon: (pmbus) add power from energy readings Guenter Roeck
2022-07-07 14:01   ` Kallas, Pawel [this message]
2022-07-07 14:09     ` Guenter Roeck
2022-07-07 16:00       ` Kallas, Pawel
2022-07-14 13:38         ` Guenter Roeck

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=dc8771ad-b48b-317d-b132-47208ef58710@intel.com \
    --to=pawel.kallas@intel.com \
    --cc=corbet@lwn.net \
    --cc=iwona.winiarska@intel.com \
    --cc=jdelvare@suse.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    /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