From nobody Tue Oct 15 22:21:58 2024 X-Original-To: dev-commits-src-main@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 4XSpVZ4Kwtz5Z4pQ; Tue, 15 Oct 2024 22:21: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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XSpVZ2sBlz3wbQ; Tue, 15 Oct 2024 22:21:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729030918; 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=qXYC6vKTUXL0nTmInXVUz7Akn9JZfVZwKJebqjVMCFk=; b=cOpbuokepNCpakrEv5LqjaDKg0npgntcxIuE+DYq8tvoXpssgCDDEWsrYJRMvTK8ozFWsg wF2PXDlJUTdv4tY2805applKdvMZYhEAA0ozOFEJ+GMo8OycH+AH/tC9+61AX4z/Mvpw1f ypR4YZZklR+KNvcwkjhML4rYnEX7mQbzDXIQexbcgr3xzbq5L4nrllfSP4ej4gt1NsvIfR vlx/0ywWvyMXdXEZFiLXdLrA3wZ60obNMGIXK8zXWnT7g+lFml7KYI7x8TAlulYQ0g8SPQ w23BFG8VCKidwbsxGYmN4FqrzX1QB96XlCG9lGGWg5SMe2lRgGpgpMCr9XsuTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1729030918; 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=qXYC6vKTUXL0nTmInXVUz7Akn9JZfVZwKJebqjVMCFk=; b=EpUSW6xeC8wZOT3Bfm+Ty2PFvoXR+UqHM9iA3pAtjRMXCCSaLKzlgR+V3K49FIKt0WW4ms D3FC1CdqZ4/BLgGmwJGqKyNEXiDR0rrIFrvnhmZMtclmyzC6FPDbnMK347vQncjSAhXlw9 RznQi5LUYzyan5KtClcFFLDUfC3ijwVhr8Mlrzmp7GPK9cpofzvq/OzSBoyTearwnGW3Dk E+/QZopuiwR91lc8F/RMGIwV/qhsvFmL94OgadNyW9S4vaYX8fjRYaVuN2MkmgV36l3fnM C37+Bg7NacP9+P05hEMBFvlUOiI+mRGegABxpcPPdBJCYtfamyYEFnzzCMcjhg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1729030918; a=rsa-sha256; cv=none; b=Gf/XGKf/Kq1uGm6hPtFtG9GkXACtpJs87dqOBga6TgfXNGz3Hdc/UPziWeCzu/2HDvU6kn COPf4qlebdMCQ12ea3/olWXMjGYF+JYTTj0xDsEacYzZ/iawEfxPNjjthtAxD3eiOzD8Ou TSLWcBku9WdPoW4B0LqwWz9PSH5MEUAKB5yRKMA5kRyItiBpZlMH5vLyJTKy3HApWp56wu lZUsEe9oH4eSMXEKP99tMz8kZC67HtEhPDvHHNdsIDiGbaUvZ//CVXflQjqXTleA5ROr5p wk4D6207JCVPXvvT4kAE8DaPzm32twSy0zYY8Wf/pnmMJiB5mrAvsmP3UFTq0g== 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 4XSpVZ2TgxzgQw; Tue, 15 Oct 2024 22:21:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 49FMLwjV038548; Tue, 15 Oct 2024 22:21:58 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 49FMLwo9038545; Tue, 15 Oct 2024 22:21:58 GMT (envelope-from git) Date: Tue, 15 Oct 2024 22:21:58 GMT Message-Id: <202410152221.49FMLwo9038545@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 9dbff03c3478 - main - nvme: Inject artificial failure on reset List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9dbff03c3478dc25013ec380ef8632670c014d6a Auto-Submitted: auto-generated The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=9dbff03c3478dc25013ec380ef8632670c014d6a commit 9dbff03c3478dc25013ec380ef8632670c014d6a Author: Warner Losh AuthorDate: 2024-10-15 22:20:32 +0000 Commit: Warner Losh CommitDate: 2024-10-15 22:20:58 +0000 nvme: Inject artificial failure on reset Add a sysctl to artificially fail the reset to test the failure to reset hardware code path. While there are many ways that reset can fail, this provides an adequate way that similates enough of the failures well enough to shake out this failure path. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D28584 --- sys/dev/nvme/nvme_ctrlr.c | 2 +- sys/dev/nvme/nvme_private.h | 1 + sys/dev/nvme/nvme_sysctl.c | 4 ++++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/sys/dev/nvme/nvme_ctrlr.c b/sys/dev/nvme/nvme_ctrlr.c index 4c1a3830aac0..d8ad12fc9982 100644 --- a/sys/dev/nvme/nvme_ctrlr.c +++ b/sys/dev/nvme/nvme_ctrlr.c @@ -1152,7 +1152,7 @@ nvme_ctrlr_start_config_hook(void *arg) TSENTER(); - if (nvme_ctrlr_hw_reset(ctrlr) != 0) { + if (nvme_ctrlr_hw_reset(ctrlr) != 0 || ctrlr->fail_on_reset != 0) { nvme_ctrlr_fail(ctrlr, true); config_intrhook_disestablish(&ctrlr->config_hook); return; diff --git a/sys/dev/nvme/nvme_private.h b/sys/dev/nvme/nvme_private.h index 029c2ff97bff..dd7a849b6782 100644 --- a/sys/dev/nvme/nvme_private.h +++ b/sys/dev/nvme/nvme_private.h @@ -299,6 +299,7 @@ struct nvme_controller { uint32_t is_resetting; uint32_t notification_sent; + u_int fail_on_reset; bool is_failed; bool is_failed_admin; diff --git a/sys/dev/nvme/nvme_sysctl.c b/sys/dev/nvme/nvme_sysctl.c index edd1f3e40997..f3566e75225d 100644 --- a/sys/dev/nvme/nvme_sysctl.c +++ b/sys/dev/nvme/nvme_sysctl.c @@ -426,6 +426,10 @@ nvme_sysctl_initialize_ctrlr(struct nvme_controller *ctrlr) CTLFLAG_RD, &ctrlr->cap_hi, 0, "Hi 32-bits of capacities for the drive"); + SYSCTL_ADD_UINT(ctrlr_ctx, ctrlr_list, OID_AUTO, "fail_on_reset", + CTLFLAG_RD, &ctrlr->fail_on_reset, 0, + "Pretend the next reset fails and fail the controller"); + que_tree = SYSCTL_ADD_NODE(ctrlr_ctx, ctrlr_list, OID_AUTO, "adminq", CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "Admin Queue");