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]
Message-ID: <7f5c4c26-aa4d-eb97-2188-690c9e11f9a4@gmx.de>
Date:   Sun, 24 Jul 2022 03:20:41 +0200
From:   Armin Wolf <W_Armin@....de>
To:     Guenter Roeck <linux@...ck-us.net>
Cc:     jdelvare@...e.com, linux-hwmon@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] hwmon: Add pwmX_fan_channel attribute

Am 23.07.22 um 16:17 schrieb Guenter Roeck:

> On Sat, Jul 23, 2022 at 05:38:19AM +0200, Armin Wolf wrote:
>> Until now, userspace software needs to guess which
>> PWM channel is associated with which fan channel by
>> probing each PWM output and watch for fan speed changes.
>> This proccess is error-prone and unreliable.
>>
>> Some hwmon chips, especially firmware-based ones, already
>> know which PWM output is associated with which fan channel.
>>
>> Allow such chips to export this knowledge to userspace.
>>
>> Signed-off-by: Armin Wolf <W_Armin@....de>
> All of the chips I am aware of have a fixed association from pwm channel
> output to fan input. None I am aware of make this association configurable.
> I do not see the value of this attribute.
>
> Guenter

That is true, the association from pwm channel output to fan input is usually fixed.
However not all chips are able to discover which pwm channel output is associated with
which fan channel. For example most superio-based chips cannot know how the motherboard
manufacturer wired the fans, and thus userspace relies on pwmconfig for manually probing
each pwm channel.
In contrast, many firmware-based chips do know which pwm channel output controls which
fan channel. One example might be the dell-smm-hwmon driver and the gpio-fan driver.

In this case, making the attribute RO would indeed make sense.

Armin Wolf

>> ---
>>   Documentation/ABI/testing/sysfs-class-hwmon | 8 ++++++++
>>   Documentation/hwmon/sysfs-interface.rst     | 3 +++
>>   drivers/hwmon/hwmon.c                       | 1 +
>>   include/linux/hwmon.h                       | 2 ++
>>   4 files changed, 14 insertions(+)
>>
>> diff --git a/Documentation/ABI/testing/sysfs-class-hwmon b/Documentation/ABI/testing/sysfs-class-hwmon
>> index 7271781a23b2..f3d653bcf736 100644
>> --- a/Documentation/ABI/testing/sysfs-class-hwmon
>> +++ b/Documentation/ABI/testing/sysfs-class-hwmon
>> @@ -315,6 +315,14 @@ Description:
>>
>>   		RW
>>
>> +What:		/sys/class/hwmon/hwmonX/pwmY_fan_channel
>> +Description:
>> +		Select which fan channel is controlled by this PWM output.
>> +
>> +		Valid fan channel/PWM output combinations are chip-dependent.
>> +
>> +		RW
>> +
>>   What:		/sys/class/hwmon/hwmonX/pwmY_auto_channels_temp
>>   Description:
>>   		Select which temperature channels affect this PWM output in
>> diff --git a/Documentation/hwmon/sysfs-interface.rst b/Documentation/hwmon/sysfs-interface.rst
>> index 209626fb2405..17fcec03d3c5 100644
>> --- a/Documentation/hwmon/sysfs-interface.rst
>> +++ b/Documentation/hwmon/sysfs-interface.rst
>> @@ -209,6 +209,9 @@ PWM
>>   `pwm[1-*]_freq`
>>   		Base PWM frequency in Hz.
>>
>> +`pwm[1-*]_fan_channel`
>> +                Select which fan channel is controlled by this PWM output.
>> +
>>   `pwm[1-*]_auto_channels_temp`
>>   		Select which temperature channels affect this PWM output in
>>   		auto mode.
>> diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
>> index 2e2cd79d89eb..8c2d7574c461 100644
>> --- a/drivers/hwmon/hwmon.c
>> +++ b/drivers/hwmon/hwmon.c
>> @@ -604,6 +604,7 @@ static const char * const hwmon_pwm_attr_templates[] = {
>>   	[hwmon_pwm_enable] = "pwm%d_enable",
>>   	[hwmon_pwm_mode] = "pwm%d_mode",
>>   	[hwmon_pwm_freq] = "pwm%d_freq",
>> +	[hwmon_pwm_fan_channel] = "pwm%d_fan_channel",
>>   	[hwmon_pwm_auto_channels_temp] = "pwm%d_auto_channels_temp",
>>   };
>>
>> diff --git a/include/linux/hwmon.h b/include/linux/hwmon.h
>> index 14325f93c6b2..9d40cc1e520f 100644
>> --- a/include/linux/hwmon.h
>> +++ b/include/linux/hwmon.h
>> @@ -332,6 +332,7 @@ enum hwmon_pwm_attributes {
>>   	hwmon_pwm_enable,
>>   	hwmon_pwm_mode,
>>   	hwmon_pwm_freq,
>> +	hwmon_pwm_fan_channel,
>>   	hwmon_pwm_auto_channels_temp,
>>   };
>>
>> @@ -339,6 +340,7 @@ enum hwmon_pwm_attributes {
>>   #define HWMON_PWM_ENABLE		BIT(hwmon_pwm_enable)
>>   #define HWMON_PWM_MODE			BIT(hwmon_pwm_mode)
>>   #define HWMON_PWM_FREQ			BIT(hwmon_pwm_freq)
>> +#define HWMON_PWM_FAN_CHANNEL		BIT(hwmon_pwm_fan_channel)
>>   #define HWMON_PWM_AUTO_CHANNELS_TEMP	BIT(hwmon_pwm_auto_channels_temp)
>>
>>   enum hwmon_intrusion_attributes {
>> --
>> 2.30.2
>>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ