summaryrefslogtreecommitdiffstats
path: root/app/watchdog.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Don't report serviceable action if the watchdog service is not presentTom Joseph2020-01-141-6/+0
| | | | | | | | | | | | There were a few cases where a service action was reported because the watchdog service was not present. It was because of a race condition where the power down operation is trigerred and the watchdog service is shutdown but if was followed by a watchdog reset. Since the watchdog service is absent it resulted in an error log which calls for serviceable action. The IPMI error response code will report the failure to the host platform software. Change-Id: Iaf0a860b53fbd85dc451fc4d4a337406ba74e0d6 Signed-off-by: Tom Joseph <tomjoseph@in.ibm.com>
* app/watchdog: Always use resetTimeRemainingWilliam A. Kennington III2020-01-061-1/+1
| | | | | | | | | | | | | | The SetWatchdog function currently sets the intervals and then the time remaining on the watchdog. It uses the user provided interval for both values. Recently, the watchdog was extended to allow for the interval to be capped above a certain value to prevent the user from setting watchdogs that are known to be too short. In order to keep the timeRemaining in sync with the value in the watchdog, just use the resetTimeRemaining() function which reads the current interval to set the timeRemaining. Change-Id: I3f15030a85c625fcb1ed8040add03496618a5ece Signed-off-by: William A. Kennington III <wak@google.com>
* Expiration flags fix for watchdog get/set commandsYong Li2019-11-011-20/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The expiration flags should be retain their state across system resets and power cycles. Tested: Set “BIOS FRB2” and start ipmitool raw 0x06 0x24 0x01 0x00 0x00 0x00 0x30 0x00 ipmitool mc watchdog reset after stopped: Timer Expiration Flags should be : (0x02) * BIOS FRB2 Then Set “BIOS/POST” and start, ipmitool raw 0x06 0x24 0x02 0x00 0x00 0x00 0x30 0x00 ipmitool mc watchdog reset after stopped: Timer Expiration Flags should be : (0x06) * BIOS FRB2 * BIOS/POST “impitool mc watchdog get” displays the correct Timer Expiration Flags when the timer is running; Signed-off-by: Yong Li <yong.b.li@linux.intel.com> Change-Id: Ic0c27c6c1e8bed2db8ce30fc0eec2a6538bb1992
* Data checking fix for watchdog set/get commandsYong Li2019-10-111-22/+25
| | | | | | | | | | | | | | | | | | data length check for timeout action and byte 1 reserved field check are missing, causing not to throw the error; Log flags is on bit 7, also needs to right-shift this flag; This commit fixes these issues; Tested: Set different timer use/actions: ipmitool raw 0x06 0x24 0x85 0x0 0x0 0x0 0x64 0x00 ipmitool raw 0x06 0x24 0x84 0x1 0x0 0x0 0x64 0x00 Check the settings are correct: ipmitool raw 0x06 0x25 Signed-off-by: Yong Li <yong.b.li@linux.intel.com> Change-Id: Ia4226bb4597d2c670f93522aa763e43d15eb6cf1
* Watchdog: move get and set watchdog to new api.Deepak Kumar Sahu2019-09-101-74/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rewrite "get and set watchdog" command to use the newly introduced ipmi api. Tested: Verified using ipmitool "get and set watchdog", timer behavior is same before and after the changes. Testing Procedure: default watchdog timer is 11.2 seconds. ipmitool raw 0x06 0x25 ---> Get Output: 00 00 00 00 70 17 70 17 Note: Here 70 count(hex value)->112 count(decimal value)->112*100=11200ms [100ms per count]->11.2sec (watchdog timer) watchdog timer set to 20 seconds. ipmitool raw 0x06 0x24 0x44 0x01 0x00 0x10 0xc8 0x00 ----> Set output: ipmitool raw 0x06 0x25 ---> Get output: 04 01 00 00 c8 00 c8 00 Note: Here 20sec->20000ms->200count->c8 (hex value) Signed-off-by: Deepak Kumar Sahu <deepakx.sahu@intel.com> Change-Id: Id8c096bc1635d1900ee842a9726c49fb690fa8bc
* Return error if the input data is larger than expectedYu Ren2019-05-201-1/+1
| | | | | | | | | | | | If the input data length exceeds the expected, return len_invalid too Tested: ipmitool raw 0x06 0x24 0x01 0x13 0x0 0x2 0xa 0x00 0xff Will return error Signed-off-by: Yu Ren <yux.ren@intel.com> Change-Id: I12168f4aed51c499fd06067ca4475917b68e819e
* rewrite Reset Watchdog Timer command to use new provider APIVernon Mauery2019-04-111-13/+8
| | | | | | | | | | | | Modify to use the new provider API. One by one, change calls to remove any legacy API constructs. Tested-by: ipmitool mc watchdog get ipmitool mc watchdog off ipmitool mc watchdog reset Change-Id: If6cd1d921908dc7f5462e99b0098b4897e743ebb Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
* Only include ipmid/api.hpp for the new APIVernon Mauery2019-04-081-1/+1
| | | | | | | | | | | | | | After some feedback from users of the new IPMI API, they wanted to see two things: 1) don't require ipmid/api.hpp and ipmid/registration.hpp to be able to write new handlers 2) only require including ipmid/api.hpp (instead of ipmid/api.h) So now, by simply including ipmid/api.hpp instead of ipmid/api.h (deprecated), handlers incorporating the new IPMI API can be written. Change-Id: I446dcce70cff03d4ecc28c658292d052485f77fc Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
* remove legacy ipmid.cpp and ipmid.hppVernon Mauery2019-04-011-1/+0
| | | | | | | These two files have now been replaced with newer APIs and can be removed. Change-Id: If60227b24188c6796211ca43379169f9a95c9cb3 Signed-off-by: Vernon Mauery <vernon.mauery@linux.intel.com>
* Get the correct present countdown value when watchdog is stoppedYong Li2019-02-121-4/+8
| | | | | | | | | | | | The timeRemaining property in watchdog service will return 0 if the watchdog is not started. Tested By: ipmitool raw 0x6 0x24 0x0 0x0 0x0 0x0 0xa 0xb ipmitool mc watchdog get Change-Id: I27992f25a0e2c75df398ec5e2702b467365e9a32 Signed-off-by: Yong Li <yong.b.li@linux.intel.com>
* Add timer use field support in watchdog commandYong Li2019-02-121-0/+91
| | | | | | | | | Tested: ipmitool raw 0x06 0x24 1 0 0 0 0 0 ipmitool mc watchdog get Change-Id: Iaffd6622821d33183a52f54a4e2e52a36aa17dde Signed-off-by: Yong Li <yong.b.li@linux.intel.com>
* Create libipmid and libipmid-hostWilliam A. Kennington III2019-02-071-1/+1
| | | | | | | | | | | | | | | | | | | This starts a transition to common ipmid libraries that providers can link against. It will allow for a cleaner separation between common ipmid functionality and daemon type specific code. This is needed so we can resolve all of the symbols in the providers at link time instead of discovering bad linkage by building and running a full ipmi daemon. In future commits libraries will be packaged for libipmid and libipmid-host which provide all of the symbols used by the current set of ipmid providers. This is the first step, it just separates and renames the headers. Legacy symlinks are still kept around for compatability. It also adds stub libraries so that external users can start linking as intended. Change-Id: I6bbd7a146362012d26812a7b039d1c4075862cbd Signed-off-by: William A. Kennington III <wak@google.com>
* rename headers to match stylePatrick Venture2018-09-251-2/+1
| | | | | | | | | | | | | | | | | | Moving headers from ".h" to ".hpp" Reworked the header inclusion a bit so that host-ipmid is treated as a library, and local headers aren't. renamed apphandler.h => apphandler.hpp renamed chassishandler.h => chassishandler.hpp renamed globalhandler.h => globalhandler.hpp renamed sensorhandler.h => sensorhandler.hpp renamed storageaddsel.h => storageaddsel.hpp renamed storagehandler.h => storagehandler.hpp renamed systemintfcmds.h => systemintfcmds.hpp Change-Id: I9d4ce3dd57e2e996800f9020a10cc10cdf2c3914 Signed-off-by: Patrick Venture <venture@google.com>
* app/watchdog: Only log internal failures onceWilliam A. Kennington III2018-09-211-10/+35
| | | | | | | | | | | | | | | | | Logging internal failures to the phosphor-logger is a slow process that can take up to 5 seconds. If we do this for each watchdog reset for a relatively fast watchdog we will clog up the channel and fill the ESEL log with errors. We probably don't want that kind of information to build up. Instead, only report errors to the ESEL when the state of the internal watchdog transitions from HEALTHY -> UNHEALTHY. Tested: Works on zaius when booting and terminating the watchdog daemon while it is ticking. Produces the expected single error in the log and only delays the IPMI channel once. Change-Id: I8110ba66c4a85e188666a34cb6d055bdbec30622 Signed-off-by: William A. Kennington III <wak@google.com>
* add .clang-formatPatrick Venture2018-09-071-43/+42
| | | | | Change-Id: I7c2a527b4751a560703a61fcbe9638b150546af5 Signed-off-by: Patrick Venture <venture@google.com>
* watchdog: Get only the initialized property during resetWilliam A. Kennington III2018-05-221-2/+1
| | | | | | | | | | Since we switched to resetting the watchdog with a built-in method, we are only using a single property from the watchdog. Instead of fetching all the properties and reading just the initialized one, only request the initialized property from the watchdog. Change-Id: I5e29b5100629e1ce23f352b0b749a434cd1ab793 Signed-off-by: William A. Kennington III <wak@google.com>
* watchdog: Use ResetTimeRemaining for wd_resetWilliam A. Kennington III2018-05-221-6/+2
| | | | | | | | Using this helper method reduces the number of dbus calls made during each watchdog reset. Change-Id: I373db3babe03e05fca33eb4dbbbc7c07f95a39ea Signed-off-by: William A. Kennington III <wak@google.com>
* watchdog: Handle and report internal failuresWilliam A. Kennington III2018-05-221-0/+26
| | | | | | | | | An upcoming change will introduce InternalFailures instead of using runtime exceptions for error handling in the watchdog service. We need to handle these exceptions appropriately. Change-Id: Icfc02d98821f307a37a4cf59911913c820e88744 Signed-off-by: William A. Kennington III <wak@google.com>
* watchdog: Implements the Watchdog Get CommandWilliam A. Kennington III2018-02-211-0/+98
| | | | | Change-Id: I2ba9fd0eeba4e828cafd1bcf6fe30e2322eaf99e Signed-off-by: William A. Kennington III <wak@google.com>
* watchdog: Implement watchdog action settingWilliam A. Kennington III2018-02-211-7/+32
| | | | | | | | We now respect the action set during the SetTimeout command. This maps to one of the actions defined by the dbus Watchdog interface Change-Id: I4d13d2539a2d955a4340bf5f915ca6f3b694550a Signed-off-by: William A. Kennington III <wak@google.com>
* watchdog: Implement initialized using the new dbus interfaceWilliam A. Kennington III2018-02-211-0/+10
| | | | | | | | | This makes it possible for the phosphor-host-ipmi or any other watchdog managing daemon to report to the caller that the watchdog was not configured if the phosphor-watchdog daemon restarts for any reason. Change-Id: Iae3a8554c2f5d1cb89368f3ce14b3d44922599c0 Signed-off-by: William A. Kennington III <wak@google.com>
* watchdog: Rewrite using sdbusplusWilliam A. Kennington III2018-02-211-180/+90
| | | | | Change-Id: I730317954819859d23fdaca7336f19f5c5b0c107 Signed-off-by: William A. Kennington III <wak@google.com>
* watchdog: Reorganize header and function namesWilliam A. Kennington III2018-02-151-98/+98
| | | | | | | | This is a refactoring of names + header cleanup and has no functional change. Change-Id: Ie90fded80b6a26927f56bb342993193530b8b8ef Signed-off-by: William A. Kennington III <wak@google.com>
* watchdog: Consistently return errors for dbus failuresWilliam A. Kennington III2018-02-061-4/+18
| | | | | | | | | This adds return codes for all of the dbus failures which inform the host that it should retry the IPMI command as dbus related errors should be ephemeral. Change-Id: I090f488535625a996347677a0c8addbdff0996c0 Signed-off-by: William A. Kennington III <wak@google.com>
* watchdog: Fix enabled value typeWilliam A. Kennington III2018-01-291-1/+1
| | | | | | | | | | | | | | When deserializing a bool with sd_bus_message_read, it expects the storage of the passed in container to be 4 bytes. A bool is not guaranteed to be this large and will cause sd_bus_message_read to scribble on the stack. Change enabled to int to guarantee enough space to deserialize the result. For reference libsystemd is doing: *(int*) p = !!*(uint8_t*) q; Change-Id: Ic299e303fcb70941757c453a7b4f643337220afb Signed-off-by: William A. Kennington III <wak@google.com>
* watchdog: Implement error on reset of disabled watchdogWilliam A. Kennington III2018-01-241-1/+30
| | | | | | | | | This enables the host to recover when the BMC resets or the daemon loses state for some reason. A well formed host will resend the SetTimeout command if it encounters this error code. Change-Id: Ib5fd50ac3ad83ef820f0209354aa8f084a563995 Signed-off-by: William A. Kennington III <wak@google.com>
* watchdog: cleanup style and similar fixesPatrick Venture2017-11-101-19/+26
| | | | | | | Some style cleanup. Change-Id: I4f8ce595294797cc015a55cc6c9477aee7b6938a Signed-off-by: Patrick Venture <venture@google.com>
* watchdog: split out commandsPatrick Venture2017-10-251-0/+174
I split out the watchdog command handlers into their own subordinate file from the apphandler. This reduces the size of the contents of the apphandler file, and logically cuts out code into its own files. Change-Id: Idc70acad6c93c12456cc7092786715643c9c1ffb Signed-off-by: Patrick Venture <venture@google.com>
OpenPOWER on IntegriCloud