Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Aug 2021 01:19:21 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: 8e6bcb7f56f1 - stable/12 - ipmi(4): Add more watchdog error checks.
Message-ID:  <202108130119.17D1JLSl071400@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by mav:

URL: https://cgit.FreeBSD.org/src/commit/?id=8e6bcb7f56f12ca2d237b4684223ebb5c5d9092c

commit 8e6bcb7f56f12ca2d237b4684223ebb5c5d9092c
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:19:13 +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 edbe1741e0f7..d48a7d10c289 100644
--- a/sys/dev/ipmi/ipmi.c
+++ b/sys/dev/ipmi/ipmi.c
@@ -635,8 +635,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);
 }
 
@@ -668,8 +675,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);
 }
 
@@ -883,9 +895,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);
@@ -898,9 +910,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?202108130119.17D1JLSl071400>