From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (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 E99AB33C1BE for ; Mon, 12 Jan 2026 08:14:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768205677; cv=none; b=oVOVjtI+Y2i+jtBBb5ccb1qUmulKTIXttK1gLqKF72NZ8ZHGztEWldQjkez7rIddV0J/YWcuMsejQ4gNx2ReC0Kr1rh1KxAwpDrWpoaoxxZuYahgbvCPxq3V2dDZB2r/bERWYxz+OHVtHxl41hbuSCSJlCVoD03nMZ0GnmIEV7o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768205677; c=relaxed/simple; bh=2kWO9N5f3cGs+xLSeIcVJMKs7qa5+rcfzplNGzizzNM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=G649aWcYSflrmlydsEdX7Zu9/5tsPchDg1SvHKjjdF76AwRPY+LAz5cnccNCYvXTbnBQPWa1eb0Q1KES1D9Y79Tfz+phypR0l/pYV9ACsgzTMybl1mpNfP7Noj2JnupjGteNX3bmxd99nLynqwtOigiPVGifnkWZBXOV/lOKU5o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=GYTrSpdA; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=Fv82jdWZ; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=GYTrSpdA; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=Fv82jdWZ; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="GYTrSpdA"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="Fv82jdWZ"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="GYTrSpdA"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="Fv82jdWZ" Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (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) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 051323368A; Mon, 12 Jan 2026 08:14:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1768205674; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vbQKFXf75/9z+KsVmUVjAw2+bYHqvjMxoGvu5Jn9ktQ=; b=GYTrSpdAu+EeKlgtejFsE1D1RTqtDNpVm7fz4FqPgTiPcxbZsAMDqPG4SmiLtvf36HZL7Y 0sh80/11ub2H21k7Y1p0guuAgbSHIXiBekVXMH99/hW2fpmFeD0gaRAUNCYOdcLftp2+Bo M3M+3sy9KvOVOnnJpU/Hz9ONZGITG/g= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1768205674; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vbQKFXf75/9z+KsVmUVjAw2+bYHqvjMxoGvu5Jn9ktQ=; b=Fv82jdWZlSNKj2P3mltQtd7tb2Z3Dcc8AVIdA28Pfyhumd6XEnwLXYksP69N09MVxfkxD1 5wxwGBmoatS7DsDA== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1768205674; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vbQKFXf75/9z+KsVmUVjAw2+bYHqvjMxoGvu5Jn9ktQ=; b=GYTrSpdAu+EeKlgtejFsE1D1RTqtDNpVm7fz4FqPgTiPcxbZsAMDqPG4SmiLtvf36HZL7Y 0sh80/11ub2H21k7Y1p0guuAgbSHIXiBekVXMH99/hW2fpmFeD0gaRAUNCYOdcLftp2+Bo M3M+3sy9KvOVOnnJpU/Hz9ONZGITG/g= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1768205674; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vbQKFXf75/9z+KsVmUVjAw2+bYHqvjMxoGvu5Jn9ktQ=; b=Fv82jdWZlSNKj2P3mltQtd7tb2Z3Dcc8AVIdA28Pfyhumd6XEnwLXYksP69N09MVxfkxD1 5wxwGBmoatS7DsDA== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (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) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id E4B5B3EA63; Mon, 12 Jan 2026 08:14:33 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 4HcIN2mtZGnscAAAD6G6ig (envelope-from ); Mon, 12 Jan 2026 08:14:33 +0000 Date: Mon, 12 Jan 2026 09:14:33 +0100 From: Daniel Wagner To: Nilay Shroff Cc: John Meneghini , Daniel Wagner , Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg , James Smart , Hannes Reinecke , Shinichiro Kawasaki , Wen Xiong , Narayana Murty N , linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, Ewan Milne , Maurizio Lombardi Subject: Re: [PATCH 1/2] nvme: only allow entering LIVE from CONNECTING state Message-ID: References: <20250214-nvme-fc-fixes-v1-0-7a05d557d5cc@kernel.org> <20250214-nvme-fc-fixes-v1-1-7a05d557d5cc@kernel.org> <8574c297-fc02-40d6-ba67-ab43e3d5e394@redhat.com> <833fd772-da6c-4f91-87e3-e13883f1815d@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <833fd772-da6c-4f91-87e3-e13883f1815d@linux.ibm.com> X-Spamd-Result: default: False [-4.30 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; MISSING_XM_UA(0.00)[]; RCPT_COUNT_TWELVE(0.00)[16]; FUZZY_RATELIMITED(0.00)[rspamd.com]; RCVD_TLS_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo] X-Spam-Flag: NO X-Spam-Score: -4.30 X-Spam-Level: Hi Nilay, On Sun, Jan 11, 2026 at 03:03:43PM +0530, Nilay Shroff wrote: > This was broken because with this commit d2fe192348f9 (“nvme: only allow entering LIVE > from CONNECTING state”) now we don't allow changing controller state from > RESETTING -> LIVE. I saw we also had similar state change issue with firmware activation > code which was fixed by explicitly transitioning the controller state through RESETTING -> > CONNECTING -> LIVE. We may employ the similar solution here for subsystem reset case as well. > > Currently, the NVMe PCIe subsystem reset code performs the following steps: > > 1. Sets the controller state to RESETTING > 2. Writes the subsystem reset command to the NSSR register > 3. Attempts to transition the controller state directly to LIVE > > This effectively bypasses the CONNECTING state. The transition to LIVE is artificial but > intentional, since writing to the NSSR register causes the loss of communication with the > NVMe adapter and the controller must be marked LIVE so that any in-flight I/O at the time the > subsystem reset is issued, or an explicit MMIO read, can trigger EEH recovery and ultimately > restore communication link between the NVMe adapter and the system. > > With the stricter state transition rules introduced by commit d2fe192348f9 (“nvme: only allow > entering LIVE from CONNECTING state”), the direct transition from RESETTING -> LIVE is no longer > permitted, rendering the current logic ineffective. > > Taking a cue from the firmware activation fix, it seems reasonable to explicitly transition > the controller state through CONNECTING in the subsystem reset path as well. So how about making > the following change to fix this? > > diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c > index 0e4caeab739c..3027bba232de 100644 > --- a/drivers/nvme/host/pci.c > +++ b/drivers/nvme/host/pci.c > @@ -1532,7 +1532,10 @@ static int nvme_pci_subsystem_reset(struct nvme_ctrl *ctrl) > } > > writel(NVME_SUBSYS_RESET, dev->bar + NVME_REG_NSSR); > - nvme_change_ctrl_state(ctrl, NVME_CTRL_LIVE); > + > + if (!nvme_change_ctrl_state(ctrl, NVME_CTRL_CONNECTING) || > + !nvme_change_ctrl_state(ctrl, NVME_CTRL_LIVE)) > + goto unlock; > > /* > * Read controller status to flush the previous write and trigger a This seems to be similar to case where the firmware update got stuck [1]. 650415fca0a9 ("nvme: unblock ctrl state transition for firmware update") >From my understanding this should work, but it's probably better to double check that this doesn't violate any assumptions. [1] https://lore.kernel.org/all/aBJJQoOBhaXj7P36@kbusch-mbp/ Thanks, Daniel