From nobody Fri Dec 08 22:03:09 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Sn4rs3V7pz53Tlx; Fri, 8 Dec 2023 22:03:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Sn4rs2XWWz4T3y; Fri, 8 Dec 2023 22:03:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1702072989; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=lt1VYf5c1E4pTRI2x2EQm+IOf4eG3tg+V8ToGbeiIKg=; b=tlE4mz2WiLp72ujxvboKGiEu/+YwY5evHIASsH4Z4PrkAKnuJRIiQHdQaZWfd2AiDpmUbD zxsGd7FD2pvWIz+xkfg3e8+rMYHLqoQmwZ71dKRjQg2M9GqHyzCsfDVyKluCKvD2KphoYS 2QhPMXe9B3+9KNGii3lh1cJQkwb+aA0n/n2AorYvSGfonezbBV787ppW07fAzoS2h1u6Vi VhshVRIqRiQy+iCNZsptBYKZ1ItmhYN1d1vwKpa4eBXcNNydVmoSO3uNd33WGSIYcLS2NV FurNhfkdS4SX83qrNggyO/GQoWQez3jAVi6L+hV8FFxpw3vYdVGQ0gsl5jNFjg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1702072989; a=rsa-sha256; cv=none; b=CWLzfBLWsDMEf1KnLWv5dXlqtllYQl8K/qLoqDVt3B1Qa116nlULZwDrn9o8DdBNfRJSf8 b2Oq65iB3ogcWZudMIWIWFIiWeVcU/oCE47wMM0UTQx/O/5kuzum9nkU/PRlj9ILgfNiRq D+kbKBTyHZLGyQA3Qtaxh3hWdtuUg7/X3djz+psBokVUHUvrF4esDkQLqjCjCKGkguYnv+ y2gYL5CC+2Hb4FKnq9NfqmYVddLOHUSpUKxXLp1NJ09pWEltewFHut0cBhj4h6v0tigHfM 0J3i4tMz598DSoetgI5XDRwbr/aVnFrg0ci65BT+yvhd3w1qH2LPuY2swOWk/w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1702072989; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=lt1VYf5c1E4pTRI2x2EQm+IOf4eG3tg+V8ToGbeiIKg=; b=eB5e38Iw85292g7BaOaEX8KL4112WPm4BiisFzPTewHHe+jvkewNSwayX0JR578p39/XFg XRDsEWHHIAfSFYAPVP5F4/ypBXf9ksWH8NLNUOOxKVRM48g2d8N6ZKJ0O/Am/xd2iq7sil w49EpWcWh9SxcTKpr+kswL/1oKDu3sg0Bl4A26OlJgLfP9bldvK0mi7QvRYGUYpczLRX2x +yN+poliPoG2fHp84/jv5I7u4YQewgB67bysL9RdNvLxJeFpPHIQnZk/hYaHLM/zMymOoy uBJR2aN1WthuLc4Nmpi8DRNS34pabZkrsj4GlUcxkhJ3c9n0Fk4vFDFSrZqNZw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Sn4rs1R3Tzf2l; Fri, 8 Dec 2023 22:03:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3B8M391S021017; Fri, 8 Dec 2023 22:03:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3B8M39il021014; Fri, 8 Dec 2023 22:03:09 GMT (envelope-from git) Date: Fri, 8 Dec 2023 22:03:09 GMT Message-Id: <202312082203.3B8M39il021014@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 121656c2b12f - stable/14 - pst: improve shutdown_post_sync handler List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 121656c2b12ffb0a00085a4d320f2b38b7a7bd3d Auto-Submitted: auto-generated The branch stable/14 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=121656c2b12ffb0a00085a4d320f2b38b7a7bd3d commit 121656c2b12ffb0a00085a4d320f2b38b7a7bd3d Author: Mitchell Horne AuthorDate: 2023-11-23 15:59:05 +0000 Commit: Mitchell Horne CommitDate: 2023-12-08 22:02:45 +0000 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) --- sys/dev/pst/pst-iop.c | 2 +- sys/dev/pst/pst-raid.c | 15 ++++++++++----- 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 #include #include +#include #include #include @@ -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