From nobody Thu Nov 23 16:07:57 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 4Sbjgy244tz51ncX; Thu, 23 Nov 2023 16:07:58 +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 4Sbjgy0z4Pz4PvK; Thu, 23 Nov 2023 16:07:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1700755678; 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=d1tQJqaJSbPSrStKOekwFhmdZe8+7X+r10yzGa91yxc=; b=eo7/5/UqqaBzRSy5HBuBulj27nZnlvl0yW82kuUyt1VxKIU19n3NsMC/rrcQvLG/r0pekd nazHTHOFL8zrs4zi0QH+4XvBr60ppqVU2U7/4+q+FM0hyEd2YWhGdE+Eqg5GfZ4W68pUm2 +OpSuj5enQxWmuC1m9ONol4lY/BOYMtslEy+4uBllwHwdcMvuyHBXwNZ97DnAD/XZIihRT JUon8bfy3v67jzLHpHSE/0aA86pxrld4E1NzuDtv0hMvbrBrhHeygfwkXRAmxzejwVn4HL tEQYjXtI7lHdbxtUi4o/BieMe3Y8u8Ki4NmU2IWH8XZ4Untm9fsGpHjdZ1J5BQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1700755678; 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=d1tQJqaJSbPSrStKOekwFhmdZe8+7X+r10yzGa91yxc=; b=F7QEtKxvU2ywwqUutO2/G9Gh+Kp2iiKy32JDujJ7FJLv9wLCoNddslZrsVKQZNoVyupUiX Dt7oMCLVU3M6yBBov9C5Dj9gPhfYZgqCNStoPvccpwdMQmZC09nJ7annfNIx0E4GQEilGJ icQjvfgzfjgvPl62/bfw4XkdyGK7dBdx/UNg+v7oLsj05Fl6o4SWzD6nACExZv2C0KmqgV XVxbWcklY0uFGywK157vd6YClD2UO8kT++J6B3uowObBNm3Rd7jH4w6QeC8g2CCrQmBCc8 CCtnfpUr1ozBBbQMiawtS7rcZpF3fMkHtNG9YAUQJfyDIbBc26ImG8EGji+7Dw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1700755678; a=rsa-sha256; cv=none; b=pJGGhzxwnwkXb6kueRKuKw8FHiDHyS2qIGUdcqDguuJKWwAj/iyKgXVjw7vx776x2xlOae mWANGamfKeWWLzV7fAD2N6BN5K0fk31PbeVGGFG4Oozv7VtoI9AIrnN56OlyMBCecVYIiL PGyFYNJfr4C5cpipa2EmT+KQx0NIFVROZt1KeHfwG26LshJr7xzMVfeeWzdcIT6q4I12R7 WTXqgqXL9vW1vPM6dOlezacmy72RoEtlYklonbbIeRFTtG59U4uMSAkn06ckdPD8Wkwe5U PQYs1UDKaCeQJhhGh92eeVyMOl5Pl5p6RI/G8l1z9bMOyS1TaMDnnrMkPgNgJQ== 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 4Sbjgx6v97z17hK; Thu, 23 Nov 2023 16:07:57 +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 3ANG7vou007432; Thu, 23 Nov 2023 16:07:57 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3ANG7v6J007429; Thu, 23 Nov 2023 16:07:57 GMT (envelope-from git) Date: Thu, 23 Nov 2023 16:07:57 GMT Message-Id: <202311231607.3ANG7v6J007429@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 428ebb7cd9f5 - main - 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/main X-Git-Reftype: branch X-Git-Commit: 428ebb7cd9f51afb6809bf81cf21a05e0fd93ff4 Auto-Submitted: auto-generated The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=428ebb7cd9f51afb6809bf81cf21a05e0fd93ff4 commit 428ebb7cd9f51afb6809bf81cf21a05e0fd93ff4 Author: Mitchell Horne AuthorDate: 2023-11-23 15:59:05 +0000 Commit: Mitchell Horne CommitDate: 2023-11-23 16:07:42 +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 --- sys/dev/pst/pst-iop.c | 2 +- sys/dev/pst/pst-raid.c | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/sys/dev/pst/pst-iop.c b/sys/dev/pst/pst-iop.c index f9921a564333..43ced2401d2c 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 & I20_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..4f9279462ee8 100644 --- a/sys/dev/pst/pst-raid.c +++ b/sys/dev/pst/pst-raid.c @@ -73,7 +73,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 +170,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->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 +199,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