History log of /openbmc/phosphor-pid-control/pid/fancontroller.cpp (Results 1 – 25 of 31)
Revision Date Author Comments
# bd63bcac 16-Aug-2024 Patrick Williams <patrick@stwcx.xyz>

clang-format: re-format for clang-18

clang-format-18 isn't compatible with the clang-format-17 output, so we
need to reformat the code with the latest version. The way clang-18
handles lambda forma

clang-format: re-format for clang-18

clang-format-18 isn't compatible with the clang-format-17 output, so we
need to reformat the code with the latest version. The way clang-18
handles lambda formatting also changed, so we have made changes to the
organization default style format to better handle lambda formatting.

See I5e08687e696dd240402a2780158664b7113def0e for updated style.
See Iea0776aaa7edd483fa395e23de25ebf5a6288f71 for clang-18 enablement.

Change-Id: I0f105c3310e87172c65a09a8787a2db5a4041cc0
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>

show more ...


# a7bbd458 27-Feb-2024 Zhikui Ren <zhikui.ren@intel.com>

remove duplicated header include

This change fixes ci build error.

Change-Id: I613e90f107146bf35d34d72d4a8e78054176a582
Signed-off-by: Zhikui Ren <zhikui.ren@intel.com>


# 9f1532dd 21-Dec-2023 Jonico Eustaquio <jonico.eustaquio@fii-na.com>

Include config.h for strict-failsafe-pwm option

The strict-failsafe-pwm meson option definition was not be seeing by
the #ifdefs since the config.h that meson creates that defines the
option is not

Include config.h for strict-failsafe-pwm option

The strict-failsafe-pwm meson option definition was not be seeing by
the #ifdefs since the config.h that meson creates that defines the
option is not included. The strict-failsafe-pwm option can now be
enabled by adding EXTRA_OEMESON:append = " -Dstrict-failsafe-pwm=true"
to the bbappend.

Change-Id: Ic4047bcd0e4599d14ab84744ffe22d23faa994dd
Signed-off-by: Jonico Eustaquio <jonico.eustaquio@fii-na.com>

show more ...


# 7e63502a 13-Oct-2023 Patrick Rudolph <patrick.rudolph@9elements.com>

pid/fancontroller: Set failsafe PWM in destructor

Introduce a new feature that's guarded by a new meson option
'offline-failsafe-pwm':

After the FanController object was destroyed it can no longer

pid/fancontroller: Set failsafe PWM in destructor

Introduce a new feature that's guarded by a new meson option
'offline-failsafe-pwm':

After the FanController object was destroyed it can no longer regulate
the fans. To prevent system failure set all fans to the FailSafePercent
defined in the configuration.

In addition to rebuilding configuration it also allows to keep the fans
in FailSafe mode as long as the phosphor-pid-control.service is stopped
or the system reboots. However this change doesn't cover the case of
a program crash where the destructor won't be executed. Abnormal program
termination must be handled by systemd and it out of scope of this
change.

Tested: 'systemctl stop phosphor-pid-control.service' and see the fans
ramp up to FailSafePercent.

Change-Id: I81262b07fd4c1212efc1a4ba4635bde8bc7b5215
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>

show more ...


# 9366089a 13-Oct-2023 Patrick Rudolph <patrick.rudolph@9elements.com>

fancontroller: Add missing config.h

Include config.h to satisfy #ifdef used in those files.

Change-Id: I0f6a3aa750abdf7b7c263d05f0551ee481b98d51
Signed-off-by: Patrick Rudolph <patrick.rudolph@9ele

fancontroller: Add missing config.h

Include config.h to satisfy #ifdef used in those files.

Change-Id: I0f6a3aa750abdf7b7c263d05f0551ee481b98d51
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>

show more ...


# df597657 19-Dec-2023 Josh Lehan <krellan@google.com>

Changing wording of failsafe transition messages

Cleaning up and unifying the logic around displaying diagnostic
messages when failsafe transitions happen, so that the true case and
the false case r

Changing wording of failsafe transition messages

Cleaning up and unifying the logic around displaying diagnostic
messages when failsafe transitions happen, so that the true case and
the false case run the same code path. This makes the messaging more
standard and coherent from the user point of view.

This will cause one additional logging message to appear during
startup. This is intentional: when the process is started up, this
counts as a state transition that is worth logging about, as it goes
from uncontrolled state (essentially manual mode) to either failsafe
mode or normal mode.

Tested: Installed and observed messages logged during startup

Change-Id: Ib80cc342611a78199410564f76a2c65b590ef511
Signed-off-by: Josh Lehan <krellan@google.com>

show more ...


# 3f0f7bc3 13-Feb-2023 Josh Lehan <krellan@google.com>

Add MissingIsAcceptable feature to avoid failsafe

This is a partial implementation of the ideas here:
https://github.com/openbmc/phosphor-pid-control/issues/31

A new configuration item is supported

Add MissingIsAcceptable feature to avoid failsafe

This is a partial implementation of the ideas here:
https://github.com/openbmc/phosphor-pid-control/issues/31

A new configuration item is supported in the PID object, named
"MissingIsAcceptable" (for D-Bus) or "missingIsAcceptable" (for the old
config.json). The value is an array of strings. If these strings match
sensor names, those sensors will be flagged as "missing is acceptable",
that is, they can go missing and the zone will not be thrown into
failsafe mode as a result.

This can be handy for sensors that are not always available on your
particular machine. It is independent of the existing Availability
interface, because the decision to go into failsafe mode or not is a
property of the PID loop, not of the sensor itself.

If a PID loop consists of all sensors that are missing, the output
will be deemed to be the setpoint, thus essentially making the PID
loop a no-op. Now initializing sensor values to NaN, not zero, as zero
is not a good default if PID loop is margin, undoing a bug I made:
https://gerrit.openbmc.org/c/openbmc/phosphor-pid-control/+/38228

Tested: It worked for me. Also, added a unit test case.

Change-Id: Idc7978ab06fcc9ed8c6c9df9483101376e5df4d1
Signed-off-by: Josh Lehan <krellan@google.com>

show more ...


# d38ae279 13-Nov-2020 Josh Lehan <krellan@google.com>

FanController: Use raw RPM as input to fan PID loop

The fan PID loop was wrongly using normalized RPM as input, instead of
raw RPM. This meant that the input RPM was between 0.0 and 1.0, the
wrong u

FanController: Use raw RPM as input to fan PID loop

The fan PID loop was wrongly using normalized RPM as input, instead of
raw RPM. This meant that the input RPM was between 0.0 and 1.0, the
wrong units, an unusable low value for RPM.

What's more, the inputProc() function used int64_t instead of double,
for an unknown reason, as the input and output of this function is
double. This integer truncation caused the normalized RPM to always be
zero, making this bug harder to notice.

Cleaned up the inputProc() function to always use double, and
correctly use the raw RPM.

I am really glad I had earlier added a feature to maintain the raw
unscaled value, along with the normalized scaled value, in the cache!
https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-pid-control/+/36697

This made it easy to recover the raw value. Otherwise, this bug would
have been much harder to fix.

Tested: The RPM input values now use same units as the setpoint,
restoring proper fan PID loop operation, as logged in the new PID core
debugging feature here:
https://gerrit.openbmc-project.xyz/c/openbmc/phosphor-pid-control/+/38087

Signed-off-by: Josh Lehan <krellan@google.com>
Change-Id: I4607d9ebee57cea04b8f83d658913e24200a6428

show more ...


# c51ba919 12-Oct-2022 Bonnie Lo <Bonnie_Lo@wiwynn.com>

Add debug mode

Description:
1. Could enable debug mode by adding file: /etc/thermal.d/debugging.
$ mkdir /etc/thermal.d
$ touch /etc/thermal.d/debugging
$ systemctl resta

Add debug mode

Description:
1. Could enable debug mode by adding file: /etc/thermal.d/debugging.
$ mkdir /etc/thermal.d
$ touch /etc/thermal.d/debugging
$ systemctl restart phosphor-pid-control

2. Could record fans output PWM, chosen temperature, PID/stepwise output PWM in debug mode.

Design:
1. Create debugging file and restart service to enable debug mode.

2. Check if debug mode is enabled to output fans output PWM, chosen temperature,
PID/stepwise output PWM, and so on.

Test Case:
1. Enable debug mode and check logs: pass

Change-Id: I8527ebcb81e723298ba7e786b4501f986ebd439e
Signed-off-by: Bonnie Lo <Bonnie_Lo@wiwynn.com>

show more ...


# b300575e 22-Feb-2022 Josh Lehan <krellan@google.com>

pid/zone: Adding unscaled to cache and logging

The "ReadReturn" structure, and the cache within DbusPidZone, have
been widened, to hold both the scaled and the original unscaled values
at the same t

pid/zone: Adding unscaled to cache and logging

The "ReadReturn" structure, and the cache within DbusPidZone, have
been widened, to hold both the scaled and the original unscaled values
at the same time. This allows logging to show both at once, and also
clears up confusion/bugs resulting from storing one or the other and
losing track of which was which.

Compatibility setValue() and getCachedValue() functions still
retained, so this will not break other sensors. These functions still
only take a single argument/return, which will be used for both value
and unscaled, indicating scaling is unknown or irrelevant to this
sensor.

Also, the PWM output of the PID loop appears in the log file,
conveniently right alongside the RPM input of the PID loop.

An output cache has been added to the zone interface, and, unlike the
input cache, use of it is optional. It is only to help populate the
logging, so subclasses are free to ignore it if they want.

Tested: In the logging files, I can see both PWM and RPM, and they are
consistent, showing how the PID loop is trying to update the PWM to
target the desired RPM.

Example: Here's /tmp/zone_0.log on my system
epoch_ms,setpt,fan0_tach,fan0_tach_raw,fan0_tach_pwm,fan0_tach_pwm_raw,bmcmargin_zone0,bmcmargin_zone0_raw,thermal_zone0,thermal_zone0_raw,failsafe
3097918,3818.42,0.748267,11224,0,0,0.724753,56.812,0.745098,62,0
3098022,3818.42,0.748267,11224,0.266666,67,0.724753,56.812,0.745098,62,0
3098132,3818.42,0.748267,11224,0.266666,67,0.724753,56.812,0.745098,62,0

Here's what we can now learn:
The desired setpoint is 3818 RPM.
The fan is at 74.8% of scale, which is 11224 RPM.
The written PWM, after the first PID loop pass, is a raw value of 67,
which is 26.6% of scale.
The first margin temperature is 56.8 degrees of margin, which is 72.4%
of scale.
The second margin temperature is 62 degrees of margin, which is 74.5%
of scale.
This zone is not in failsafe mode.
As you can see, this will be rather useful for PID loop tuning.

Signed-off-by: Josh Lehan <krellan@google.com>
Change-Id: I972a4e4a3b787255f0dcafa10d4498ee58b682f0

show more ...


# bcdeb83c 15-Aug-2022 Brandon Kim <brandonkim@google.com>

Add --strict-failsafe-pwm compile flag

This build flag is used to set the fans strictly at the failsafe
percent when in failsafe mode, even when the calculated PWM is higher
than failsafe PWM. Witho

Add --strict-failsafe-pwm compile flag

This build flag is used to set the fans strictly at the failsafe
percent when in failsafe mode, even when the calculated PWM is higher
than failsafe PWM. Without this enabled, the PWM is calculated and set
to the calculated PWM the failsafe PWM, whichever is higher.

Added a unit test that can test this new build flag code path if the
compile flag is defined.

Tested:

Verified on an internal machine that by adding the following to the
bbappend:

EXTRA_OECONF:append = " --enable-strict-failsafe-pwm=yes"

With flag:
ipmitool sensor list
fan_pwm | 89.768

Without flag:
ipmitool sensor list
fan_pwm | 99.960

We can see that the fan pwm was limited to the failsafe percentage when
in failsafe mode with the flag. Without the flag, it ran at 100%

Bug-Id: openbmc/phosphor-pid-control#17
Signed-off-by: Brandon Kim <brandonkim@google.com>
Change-Id: I72a1e5aab8d3e5b0e3716f0b3720d704a6f05008

show more ...


# a4146eb1 01-Oct-2020 Josh Lehan <krellan@google.com>

pid/zone: Restore PWM when fans returned to auto

This makes use of the improved write() interface, to allow the
PID-loop-determined PWM to be restored, when the fan is returned to
automatic mode.

W

pid/zone: Restore PWM when fans returned to auto

This makes use of the improved write() interface, to allow the
PID-loop-determined PWM to be restored, when the fan is returned to
automatic mode.

Without this fix, a fan set to manual mode, then manually set to a
different speed, would not properly return to the correct speed, when
transitioning back to automatic from manual.

This patch also adds a stub to allow the caller to learn the raw PWM
value written as output, another useful write() interface improvement.
Although not the topic of this change, it is included here, to avoid
later patch conflicts.

Tested: I can now correctly toggle between automatic, and manual, fan
control. Upon resuming automatic control, after a few seconds, the fan
PWM is now properly restored, to what the PID loop wanted it to be at.

Signed-off-by: Josh Lehan <krellan@google.com>
Signed-off-by: Jason Ling <jasonling@google.com>
Change-Id: I46fc65d6b931755d51093ea475c64cf5e3e6bacb

show more ...


# ca791156 21-Sep-2020 Josh Lehan <krellan@google.com>

FanController/ThermalController: Clean up PID input math

Adding checking against floating-point oddities,
such as NAN, +INF, or -INF, appearing as input,
which would mess up the PID

FanController/ThermalController: Clean up PID input math

Adding checking against floating-point oddities,
such as NAN, +INF, or -INF, appearing as input,
which would mess up the PID loop math,
causing corrupt output.

If a fan or thermal input value is NAN, +INF, or -INF,
that value will be omitted from contributing to PID loop input.
If all values were omitted for that PID loop,
existing code already hardcodes a value of 0 for fan,
and I added similar code to also hardcode 0 for thermal.

It makes sense to use a placeholder value of 0 degrees of margin,
because this will make the fans spin fast,
if for some reason the zone is not already in failsafe mode by now.
Note that negative values are not allowed for fan,
but they are allowed for thermal.

Tested: Works for me, and PID loops no longer output garbage
when debugging a sensor malfunction while in tuning mode,
making tuning mode much more usable. If not in tuning mode,
the normal failsafe feature would have kicked in,
masking this garbage from appearing in the output anyway.

Signed-off-by: Josh Lehan <krellan@google.com>
Change-Id: I7aee812ebaeff209f84cef0db28973696f782ef9

show more ...


# a076487a 08-Aug-2020 Patrick Venture <venture@google.com>

sensors/zones: place in namespace and cleanup

Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I527dbc8477a232945f696227a7b0b2adbee45175


# f7a2dd5c 16-Jul-2019 Patrick Venture <venture@google.com>

rename away from RPM

The SetPoint output from a thermal PID is likely RPM, and that value is
then fed into a fan controller PID as the set-point (unit: RPM). This
does not have to b

rename away from RPM

The SetPoint output from a thermal PID is likely RPM, and that value is
then fed into a fan controller PID as the set-point (unit: RPM). This
does not have to be RPM, however. Continue renaming variables and
methods to remove the explicit unit-naming.

Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I570dee0c688338f9a458cac7123314717bee2b42

show more ...


# de79ee05 08-May-2019 Patrick Venture <venture@google.com>

split parameters for logging and tuning

add a flag to enable/disable tuning: default off
add an option for specifying a folder for outputting logs.

Closes: #10
Signed-off-by

split parameters for logging and tuning

add a flag to enable/disable tuning: default off
add an option for specifying a folder for outputting logs.

Closes: #10
Signed-off-by: Patrick Venture <venture@google.com>
Change-Id: I43864768f1dee8672f13288d3cf5a0c87c373aed

show more ...


# c32e3fc5 28-Feb-2019 Patrick Venture <venture@google.com>

add tuning enable variable

Add a variable that when set, enables tuning logging. This variable is
set to false.

Tuning can be enabled via "-t" "--tuning" on the command line.

add tuning enable variable

Add a variable that when set, enables tuning logging. This variable is
set to false.

Tuning can be enabled via "-t" "--tuning" on the command line.
With a parameter is the path where to write the logging information.

Change-Id: I6eb8035d56cc3301face21e9375c02fc9fcc5b31
Signed-off-by: Patrick Venture <venture@google.com>

show more ...


# dca2d484 15-Feb-2019 James Feist <james.feist@linux.intel.com>

DBusConfiguration: Fix scaling

Revert the removal of the /100 because that caused
90% to be passed as 90 instead of .9. To counter-act
this multiply the stepwise controller by 100 so

DBusConfiguration: Fix scaling

Revert the removal of the /100 because that caused
90% to be passed as 90 instead of .9. To counter-act
this multiply the stepwise controller by 100 so that
setting 50 is 50%.

Tested-by: Used sensor override to make stepwise jump
threshold and got desired pwm result.

Change-Id: I629bf0d4b0b3bc77660c09fccae82b1bdac4c578

show more ...


# c8bd1d1e 04-Feb-2019 James Feist <james.feist@linux.intel.com>

[dbus-configuration] Back out divide by 100

In the entity-manager configuration files having a
outlimitmax of 10000 is confusing as this looks like
a tach reading, but is actually 10

[dbus-configuration] Back out divide by 100

In the entity-manager configuration files having a
outlimitmax of 10000 is confusing as this looks like
a tach reading, but is actually 100 percent * 100.
Back this out when dealing with dbusconfiguration.

Change-Id: I13609573fcf1c9da50afd270ea9aad0411b5768b
Signed-off-by: James Feist <james.feist@linux.intel.com>

show more ...


# 5f59c0fd 11-Nov-2018 Patrick Venture <venture@google.com>

Move all floats to doubles

The code was developed initially around a pid loop implemented using
floats. Therefore, the code was converting back and forth between
double for sensor v

Move all floats to doubles

The code was developed initially around a pid loop implemented using
floats. Therefore, the code was converting back and forth between
double for sensor values as inputs and outputs from this PID loop.

Change-Id: I2d2919e1165103040729c9f16bb84fde3dd6b81b
Signed-off-by: Patrick Venture <venture@google.com>

show more ...


# 7af157b1 30-Oct-2018 Patrick Venture <venture@google.com>

style: function names should be lower camel

Fix function names to be lower camel.

Change-Id: I145e1f4c03d7740bc1525dcffbdce2f78fd61075
Signed-off-by: Patrick Venture <venture@go

style: function names should be lower camel

Fix function names to be lower camel.

Change-Id: I145e1f4c03d7740bc1525dcffbdce2f78fd61075
Signed-off-by: Patrick Venture <venture@google.com>

show more ...


# 563a356f 30-Oct-2018 Patrick Venture <venture@google.com>

style: member functions should be lower camel

Rename member functions to be lower camel instead of snake case.

Change-Id: Ib227fd3dadb6d9607290277205223a4324cd4ce5
Signed-off-by

style: member functions should be lower camel

Rename member functions to be lower camel instead of snake case.

Change-Id: Ib227fd3dadb6d9607290277205223a4324cd4ce5
Signed-off-by: Patrick Venture <venture@google.com>

show more ...


# f77d5a57 23-Oct-2018 Patrick Venture <venture@google.com>

cleanup: move from copy and pointer to just const reference

Originally code passed the object by value, and then later by pointer to
that copy. Convert the code to be more performant by

cleanup: move from copy and pointer to just const reference

Originally code passed the object by value, and then later by pointer to
that copy. Convert the code to be more performant by using a const
reference at all layers of access for this object.

Change-Id: Icdf0dfdb54d8adc29af4d05d841533626a484921
Signed-off-by: Patrick Venture <venture@google.com>

show more ...


# 4a2dc4d8 23-Oct-2018 Patrick Venture <venture@google.com>

cleanup: apply constness to read-only iterators

Apply const to read-only iterators to indicate intent more clearly.

Change-Id: Ic14304c69361da203d3d3a900180bd54346acc87
Signed-o

cleanup: apply constness to read-only iterators

Apply const to read-only iterators to indicate intent more clearly.

Change-Id: Ic14304c69361da203d3d3a900180bd54346acc87
Signed-off-by: Patrick Venture <venture@google.com>

show more ...


# df766f25 13-Oct-2018 Patrick Venture <venture@google.com>

cleanup: reduce scope of variables

Various things caught by cppcheck that are non-critical.

Change-Id: I495453c84bc15788b85036a163ee36b0ac601fa1
Signed-off-by: Patrick Venture <

cleanup: reduce scope of variables

Various things caught by cppcheck that are non-critical.

Change-Id: I495453c84bc15788b85036a163ee36b0ac601fa1
Signed-off-by: Patrick Venture <venture@google.com>

show more ...


12