aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMitchell Horne <mhorne@FreeBSD.org>2023-11-23 15:59:05 +0000
committerMitchell Horne <mhorne@FreeBSD.org>2023-12-08 22:02:45 +0000
commit121656c2b12ffb0a00085a4d320f2b38b7a7bd3d (patch)
tree62a12541f2c7f4f70d7dc6a726a929f2a2afa9d1
parenta8ba64ca91d479346c9a7f99ef3eeceb1976ac13 (diff)
downloadsrc-121656c2b12ffb0a00085a4d320f2b38b7a7bd3d.tar.gz
src-121656c2b12ffb0a00085a4d320f2b38b7a7bd3d.zip
pst: improve shutdown_post_sync handler
It is desirable to shut down the raid controller even in the face of a panic. In the SCHEDULER_STOPPED() case, set the interrupt mask bits so that we request a polled wait, rather than sleep(), from iop_queue_wait_msg(). Tweak the function name and signature. Reviewed by: markj MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D42337 (cherry picked from commit c4dacfa7f4b82f23ec0924d9db772860b2066f9b) (cherry picked from commit f97aab79868cd7d891c52b14bd964523fa56f015)
-rw-r--r--sys/dev/pst/pst-iop.c2
-rw-r--r--sys/dev/pst/pst-raid.c15
2 files changed, 11 insertions, 6 deletions
diff --git a/sys/dev/pst/pst-iop.c b/sys/dev/pst/pst-iop.c
index f9921a564333..783507ce0d9e 100644
--- a/sys/dev/pst/pst-iop.c
+++ b/sys/dev/pst/pst-iop.c
@@ -432,7 +432,7 @@ iop_queue_wait_msg(struct iop_softc *sc, int mfa, struct i2o_basic_message *msg)
int status, timeout = 10000;
mtx_lock(&sc->mtx);
- if (!(sc->reg->oqueue_intr_mask & 0x08)) {
+ if ((sc->reg->oqueue_intr_mask & I2O_OUT_INTR_QUEUE) == 0) {
msg->transaction_context = (u_int32_t)&request;
msg->initiator_context = (u_int32_t)iop_done;
sc->reg->iqueue = mfa;
diff --git a/sys/dev/pst/pst-raid.c b/sys/dev/pst/pst-raid.c
index 4e9c4fb724bc..de152f611e3a 100644
--- a/sys/dev/pst/pst-raid.c
+++ b/sys/dev/pst/pst-raid.c
@@ -39,6 +39,7 @@
#include <sys/lock.h>
#include <sys/malloc.h>
#include <sys/mutex.h>
+#include <sys/proc.h>
#include <sys/rman.h>
#include <vm/vm.h>
@@ -73,7 +74,7 @@ struct pst_request {
static disk_strategy_t pststrategy;
static int pst_probe(device_t);
static int pst_attach(device_t);
-static int pst_shutdown(device_t);
+static void pst_shutdown_post_sync(device_t, int);
static void pst_start(struct pst_softc *);
static void pst_done(struct iop_softc *, u_int32_t, struct i2o_single_reply *);
static int pst_rw(struct pst_request *);
@@ -170,18 +171,23 @@ pst_attach(device_t dev)
name, psc->info->capacity/(512*255*63), 255, 63,
device_get_nameunit(psc->iop->dev));
- EVENTHANDLER_REGISTER(shutdown_post_sync, pst_shutdown,
+ EVENTHANDLER_REGISTER(shutdown_post_sync, pst_shutdown_post_sync,
dev, SHUTDOWN_PRI_FIRST);
return 0;
}
-static int
-pst_shutdown(device_t dev)
+static void
+pst_shutdown_post_sync(device_t dev, int howto __unused)
{
struct pst_softc *psc = device_get_softc(dev);
struct i2o_bsa_cache_flush_message *msg;
int mfa;
+ if (SCHEDULER_STOPPED()) {
+ /* Request polled shutdown. */
+ psc->iop->reg->oqueue_intr_mask = 0xffffffff;
+ }
+
mfa = iop_get_mfa(psc->iop);
msg = (struct i2o_bsa_cache_flush_message *)(psc->iop->ibase + mfa);
bzero(msg, sizeof(struct i2o_bsa_cache_flush_message));
@@ -194,7 +200,6 @@ pst_shutdown(device_t dev)
msg->control_flags = 0x0; /* 0x80 = post progress reports */
if (iop_queue_wait_msg(psc->iop, mfa, (struct i2o_basic_message *)msg))
printf("pst: shutdown failed!\n");
- return 0;
}
static void