Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp148194lql; Sun, 10 Mar 2024 19:09:38 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVSRKOfps9LP7u2DNOjR3gyKfzPKK2RYJAyGX59KU2Nukfonski1zzG/sF8Q/fe7QMJcQ1rjRwD1cBDWj9pRztz6naOAGKs4iHXpSk6zg== X-Google-Smtp-Source: AGHT+IG3jpAfB3eQXSXrJ4ytW+95Ms3tjfdiGaDNwPZgg9eNHrlQGQxwsNqhZ3vH5v8JAIHGJXhb X-Received: by 2002:a05:6122:4785:b0:4d3:499a:830c with SMTP id ee5-20020a056122478500b004d3499a830cmr2183879vkb.13.1710122977814; Sun, 10 Mar 2024 19:09:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710122977; cv=pass; d=google.com; s=arc-20160816; b=j87zqA86r4fpOPbiHggfi91G33oiAwfZM2L185vzDN4NY5Y+uBi5Yc5PqKwon91AKz 4w+AO0vNxA9DAAYfR/OPCusuqNqQxOVysKb1BlktDpo2aoiw3FLE8kNlhpeCTujdPyRX OBL6sD2Wt/ZEUyS/X2+wfxp9Oo/Mg32WlMk15jRddvQSxiAjsUYYS4Uy0206f0Rhwvdc rtJLlnmxAXQrnPDIHyDlxSsnar1jr6wHmUxEWiQfdb5eKNQFFRVmKpm/3UwRCnf6CJAV STGn1Aa4oyGAkWaH6iYSiVy12f16yCDGnoi89lg7a63mJZW2zXXWeSU0J9etJtje/AmF GSVA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=Z4ztNqq1FwMuKzBeQUi/UacN3w/fjsndHTJlWkBGBT0=; fh=R6Q01GVVcGIfMk/mX3srqkwEFPeoVoKvXRTLLIKI1yU=; b=NiyoehyL3x7jPif51lErCNBF2yY1xZB50F8W594UP7AyzImpduzHOMh5Tt9XAtDbEk zExfCMjKCwqF35x1JIaA96HAcjhjIRwGMOHrm2HDdjx6aDN96xKGj3bGQoBLZj4/TsDC Npu7VoWR8JsPXofluN7nGK7SqwJzAsmNICqrsrFrKHs90jqOcqkMOm4GYXp/tv2JO4vE XfkaCUe0X9fhzvGs2oH5Ie8M9muj8gw9D6WBDVilz3XYmhqGxDuxB205jR+eSNGezKsR 0yh2/WNiSJ5lEPKRHHOSCfR5yRZpWqgKksBUsLF4x670hVuARUrgzMRkV28mKF2RXpcw 5qUQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=V5x3grYn; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-98413-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-98413-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id ke11-20020a056214300b00b0068fe59e447bsi4384325qvb.315.2024.03.10.19.09.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Mar 2024 19:09:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-98413-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=V5x3grYn; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-98413-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-98413-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 781D41C20ADD for ; Mon, 11 Mar 2024 02:09:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0A6ED10E3; Mon, 11 Mar 2024 02:09:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="V5x3grYn" Received: from mail-pg1-f182.google.com (mail-pg1-f182.google.com [209.85.215.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B79DC812 for ; Mon, 11 Mar 2024 02:09:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710122971; cv=none; b=J8reQrhc6bcpjlVtomcYAhEC72X4EPQgIlDB2fH937V3PFX4shcsYhTLchex6gD6GCNm+1irn8J/LNBfHMeuNYY0QgsX3iT7NnBxKQhSTThF8RXAJXP94gq+7R3duAJg6o2YpLQX9tZurviTczCcrnTMV7fk2C0OXljEN6Z9jFE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710122971; c=relaxed/simple; bh=UpmFp74ay0Ol8HpjLX2V80TYaJW2nnT+dSTPHakkRl0=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=ZU1kFlRAn4106/zs0QcIxxgrpBWu9U9Lxl2RrHavQY/KBOAuOy+5NsBFCf2+SfwLsmmTnwYPPeCxExGO914JPDTNYqlujqkOa8VcBj2HXc6vgvAO/uhmRcPBb3bmadf7QMfGghcx4d7gD6jErnq6mEfN9Vz4JOB5kBm7SeTwgRI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=V5x3grYn; arc=none smtp.client-ip=209.85.215.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pg1-f182.google.com with SMTP id 41be03b00d2f7-5bdbe2de25fso3353701a12.3 for ; Sun, 10 Mar 2024 19:09:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1710122969; x=1710727769; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Z4ztNqq1FwMuKzBeQUi/UacN3w/fjsndHTJlWkBGBT0=; b=V5x3grYnlf39ATi2x5gJ+tx+fJA6t9oqTTyW8HjdObH38dm/KO9zejrWSjyOUbo1P0 pLJFFu4AWQD8lwtA3WYSPO/7uA610YS8B5EnGcHngvfH1nz8SJpdDQZMOKnD42CBaKx9 uIPjw0+t4vEZ9w0vfp/JQFhjQ3SPC3ghwicBIPjz/QB9Pu7936N6lifaiK5DkiMoiIns SwrSJNy+bUQPlXRjQEn6tVLLH9oOdLpdZQ3rpqFiF/MKBuB/ssqwNEdhrQf32t1iY8sy M2xU0VExBtUc0piW+pYiGB3tUqobV8iQcYPyIhmmPoED8AWe9GIepabFFZBtvUCwlHmq YSpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710122969; x=1710727769; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Z4ztNqq1FwMuKzBeQUi/UacN3w/fjsndHTJlWkBGBT0=; b=xTmtsrJcZrntH/MLLH5txUjmWX0Cg6ys3Q4U1H20t5dpLveFJw4xaGQUT1BUK8ZSR1 ZkSkxEvw+V+VemtnBM64cfjeH6HyNWRQHjkHc9HpG23Z8w2CBVSuqzR92CE9HIUsPQPo 3pXZR80ifQlqKrhlCGszxTeXL2z58Kg3XxG2u01ZDlW/zZIcs7iBPm/fAYWH7GP/5Mly CKV/UG+1zizy4miXBYKOeGlRSkgrk9ATS78kcIewm5OMsxIrsZVwZFQG2lh7jSltkQB/ aorfj3NDU80WNmcsNOK+ENlyMlKlIH6dhO5SAyFiI1Ng9h8Qh7IPxTLrEgNWkd81ZEa8 iECQ== X-Forwarded-Encrypted: i=1; AJvYcCVlDZl+YKktf+h5ggoAvqZgLRJCSQwZekQL84/mQTXiOwn6QEzqOpZ8rr3HWvxk98hYHE/0BYTRxT3HtSS4c7XFpdjst3YU6uQKZRS0 X-Gm-Message-State: AOJu0YzD3NR/byt3KXX1XpKxg+MJdZtBHrnZO/oxhiWYqmjQ11a55b15 vK4mQdnAeWmXwaWfqNHKYA1olZQf2NasYr5byQzmaTYMgP/IgBqFrO4ejsJ5 X-Received: by 2002:a05:6a20:258f:b0:1a0:f5b9:bd88 with SMTP id k15-20020a056a20258f00b001a0f5b9bd88mr7832457pzd.55.1710122968903; Sun, 10 Mar 2024 19:09:28 -0700 (PDT) Received: from localhost.localdomain ([143.92.64.20]) by smtp.gmail.com with ESMTPSA id ky14-20020a170902f98e00b001dd61bc14f2sm3387888plb.8.2024.03.10.19.09.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Mar 2024 19:09:28 -0700 (PDT) From: "brookxu.cn" To: kbusch@kernel.org, axboe@kernel.dk, hch@lst.de, sagi@grimberg.me Cc: kch@nvidia.com, linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v4] nvme: fix reconnection fail due to reserved tag allocation Date: Mon, 11 Mar 2024 10:09:27 +0800 Message-Id: <20240311020927.85482-1-brookxu.cn@gmail.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Chunguang Xu We found a issue on production environment while using NVMe over RDMA, admin_q reconnect failed forever while remote target and network is ok. After dig into it, we found it may caused by a ABBA deadlock due to tag allocation. In my case, the tag was hold by a keep alive request waiting inside admin_q, as we quiesced admin_q while reset ctrl, so the request maked as idle and will not process before reset success. As fabric_q shares tagset with admin_q, while reconnect remote target, we need a tag for connect command, but the only one reserved tag was held by keep alive command which waiting inside admin_q. As a result, we failed to reconnect admin_q forever. In order to fix this issue, I think we should keep two reserved tags for admin queue. Fixes: ed01fee283a0 ("nvme-fabrics: only reserve a single tag") Signed-off-by: Chunguang Xu Reviewed-by: Sagi Grimberg Reviewed-by: Chaitanya Kulkarni Reviewed-by: Christoph Hellwig --- v4: move init value and the comments to the real users v3: rearrange commit log, no code change v2: keep two reserved tags for admin_q instead of drop keep alive request drivers/nvme/host/core.c | 6 ++++-- drivers/nvme/host/fabrics.h | 7 ------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 0a96362912ce..fe3627c5bdc9 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -4359,7 +4359,8 @@ int nvme_alloc_admin_tag_set(struct nvme_ctrl *ctrl, struct blk_mq_tag_set *set, set->ops = ops; set->queue_depth = NVME_AQ_MQ_TAG_DEPTH; if (ctrl->ops->flags & NVME_F_FABRICS) - set->reserved_tags = NVMF_RESERVED_TAGS; + /* Reserved for fabric connect and keep alive */ + set->reserved_tags = 2; set->numa_node = ctrl->numa_node; set->flags = BLK_MQ_F_NO_SCHED; if (ctrl->ops->flags & NVME_F_BLOCKING) @@ -4428,7 +4429,8 @@ int nvme_alloc_io_tag_set(struct nvme_ctrl *ctrl, struct blk_mq_tag_set *set, if (ctrl->quirks & NVME_QUIRK_SHARED_TAGS) set->reserved_tags = NVME_AQ_DEPTH; else if (ctrl->ops->flags & NVME_F_FABRICS) - set->reserved_tags = NVMF_RESERVED_TAGS; + /* Reserved for fabric connect */ + set->reserved_tags = 1; set->numa_node = ctrl->numa_node; set->flags = BLK_MQ_F_SHOULD_MERGE; if (ctrl->ops->flags & NVME_F_BLOCKING) diff --git a/drivers/nvme/host/fabrics.h b/drivers/nvme/host/fabrics.h index 06cc54851b1b..37c974c38dcb 100644 --- a/drivers/nvme/host/fabrics.h +++ b/drivers/nvme/host/fabrics.h @@ -18,13 +18,6 @@ /* default is -1: the fail fast mechanism is disabled */ #define NVMF_DEF_FAIL_FAST_TMO -1 -/* - * Reserved one command for internal usage. This command is used for sending - * the connect command, as well as for the keep alive command on the admin - * queue once live. - */ -#define NVMF_RESERVED_TAGS 1 - /* * Define a host as seen by the target. We allocate one at boot, but also * allow the override it when creating controllers. This is both to provide -- 2.25.1