summaryrefslogtreecommitdiffstats
path: root/control/zone.cpp
Commit message (Collapse)AuthorAgeFilesLines
* control: Add interface when not in service cacheMatthew Barth2018-11-091-2/+7
| | | | | | | | | | | | | | | | | | When a service is cached, each interface it hosts is added to a list. In the case where an object path given to fan control is never found, a service lookup is performed on this path causing its given interface to be added. This fixes that interface from continuously being added in the case that the object path is attempted to be accessed continuously from dbus. Resolves openbmc/phosphor-fan-presence#12 Tested: Added & removed events containing object paths that dont exist, interface list remains the same size. Change-Id: Id034e7829566979c196cb9901cbea287ddab78d4 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Rebase correction (timerPos -> timerConfPos)Matthew Barth2018-11-061-1/+1
| | | | | Change-Id: I5ab5adcc22f044b3cf0955082061c67f2a281307 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* control/zone: Use const references when iteratingWilliam A. Kennington III2018-11-061-1/+1
| | | | | | | | | | | We don't want to copy the object out of the container we are iterating over. Tested: Built and run through unit tests. Change-Id: I68b041f98e1c6a6a9dbc59448b629e1d22ba62c9 Signed-off-by: William A. Kennington III <wak@google.com>
* Remove all signals when an event is removedMatthew Barth2018-11-061-37/+53
| | | | | | | | | | | | | | Each event could have multiple signals associated and when the event is removed, all of those signals should also be removed. This ensures no dangling signals remain after an event is removed from be processed by fan control Tested: The total number of signals subscribed are reduced by the same number of signals of a removed event Change-Id: I651f70dbe6aed9c7eef06aff4eac9eae7ad89d77 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Prefer bind over method call in lambdaWilliam A. Kennington III2018-11-051-2/+3
| | | | | | | | | | | | | This reduces a layer of indirection since the function can be called directly instead of indirectly accessing it with the lambda. It also makes the instantiation more flexible since it can match callbacks with extra arguments. Tested: Built and run through unit tests. Change-Id: I5317203fa70c027c5e774ed6192952058e35bd81 Signed-off-by: William A. Kennington III <wak@google.com>
* control/zone: Reference instead of copying timer dataWilliam A. Kennington III2018-11-051-2/+6
| | | | | | | | Tested: Built and ran through unit tests. Change-Id: I9a98d9a3eaee47885b18b642ffd01a38a864dd02 Signed-off-by: William A. Kennington III <wak@google.com>
* control/zone: Refactor addTimerWilliam A. Kennington III2018-11-051-23/+26
| | | | | | | | | | | | Anything adding a timer uses roughly the same process of building the event data and timer from the event group, actions, and timer config. We can adjust the method to do this for all callers. Tested: Builds and passes unit tests. Change-Id: I4013ff2f7bff65095a6e1db7075bc013da374f51 Signed-off-by: William A. Kennington III <wak@google.com>
* control: Rename Timer -> TimerConfWilliam A. Kennington III2018-10-311-4/+4
| | | | | | | | | | | | It is confusing to read some of the type definitions that deal with timers when Timer could mean a timer instantiation or a set of timer configuration parameters. This change disambiguates the two types. Tested: Built and run through unit tests. Change-Id: I9dd6b47886747d56a86b6a50eb9a74a331d0a1fe Signed-off-by: William A. Kennington III <wak@google.com>
* control: Alias TimerType locallyWilliam A. Kennington III2018-10-311-4/+2
| | | | | | | | | | | This is needed for a future commit that removes the local phosphor::util::Timer implementation. Tested: Built and run through unit tests. Change-Id: I8ea3399fec8761055d4a0d94fb9ea91fd34040ea Signed-off-by: William A. Kennington III <wak@google.com>
* Switch sd_event loops to sdeventplusWilliam A. Kennington III2018-10-291-5/+5
| | | | | | | | | This change is mostly focused around plumbing the sdeventplus::Event object everywhere and using the member functions provided for the event. No migration to the timer utility is performed yet. Change-Id: I912ab82bc081239d3b7c3cf7c5caca6742ef9c87 Signed-off-by: William A. Kennington III <wak@google.com>
* Throw custom exceptions on D-Bus method failuresMatt Spinler2018-05-091-1/+1
| | | | | | | | | | | | | | | | | | | | | All 3 fan applications - control, monitor, and presence have cases where it is expected that a getProperty call may fail because a sensor is missing. While the applications already handle this, the InternalFailure exception that was being thrown by the underlying call generates log entries that make it look like something bad happened. The custom exceptions now being thrown do not log anything on creation, but store all of the failing information so that any callers could still log the info if they wanted to. Tested: Boot a water cooled Witherspoon and see the fan presence and monitor applications not look like they are failing. Boot a system without the fan hwmon running, and see fan-control-init still show the fails. Change-Id: Ifd8ad6e3deb492bbaf33f12c7258125dce1e5ea8 Signed-off-by: Matt Spinler <spinler@us.ibm.com>
* Minimize service name mapper lookupsMatthew Barth2018-03-121-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | Retrieve the service names from the cached dataset within the zone for a path and interface, updating the cache when not found. This is used when initializing property values and service name owners. Additional performance enhancements to use `GetSubTree` prior to processing a set speed event will be included under openbmc/openbmc#2911. This will keep unnecessary `GetSubTree` lookups from occurring for paths/interfaces that don't exist to further improve upon initializing properties fan control is defined to use. Tested: First path updates service name cache for all paths sharing the same interface First missing interface on a path updates service name cache for all paths sharing that interface Verify mapper lookups for X number of paths sharing the same interface is reduced to (X-(X-1)) NameOwnerChanged events read/update the same set of service name cache Change-Id: Ia235b36ba5ae8cda38342d7521f3d87080c2970a Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Cache service names for paths and interfacesMatthew Barth2018-03-121-0/+87
| | | | | | | | | | | | | | | | To lookup a service name for a given path and interface, use GetSubTree to retrieve all the service names from the root path for the interface and add each entry to a cached dataset. Tested: Check that a missing interface's service is added Check that a missing path that exists has its service added Inspect all missing paths for an interface are added Inspect missing interfaces are added to existing service Returned service name matches the service for a path/interface Change-Id: I6db05479e825350198896b2e237882f7ebc58d51 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Decreases allowed based on all groupsMatthew Barth2017-12-141-3/+11
| | | | | | | | | | | | | | | For speed decreases to occur, all sensor groups involved with setting a net decrease delta must be below their given t-control low values for the associated zone. This handles the case where one or more sensor groups' temperatures stabilize above their t-control low value, but one or more other sensor groups' temperatures are below their t-control low value which would result in speed decrease requests that could eventually lead to fan speed oscillations. Resolves openbmc/openbmc#2710 Change-Id: I382de5d3f9c3e631a332d49dfcb06e705ff6fc17 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Use Ceiling speed as request baseMatthew Barth2017-12-111-0/+5
| | | | | | | | | When determining the request base speed for speed decreases, the current ceiling speed should be used when the request base speed is above the ceiling. Change-Id: Iefc2f1669b853e099fbda15dc8c8983f5f1f269a Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Use in place init of event dataMatthew Barth2017-11-171-10/+4
| | | | | Change-Id: Ia56acbeaa89423060e65e50eff8accffec5a4631 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Remove empty service nameMatthew Barth2017-11-171-1/+28
| | | | | | | | | | Before refreshing the service names and states for a group, the empty service name should be removed if it exists. An empty service name may exist where upon startup, a particular service was not found for a member or members of a group. Change-Id: I15d224231bb9db0823866393ec1776f793a3c126 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Refresh service states for a groupMatthew Barth2017-11-171-0/+30
| | | | | | | | | | | Prior to an action resulting from missing service owners, all of the services for a group should be refreshed to ensure they are in the most up-to-date state. Ensuring the service states are current allows the action to be correctly taken since owners of services could change at anytime. Change-Id: I59c59c6fcf456fa9c0a733d6406c90ea11f6e2b2 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Init zone target speed to current target speedMatthew Barth2017-11-171-0/+5
| | | | | | | | | | | | | | Whenever fan control (control mode) is started, the target speed for each zone should be initialized to the currently set target speed. In the case where a watchdog has triggered the fans to full speed and the target speed does not reflect this, the proper set of set speed events should be configured. In this case, an event could be defined to use the current tach feedback to adjust the target speed prior to account for the real state of the fan speeds. Change-Id: I538644ffc83a6e01469174304d393c889038d066 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Set floor to default on missing owner actionMatthew Barth2017-11-171-4/+12
| | | | | | | | | | | | | | An action to set the fan floor speed to the defined default fan floor speed when any services associated to a given group of sensors have terminated. Once those services are functional and providing the sensors, the fan floor is allowed to be set normally again. i.e.) For fan floor speeds based on an ambient sensor, if the service providing the ambient temperature value from the sensor terminates, the default floor for the zone is used as the fan floor speed. Change-Id: I2d58cc9b31051e6b8e5e798c0a736f58f5efe5b1 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Add timer event managementMatthew Barth2017-11-171-1/+44
| | | | | | | | | | Events defined to have timers require the ability to find a timer, add a timer to the event, and removing a timer event entirely. These event timers are intended to allow actions based on the event to be delayed or recurring based on the timer defined. Change-Id: Ieaf26f031c5e5aac9472e92354bfb76392642cb4 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Add timer type for set speed event timersMatthew Barth2017-11-171-1/+1
| | | | | | | | This is the first step towards allowing timer driven and/or wrapped actions where the timer interval and type will be defined by the user. Change-Id: If008fda5a2b73117e869f93223e0bfe61290f858 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Set/update a service name owner for a groupMatthew Barth2017-11-171-0/+30
| | | | | | | | | Adds a service name associated with a group when the group or given service name is not found within the map of services otherwise updates the service name owner associated with the group. Change-Id: I602ddaa7e06e354e01ea70d6c5c0a45e74a14e99 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Update event initializationMatthew Barth2017-11-171-63/+23
| | | | | | | | | | | | | | | | Using a null dbus message to the event signal will perform the necessary steps to initialize the event parameters using the given signal handler's function directly. i.e.) In the case for subscribing to PropertiesChanged signals, initially the given property must be read. When the PropertiesChanged signal struct is given a null message, it finds the property, reads the value, and then can perform the given signal handler function directly. This produces the same functional path as receiving a PropertiesChanged signal containing the property value within the message. Change-Id: I35575cfff66eb0305156be786cb1f5536d42bb1c Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Generate selected match strings and signalsMatthew Barth2017-11-071-4/+4
| | | | | | | | | The available matches and their associated signals are now listed within the events yaml and can be added to the list of matches to register for per event. Change-Id: I65f657038afe7c68a421adb4820ea09e275be06d Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Use speed request base in inc/dec speed changesMatthew Barth2017-09-261-2/+2
| | | | | | | | | For increase and decrease speed changes, the new target speed is calculated from either a set speed request base value or the current target speed by default. Change-Id: Iad1411437a9945af0b9ae85649d487e36586ef2a Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Support a list of actions for a set speed eventMatthew Barth2017-09-181-19/+53
| | | | | | | | | | Each set speed event will contain a list of one-to-many actions to perform for the given event group's property. This reduces the amount of code generated and properly handles property changed events against the group. Change-Id: If2b8c0d0b8ecf6e1c974c43d96e1c6e9e952022b Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Create informational logs for properties not foundMatthew Barth2017-08-221-6/+7
| | | | | | | | | | | Fan control is allowed to have properties not be found, so log these as informational for users. If the property is not found, then any set speed events related to that property should handle it appropriately. Resolves openbmc/openbmc#2188 Change-Id: I7c9e5fc8a3291d19ab4b1853af340643d3fa67a2 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Updates enabling zone active fan controlMatthew Barth2017-08-161-13/+30
| | | | | | | | | | | | | | | A zone is actively controlling its fan speeds when all groups subscribed to allow active control are set to true. The zone keeps a list of these groups and their active allow state, if at anytime an action (or precondition) sets a group's active state to false, any dynamic set speed requests do not occur. Only requests to set the zone's fans to full speed is allowed. Related to this, the zone's target speed should only be updated when a requested speed is successfully set. Change-Id: Iec6f15346fee5a6c6046d5b00e949e46aef400b9 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Add timer option to run set speed event actionsMatthew Barth2017-08-161-1/+29
| | | | | | | | | | | For groups within set speed events where the property values of the group may not signal its action to occur, an optional timer may be added to the event. This timer is configured as a repeating timer on the interval provided where upon timer expiration, the event's action is run. Change-Id: I4cbe8a0ab1b734bfc7828706a6515af7f6d78b52 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Remove set speed eventMatthew Barth2017-08-071-10/+40
| | | | | | | | | Allows the complete removal of a set speed event from the zone. This is done when any precondition defined for the event to be active is not met any longer. Change-Id: Idbec357f76f0fd7db9107e8c9d3e00461872c528 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Add precondition that checks property statesMatthew Barth2017-08-071-5/+16
| | | | | | | | | | The property state check precondition validates that each given property matches the defined value. When all the precondition groups' property states match, the given set speed event is initialized and activated allowing the zone speeds to be active controlled. Change-Id: Ic16a0e1fc584c6fa695e354fa80fb1993002ffc7 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Initial updates to support preconditionsMatthew Barth2017-08-041-34/+34
| | | | | | | | | | | | Any defined preconditions for a set speed event must be satisfied prior to configuring the event parameters for fan control. These preconditions will accept a list of group entries that include the value the group's property must be to have the precondition met for that group. Once all preconditions are met, the set speed event will be initialized and become active. Change-Id: Ia5555be55c5937c891af527bea63da1546655b2f Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Add increase & decrease timer values in secondsMatthew Barth2017-07-061-5/+5
| | | | | | | | | | | | | | | | | Support setting the increase delay time(in seconds) for each zone from the zone yaml file. Speed increases use a delay type timer where the amount of time given delays additional increase requests from happening until the fans within the zone reach the highest net increase in speeds. Support setting the decrease interval time(in seconds) for each zone from the zone yaml file. Since decreasing is done on an interval, a decrease interval time of zero disables the decrease interval timer causing no decreases in speed to occur. Speed decreases use an interval type timer to decrease the fan speeds within the zone when no speed increase requests exist on the given time interval. Change-Id: I88334a313b6e2820b768fa7e3f1cb65887f29258 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Set target speed according to floor speed changeMatthew Barth2017-07-061-5/+10
| | | | | | | | When the floor speed updates, a request to increase the target speed should be made when the target is now below the floor speed. Change-Id: Ib622bc717a952ef0c0703cbff40a4dc14b213416 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Timer for fan speed increasesMatthew Barth2017-07-061-7/+19
| | | | | | | | | | | | | A oneshot timer is started on each target speed increase where the amount of time configured is how long the fans within the zone are allowed to reach the new target speed before additional speed increase requests will be processed. Any speed increase request deltas that are above the current speed increase delta being processed as the new target speed will cause the timer to stop and the difference between the deltas are added onto the target speed. Change-Id: I064941c4e12c3e44be90880d6f32c6fbcf7ae32d Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Move event init steps at startup to functionsMatthew Barth2017-07-061-47/+49
| | | | | Change-Id: I8a281935368cd705658d489c7c7af59b8dde7e4d Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Timer to decrease fan speedsMatthew Barth2017-07-061-4/+17
| | | | | | | | | Create a repeating timer for decreasing fan speeds where the fan speeds in the zone are decreased when the timer expires and a decrease speed request exists with no increase request present or active. Change-Id: I419592f6f50c0ed524f8bf3ebf183854ab5ef2ea Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Support speed decrease eventsMatthew Barth2017-07-061-5/+30
| | | | | | | | | | | | | | | | | A net decrease speed action determines the net decrease delta from each group member's property value and requests a speed decrease of that delta from the current target speed. From all the requests for a speed decrease on a zone, only the lowest net decrease is used from all the groups subscribed to decrease a zone's speed. The new target speed is only decreased when no increase requests exist and the resulting target is above the zone's floor speed, otherwise the floor speed is set as the new target. Resolves openbmc/openbmc#1626 Change-Id: Iaefa7b25c3f44691dd3ca4084bfddd3c1a504de9 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Process speed increase requestsMatthew Barth2017-07-061-5/+28
| | | | | | | | | | | Speed increases are made providing a target speed delta. The increase is made when the delta is higher than the current increase that may be occurring. When no increase is currently happening, the increase delta requested is accepted. All resulting target increases will not go above a defined ceiling speed. Change-Id: Ia19c71a023cf5b897d5ba92974ff98451f34d5a3 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Enable setting/adjusting fan ceiling speedMatthew Barth2017-06-281-1/+7
| | | | | | | | | | | | | | | | | Set the default ceiling to be what's given as full speed and adjust the ceiling speed based on an average of a given set of sensor values. The ceiling is chosen from a given map's key transition values. The map consists of key, value pairs where each key is the sensor value transition point and the value is the ceiling speed for when that transition occurs. The previous key value is needed to determine the direction in which to chose the appropriate ceiling speed allowing a buffer zone between ceiling changes if defined to. Resolves openbmc/openbmc#1628 Change-Id: I7c9c553b5d0c3219c51b563aec7dd5d5f090916b Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* phosphor-fan-presence elog error exception.Dinesh Chinari2017-06-281-2/+7
| | | | | | | | Implemented elog exception for phosphor fan presence, replacing runtime_errors. Change-Id: I70465060838b2cbaeadccf84ed5924e222ac59e3 Signed-off-by: Dinesh Chinari <chinari@us.ibm.com>
* Allow floor speed changes based on sensor valuesMatthew Barth2017-06-261-0/+5
| | | | | | | | | | Given a group of sensor values, the average of those sensor values will be used in selecting the floor speed for the zone. Each time the speed is set/updated, any speed requested lower than the current floor will be overwritten with the floor speed to not allow speeds below the floor. Change-Id: I4c8e8a2cd66892b9fdc2bc5643e907adddff51f8 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Add default floor speed supportMatthew Barth2017-06-261-1/+2
| | | | | Change-Id: Id2d3b362e79e7a8c2330181f68ae11e43f84e2fd Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Properties stored of different typesMatthew Barth2017-06-261-8/+5
| | | | | | | | Allow properties stored for processing events to be of types other than bool Change-Id: Ie1dde5aca562c9958bdff6fa3d1b19d3154b2c6d Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Add interface to uniquely identify propertiesMatthew Barth2017-06-261-0/+1
| | | | | | | | The interface is needed on the properties stored to uniquely identify each property used in events. Change-Id: Ia062f25514d7ed04ef1023a02eecad4738711ffb Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Use updated match methods for signal callbacksMatthew Barth2017-06-051-20/+9
| | | | | | | | Attach the event handler callback function to the match along with generating the match string using the new match methods Change-Id: I7595d65cbc615f29db60e2a65534ee5b635d6f96 Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Check initial event's group members' propertiesMatthew Barth2017-05-311-0/+52
| | | | | | | | On start of fan control, check the current event's group members' property states and envoke the defined action function on the results. Change-Id: I12509403328d90f85d67b393dbdd97d8710c83ef Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Add an active state for automatic fan controlMatthew Barth2017-05-311-0/+17
| | | | | | | | | | | | Each zone contains an active state that determines whether the automatic fan control algorithm is active and controlling the fan speeds dynamically or not. This will be used to determine if the fan speeds within the zone are set dynamically or rather held at another speed for a determined reason. Change-Id: I2f81de168c5f7d859b3ec917022c4749e1a28d4e Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
* Only setup set speed events when not init modeMatthew Barth2017-05-311-16/+23
| | | | | Change-Id: Ia6987295a3eb4e23b9d6ae13a383e440386572de Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
OpenPOWER on IntegriCloud