summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* watchdog: Log timer use during expirationHEADmasterWilliam A. Kennington III2019-04-181-5/+9
| | | | | Change-Id: Ie6dd1da92ffc225a313db208455ad24f4787a990 Signed-off-by: William A. Kennington III <wak@google.com>
* mainapp: Add an option for watching post codesWilliam A. Kennington III2019-04-051-0/+19
| | | | | | | | | | | | | | | | | | | | We have some machines that use an IPMI watchdog, but can sometimes take so long to reboot that the watchdog ends up tripping during the boot process. Unfortunately the boot firmware has no method of talking IPMI to pet the watchdog, but does emit post codes during the boot up process when it makes forward progress. This change adds a flag to instruct the watchdog that it should reset the TimeRemaining on the watchdog any time new post codes are seen from the host. Tested: Verified that post codes signals were received during the boot process and the watchdog TimeRemaining was updated accordingly. Change-Id: Ie0616f0fe4ee6601f9afdc4eba71f34968780794 Signed-off-by: William A. Kennington III <wak@google.com>
* build: install into bin instead of sbinPatrick Venture2019-03-282-2/+2
| | | | | | | Installs into bin instead of sbin per guidelines. Signed-off-by: Patrick Venture <venture@google.com> Change-Id: I9d2a01a37179f19ce272f13641217f9bdc4a1315
* Set expiredTimerUse when timer expiredYong Li2019-03-201-0/+2
| | | | | | | | | | | | | | | IPMI get watchdog command needs this expiredTImerUse property, For the Timer Use Expiration flags Tested: After timer expired, check this dbus property: busctl get-property "xyz.openbmc_project.Watchdog" \ "/xyz/openbmc_project/watchdog/host0" \ "xyz.openbmc_project.State.Watchdog" \ "ExpiredTimerUse" Signed-off-by: Yong Li <yong.b.li@linux.intel.com> Change-Id: I65f15cee5a436e9ffbf5e7094373386f4dfba6b3
* meson: Add alternate build systemWilliam A. Kennington III2019-03-063-0/+57
| | | | | | | | | | | | | | For now we will support both the autotools and meson build systems alongside each other, until support for meson is ready across the ecosystem. Tested: Run through build and unit tests that leverage the new build system and all of the tests pass and the install puts phosphor-watchdog in the correct location. Change-Id: I0454e763acc648ac76efd7728f6da498d9acf5dd Signed-off-by: William A. Kennington III <wak@google.com>
* build: pkg anti-pattern: use defaultsPatrick Venture2019-02-131-4/+4
| | | | | | | | Use the defaults in the pkg check where the default error message is sufficient to identify which package is missing. Change-Id: Ifdc864ea0d821ab4f1cff2be2a270317e25b801f Signed-off-by: Patrick Venture <venture@google.com>
* test/watchdog: Change the time quantum to 0.1s instead of 1sWilliam A. Kennington III2019-01-161-1/+1
| | | | | | | | | | | This improves the runtime of the test suite from 60s down to 6s or less. Tested: Run multiple times through the unit test suite without any flakiness. Change-Id: Ib7d97ed62b45501db9cf15dba01e33f8f9d07b5d Signed-off-by: William A. Kennington III <wak@google.com>
* test/watchdog: Define a time quantum typeWilliam A. Kennington III2019-01-162-43/+43
| | | | | | | | | | | | This will allow us to change the size of the windows of time we wait for watchdog events to happen. Right now this doesn't actually change any behavior it just makes it easier to tweak. Tested: Run through the build and unit test suite. Change-Id: If5b351574346426aff6499701164a3d5ebf9db7c Signed-off-by: William A. Kennington III <wak@google.com>
* test/watchdog: Don't use designated initializersWilliam A. Kennington III2019-01-161-14/+12
| | | | | | | | | | | | gcc supported this in c++ even though it was non-standard until c++2a is complete. This change removes designated initializers to make our tests compliant with std++17. Tested: Built and run through unit tests. Change-Id: I846394c633c0396518db6ed41682bbcf05b890c6 Signed-off-by: William A. Kennington III <wak@google.com>
* test: Rename watchdog_test to watchdogWilliam A. Kennington III2019-01-163-7/+8
| | | | | | | | Tested: Ran through build and unit test suite. Change-Id: I3a906ac26c43ac419eef8a98b20a498fe22f942b Signed-off-by: William A. Kennington III <wak@google.com>
* mainapp: Fix missing includesWilliam A. Kennington III2019-01-161-0/+4
| | | | | | | | Tested: Built and run through unit tests. Change-Id: Iede17218b421f2694135600683c7ad185b8766f4 Signed-off-by: William A. Kennington III <wak@google.com>
* Convert to standard CLI11 argument parserWilliam A. Kennington III2018-10-058-489/+113
| | | | | | | | | | | | This simplifies the argument parsing logic drastically and still provides the same error handling as before. Tested: Ran through unit test suite and manually verified that the command line functions as expected on a real BMC. Change-Id: Ic5d69adf5359f9f64f2ada17e6a8f3242ca03e25 Signed-off-by: William A. Kennington III <wak@google.com>
* Convert to using sdeventplusWilliam A. Kennington III2018-10-0512-492/+62
| | | | | | | | | | | | This gets rid of the ad-hoc timer class in favor of using the timer source built into sdeventplus. Tested: Unit tests pass and everything still builds. Manually verified the functionality is still in tact on a zaius machine. Change-Id: I90619f0fe5a9fdfcecd24a49de672c0c99dc95e9 Signed-off-by: William A. Kennington III <wak@google.com>
* watchdog: Handle systemd StartUnit errorsWilliam A. Kennington III2018-10-041-6/+24
| | | | | | | | | | | | | | | | | | | | | | | Currently, if systemd returns an error upon trying to StartUnit in the timeout of the watchdog the entire daemon will crash. Sep 28 22:59:09 phosphor-watchdog[2462]: Timer Expired Sep 28 22:59:09 phosphor-watchdog[2462]: watchdog: Timed out Sep 28 22:59:09 phosphor-watchdog[2462]: terminate called after throwing an instance of 'sdbusplus::exception::SdBusError' Sep 28 22:59:09 phosphor-watchdog[2462]: what(): sd_bus_call noreply: org.freedesktop.DBus.Error.InvalidArgs: Unit ho st-watchdog-reset.service is not loaded properly: Invalid argument. This patch fixes the behavior so we get something more like: Oct 04 07:12:14 phosphor-watchdog[10897]: watchdog: Timed out Oct 04 07:12:14 phosphor-watchdog[10897]: watchdog: Failed to start unit Oct 04 07:12:16 phosphor-watchdog[10897]: watchdog: disabled Tested: Ran with a bogus systemd target which used to throw errors which are now correctly handled without crashing. Change-Id: I4cf6ffded789e49d2329439165927cc227e2e79e Signed-off-by: William A. Kennington III <wak@google.com>
* test/watchdog: Test interval updateWilliam A. Kennington III2018-09-241-0/+27
| | | | | | | | | | | Adds a test to ensure that setting the interval on the watchdog affects subsequent resetTimeRemaining() calls. Tested: Ran through a unit test run Change-Id: Ibff14bbb40d5b93ffd5eaa5149f5cc9822e21d1e Signed-off-by: William A. Kennington III <wak@google.com>
* mainapp: Detect duplicate action targetsWilliam A. Kennington III2018-09-171-0/+6
| | | | | | | | | | | Tested: Passes the unit test suite and manually verified that the daemon works with a normal config on a zaius machine. Also verified that it produces an error if configured with multiple targets for a single action. Change-Id: I8fba74f5fdfeb22c465e27b478805dc1ca702cd3 Signed-off-by: William A. Kennington III <wak@google.com>
* Standardize Action -> Target Map TypeWilliam A. Kennington III2018-09-174-30/+31
| | | | | | | | | | | | | | | This change refactors the watchdog header to export the type of watchdog action to systemd target map, so it can be directly used by other files. This makes enumerating the map type more trivial. Also convert to an unordered_map instead of map since we don't need the ordering guarantees. Tested: Builds and tests still pass Change-Id: I77d315210ec27fde295589479c50d46dc5d1b32a Signed-off-by: William A. Kennington III <wak@google.com>
* Switch to C++17William A. Kennington III2018-09-133-9/+10
| | | | | | | | | | | | There is no harm in doing this since we are not a client library and all environments using this project should have c++17 compliant compilers at this point. Tested: Run through unit test suite. Change-Id: Iceae5375fd69b1929e1c4e2c6c297d131c61de68 Signed-off-by: William A. Kennington III <wak@google.com>
* add .clang-formatPatrick Venture2018-09-1114-499/+592
| | | | | Change-Id: I6d9ec8401dcd46781ea258bf8998faa2507fa91d Signed-off-by: Patrick Venture <venture@google.com>
* Add MAINTAINERS fileAndrew Jeffery2018-05-211-0/+46
| | | | | Change-Id: If0065b2bdab26d8f88ac7c6e10ab060cc50e0331 Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
* Implement ResetTimeRemaining MethodWilliam A. Kennington III2018-04-272-0/+16
| | | | | | | | | | A dbus method was recently added that supports performing the watchdog reset and enable in a single action to reduce the amount of the dbus congestion and improve reliability of watchdog resets. Support this method as the build would be broken otherwise. Change-Id: Iac00fc2cf15d4ba06fb67a98e2c29fc3c31b3272 Signed-off-by: William A. Kennington III <wak@google.com>
* Spelling fixesGunnar Mills2018-04-082-2/+2
| | | | | | | | | Spelling errors found using github.com/lucasdemarchi/codespell A tool to fix common misspellings. This tool is licensed under GNU General Public License, version 2. Change-Id: I645d241b93eee77222b9ce19147e4ed2c48e4ef1 Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
* Implement a flag to enable fallback alwaysWilliam A. Kennington III2018-03-075-3/+83
| | | | | | | | | On some machines we want our watchdog running as long as the phosphor-watchdog daemon is alive. This patch adds an option to enter fallback mode any time the watchdog expires or is set to be disabled. Change-Id: Ic96d2f15c761aeb4e25158c5bd861076cca6497d Signed-off-by: William A. Kennington III <wak@google.com>
* Implement a fallback watchdog optionWilliam A. Kennington III2018-03-075-18/+250
| | | | | | | | | | | | | | | | | | Sometimes our initial watchdog action is not enough to recover the host from the state it transitioned into. However, always using a more power form of power cycle is not desirable as we can lose useful CPU crash state. It is desirable in this case to have two levels of watchog timers. This patch implements the ability for the service to specify a fallback watchdog action and interval. After the initial watchdog timeout is encountered, the watchdog will be re-armed with the new parameters. Once the watchdog times out again it will execute the fallback action. Attempts to update the timeRemaining will reset the fallback just in case something is still alive. Change-Id: I69f4422c7e3963f02200815f3cef620af9e6cf8b Signed-off-by: William A. Kennington III <wak@google.com>
* watchdog: Rewrite timeoutHandler() to make disabling part of the timeoutWilliam A. Kennington III2018-03-074-54/+58
| | | | | | | | This makes no functional changes to the user interface but make future code reworks shorter. Change-Id: Ibd57a5d1090588c8a7b2a67730660c3cf47c832e Signed-off-by: William A. Kennington III <wak@google.com>
* tests/watchdog: Cleanup our use of durationsWilliam A. Kennington III2018-03-071-12/+10
| | | | | | | | We have lots of unnecessary constructors and forced duration casts. This change makes all of that logic simpler. Change-Id: Icfc6d51d75dfb67b3b4c252fbc32beeeded299ca Signed-off-by: William A. Kennington III <wak@google.com>
* tests/watchdog: Make sure the watchdog can be configured while disabledWilliam A. Kennington III2018-03-071-0/+20
| | | | | Change-Id: If25a533fd23ede502df402d021742aa19f64d2f6 Signed-off-by: William A. Kennington III <wak@google.com>
* tests/watchdog: Add a helper for counting down with the watchdogWilliam A. Kennington III2018-03-072-23/+31
| | | | | | | | This reduces a bunch of duplicate code that loops through an event loop to try and guage how long it took for the watchdog to expire. Change-Id: Ib3b33e250b157df02eff39751277c564ea40705c Signed-off-by: William A. Kennington III <wak@google.com>
* watchdog: Add a function to tell us if the timer is runningWilliam A. Kennington III2018-03-073-3/+17
| | | | | | | | This helps us refactor some of our existing code and will be useful for future changes. Change-Id: Ifa1547f09997d6824f726fc5f46e15eed4c1e8c1 Signed-off-by: William A. Kennington III <wak@google.com>
* watchdog: Refactor timeRemainingWilliam A. Kennington III2018-03-071-15/+9
| | | | | | | | | This function also depends only on the state of the timer. This patch introduces no functional changes but will make future changes shorter. Change-Id: Id9b5825faf6c4795ca5b862f140afe06ca51e1cf Signed-off-by: William A. Kennington III <wak@google.com>
* watchdog: timeRemaining doesn't need to check enabledWilliam A. Kennington III2018-03-071-17/+14
| | | | | | | | | | | The Timer is fully owned by the Watchdog and is only enabled when the watchdog is enabled. Therefore, we only need to check the state of the timer instead of the interface and timer before populating the timeRemaining value. This simplifies later patches and does not make any functional change. Change-Id: Ib11edd75eb1953360bf4eae7fc4b29b5251cf0c5 Signed-off-by: William A. Kennington III <wak@google.com>
* tests: Make private members protectedWilliam A. Kennington III2018-02-281-1/+1
| | | | | | | | | | | Googletest derived classes should never have private members unless they are inteded to not be accessible to class functions. Since class functions are derived from the provided class, the private members are unable to be accessed by the test cases. In a future change we need access to one of these members so make them protected. Change-Id: Iadbb53adc748d02168a1fc83f738f86437a1d15c Signed-off-by: William A. Kennington III <wak@google.com>
* test/watchdog: Use a unique_ptr for the watchdogWilliam A. Kennington III2018-02-282-29/+31
| | | | | | | | | This lets us change out the watchdog with a watchdog constructed using different parameters. Currently this functionality is not used, but it is needed for a future change. Change-Id: Ie1e7fbf2c7fc8bf2949237f2535177ecd46944a0 Signed-off-by: William A. Kennington III <wak@google.com>
* tests: Convert EXPECT_EQ(bool -> EXPECT_{TRUE,FALSE}William A. Kennington III2018-02-283-21/+21
| | | | | | | This is more in line with normal gtest code style. Change-Id: If49f700f756ad8d278927baae4e934ef7aa399d7 Signed-off-by: William A. Kennington III <wak@google.com>
* argument: Fix alignment of help textWilliam A. Kennington III2018-02-251-9/+9
| | | | | | | | | When printed on the terminal the description of the command line options is supposed to be aligned for all options. The --action_target argument is currently not aligned with any of the other arguments. Fix this. Change-Id: I170d445a5e490c5d6e99379b8b704992a51fca3c Signed-off-by: William A. Kennington III <wak@google.com>
* argument: Fix missing action_targetWilliam A. Kennington III2018-02-231-6/+7
| | | | | | | | | Our help output and mainapp code support setting an action_target but our argument parser doesn't actually interpret the option. This was mistakenly left out of a previous commit after refactoring. Change-Id: Ieff5d1a457b9f2b998533b8cefd0251ccb8655f1 Signed-off-by: William A. Kennington III <wak@google.com>
* argument: Fix help output spacingWilliam A. Kennington III2018-02-231-10/+10
| | | | | | | | | | Some of the help text lines are missing spaces between words. This commit makes the formatting more consistent such that spaces are always placed at the end of lines that do not contain a newline character. Now we have the correct spacing in the help output. Change-Id: I01d3f25c95f178afd02263ccc05c664a72bd479d Signed-off-by: William A. Kennington III <wak@google.com>
* timer: Add missing functional includeBrad Bishop2018-02-211-0/+1
| | | | | | | | std::function is not found with a GCC 7.2 runtime. Change-Id: Ic7eaf4012a2992ee4a58f2dda827f0625a9ae96f Tested: Built repository with GCC 7.2 Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
* mainapp: Parse action -> target mappings on the command lineWilliam A. Kennington III2018-02-212-11/+41
| | | | | | | | | | This adds the argument --action_target=<action>=<systemd_target>. Depending on the HostAction that is set when the watchdog expires we can start different systemd targets. The configuration of this mapping is now configurable at the command line. Change-Id: I7482e038d9abafc81cec0df15345cbfc670dbed2 Signed-off-by: William A. Kennington III <wak@google.com>
* mainapp: Print out the action -> target map at startupWilliam A. Kennington III2018-02-211-0/+16
| | | | | | | | | We have multiple methods for setting the action to systemd target mappings on the command line. This makes it more clear to the end user what the daemon interprets as the final mapping when it starts up. Change-Id: Ib57dc04575a578bba54f5bf8cb47d6a61690d3a3 Signed-off-by: William A. Kennington III <wak@google.com>
* watchdog: Support multiple timeout actionsWilliam A. Kennington III2018-02-153-23/+45
| | | | | | | | | | | | This change adds the infrastructure to support having different actions map to different systemd targets being started when the watchdog expires. Right now this maintains compatability with the current --target argument and populates all of the watchdog actions, except for None, with the same target. A follow up patch will implement setting independent targets for each action. Change-Id: I0f0601f9e94d488650f20a9cebfc7c967007d78c Signed-off-by: William A. Kennington III <wak@google.com>
* test/Makefile: Build test sources using automake targetsWilliam A. Kennington III2018-02-051-10/+3
| | | | | | | | | | If you specify object files for LDADD it will use some kind of built in rules for building those objects instead of adding the proper CFLAGS to the compile process. This results in build failures if the CFLAGS were actually needed to compile those objects. Change-Id: I1b7837c41fb5fc840d8b913802cfcdc0ee800455 Signed-off-by: William A. Kennington III <wak@google.com>
* argument: Support multiple argumentsWilliam A. Kennington III2018-02-054-34/+54
| | | | | | | | | | This will be used in future patches. Right now this should retain similar behavior to the current argument parsing semantics. The difference is we now require arguments to be specified only once and error if they are specified multiple times. Change-Id: I21e4cf9734f045c2b0991f7ed0ec6e6a569eec7d Signed-off-by: William A. Kennington III <wak@google.com>
* Revert "watchdog: Log watchdog updates for debug"William A. Kennington III2018-02-061-3/+0
| | | | | | | | | | | | Current users of this code like the witherspoon platform generate a lot of debug messages that they save to flash. While this seems like it should be solved by not persisting debug messages lets back off on this extra messaging for now. This reverts commit 539f56069b07f39413789fa9ae4c7085fbc092b4. Change-Id: If0e2161c15447df8d1a4804e9e061f1d9aa35c5c Signed-off-by: William A. Kennington III <wak@google.com>
* argument: Implement test casesWilliam A. Kennington III2018-01-303-1/+196
| | | | | | | The argument parser had a few subtle bugs and could use some tests. Change-Id: I0adbc507a822a6887fbf02b888b1f678b3cc7b35 Signed-off-by: William A. Kennington III <wak@google.com>
* argument: Clean up argv types to match standard definitionsWilliam A. Kennington III2018-01-292-4/+4
| | | | | Change-Id: Idabdaac7b7a3879d6a2e18e46df986a1543df48f Signed-off-by: William A. Kennington III <wak@google.com>
* configure/make: Allow googletest from pkg-configWilliam A. Kennington III2018-01-292-17/+20
| | | | | Change-Id: I2eb526827987dd2361d35fd782229b1461d49d01 Signed-off-by: William A. Kennington III <wak@google.com>
* argument: Fix use of optargWilliam A. Kennington III2018-01-291-1/+1
| | | | | | | | | | getopt supports no_argument, required_argument, and optional_argument types of arguments. Getopt returns NULL in optarg if no argument was given in the case of no_argument or optional_argument types. Use this value to determine if we should use optarg or trueString. Change-Id: I414c4d3c2923844cff13a070357269c5b48048c9 Signed-off-by: William A. Kennington III <wak@google.com>
* argument: Continue doesn't take an argumentWilliam A. Kennington III2018-01-291-1/+1
| | | | | Change-Id: If36f15254e0883a366f5cece76e87906f420cadb Signed-off-by: William A. Kennington III <wak@google.com>
* argument: Fix flag typoWilliam A. Kennington III2018-01-291-1/+1
| | | | | Change-Id: I409db7d3e8042217312225ac642b312541c48981 Signed-off-by: William A. Kennington III <wak@google.com>
OpenPOWER on IntegriCloud