lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 7 Jul 2022 18:00:45 +0200
From:   "Kallas, Pawel" <pawel.kallas@...el.com>
To:     Guenter Roeck <linux@...ck-us.net>
CC:     <jdelvare@...e.com>, <corbet@....net>,
        <linux-hwmon@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        <linux-doc@...r.kernel.org>, <iwona.winiarska@...el.com>
Subject: Re: [PATCH 0/3] hwmon: (pmbus) add power from energy readings


On 07-Jul-22 4:09 PM, Guenter Roeck wrote:
> On Thu, Jul 07, 2022 at 04:01:54PM +0200, Kallas, Pawel wrote:
>> 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.
> Yes, but that is not the responsibility of the kernel. Just like we don't add
> up power measurements to calculate energy, we don't take energy measurements
> and calculate power consumption. Similar, we don't take voltage and current
> measurements and report power consumption from it either.
>
>>> 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.
> Another reason for doing it in userspace. Read energy every N seconds, and use
> the difference to calculate average power consumption average over that time
> period.
We cannot "read energy". Raw value from READ_EIN and READ_EOUT is not 
energy.
>>> 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.
> I did not suggest that. Just use the "energyX_in" attributes.
Expressing raw value from READ_EIN or READ_EOUT is not in line with
sysfs interface, because "energyX_in" should have microJoules as unit.
Those commands have very specific format that is not actually energy.
Since the only sensible use case for those raw values is calculating power
we figured it would be better (and more accurate) to do it in kernel.
Also, if we just express raw value, the user would have to know data format
of the values for the device and know register format to decode the data.
>
> Thanks,
> Guenter
>
>>> 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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ