Date: Fri, 13 Aug 2021 01:18:40 GMT From: Alexander Motin <mav@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: b41b86b65f10 - stable/13 - ipmi(4): Add more watchdog error checks. Message-ID: <202108130118.17D1IeOP071219@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=b41b86b65f10ccaa8cce8cc11a030ad464b654c0 commit b41b86b65f10ccaa8cce8cc11a030ad464b654c0 Author: Alexander Motin <mav@FreeBSD.org> AuthorDate: 2021-07-30 03:39:04 +0000 Commit: Alexander Motin <mav@FreeBSD.org> CommitDate: 2021-08-13 01:18:31 +0000 ipmi(4): Add more watchdog error checks. Add request submission status checks before checking req->ir_compcode, otherwise it may be zero just because of initialization. Add checks for req->ir_compcode errors in ipmi_reset_watchdog() and ipmi_set_watchdog(). In first case explicitly check for 0x80, which means timer was not previously set, that I found happening after BMC cold reset. This change makes watchdog timer to recover instead of permanently ignoring reset errors after BMC reset or upgraded. MFC after: 2 weeks Sponsored by: iXsystems, Inc. (cherry picked from commit 9d3b47abbba74830661e90206cc0f692b159c432) --- sys/dev/ipmi/ipmi.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/sys/dev/ipmi/ipmi.c b/sys/dev/ipmi/ipmi.c index 25077500d835..cd2a289b25cb 100644 --- a/sys/dev/ipmi/ipmi.c +++ b/sys/dev/ipmi/ipmi.c @@ -638,8 +638,15 @@ ipmi_reset_watchdog(struct ipmi_softc *sc) IPMI_ALLOC_DRIVER_REQUEST(req, IPMI_ADDR(IPMI_APP_REQUEST, 0), IPMI_RESET_WDOG, 0, 0); error = ipmi_submit_driver_request(sc, req, 0); - if (error) + if (error) { device_printf(sc->ipmi_dev, "Failed to reset watchdog\n"); + } else if (req->ir_compcode == 0x80) { + error = ENOENT; + } else if (req->ir_compcode != 0) { + device_printf(sc->ipmi_dev, "Watchdog reset returned 0x%x\n", + req->ir_compcode); + error = EINVAL; + } return (error); } @@ -671,8 +678,13 @@ ipmi_set_watchdog(struct ipmi_softc *sc, unsigned int sec) req->ir_request[5] = 0; } error = ipmi_submit_driver_request(sc, req, 0); - if (error) + if (error) { device_printf(sc->ipmi_dev, "Failed to set watchdog\n"); + } else if (req->ir_compcode != 0) { + device_printf(sc->ipmi_dev, "Watchdog set returned 0x%x\n", + req->ir_compcode); + error = EINVAL; + } return (error); } @@ -886,9 +898,9 @@ ipmi_startup(void *arg) IPMI_GET_CHANNEL_INFO, 1, 0); req->ir_request[0] = i; - ipmi_submit_driver_request(sc, req, 0); + error = ipmi_submit_driver_request(sc, req, 0); - if (req->ir_compcode != 0) + if (error != 0 || req->ir_compcode != 0) break; } device_printf(dev, "Number of channels %d\n", i); @@ -901,9 +913,9 @@ ipmi_startup(void *arg) IPMI_INIT_DRIVER_REQUEST(req, IPMI_ADDR(IPMI_APP_REQUEST, 0), IPMI_GET_WDOG, 0, 0); - ipmi_submit_driver_request(sc, req, 0); + error = ipmi_submit_driver_request(sc, req, 0); - if (req->ir_compcode == 0x00) { + if (error == 0 && req->ir_compcode == 0x00) { device_printf(dev, "Attached watchdog\n"); /* register the watchdog event handler */ sc->ipmi_watchdog_tag = EVENTHANDLER_REGISTER(
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202108130118.17D1IeOP071219>