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 56F4D2571BE for ; Tue, 7 Apr 2026 05:39:12 +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=1775540353; cv=none; b=kEOOp8EBRL1bSHiZigHYn2u2wfgcSs+hNbib5kJ6cplfL+VGrlw7vey3ELGxR4KofRa0hayyVyDY23K21ChBIr08gsekqzN0rG1szFNRMkHBjInfMvlNlw+J23mAtjy3E8S2/WT9/uEBmrbt7Lz5aGLmJRzMbg1oWq/R2rqgU8Q= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775540353; c=relaxed/simple; bh=zAWnRWz/Ab0bQRZQ+gXmwVx1oHiHRaAfcqJ6RwlxgVI=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=t0o6hPEOLk92xFicWvNtiuuAwFUaHcHsYIqja6D+F7ozagYtBQna0MGVb3ycdiZWd8a3tPAQNjr6UYtzgqo8hRoI13MIyPr1sscO8s9oXSKEAf/MkvBgqjwN57Y1JgCvQA4IYiQ/TQRQu0Ybs4GTXvsTgc6GVMGnsYHAirEgqLU= 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=UOYVWWB6; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=u1EiM68h; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=UOYVWWB6; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=u1EiM68h; 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="UOYVWWB6"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="u1EiM68h"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="UOYVWWB6"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="u1EiM68h" Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104: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 724D34E2B3; Tue, 7 Apr 2026 05:39:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1775540350; 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=GionfvfpXdho8bSgUgv2S/UxEe7l6eDaHJFyaw0ZCpU=; b=UOYVWWB66o7q7qLs+QNigb+NxYNkYpiZdntHMSKfG3Tqy7tuZPiPV5Tz5HXsdUYPT1uKry Co0Ugy2lGajx2JGlVx2jGpd16lacqkgTFZ1HtSbN1fUOkHEjchAhIypw6ZRiNGC5681qj0 PGNUrEF8Wk78l1LjFcw9qZ0i/rp63c8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1775540350; 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=GionfvfpXdho8bSgUgv2S/UxEe7l6eDaHJFyaw0ZCpU=; b=u1EiM68hlYFJjXaR8irj8AQs9hhXV6G9TRnK6+6A4Bi52GdNyQ2A43xGd4uBWFqs5twfby IPwWcB3ofqOIQqDw== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=UOYVWWB6; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=u1EiM68h DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1775540350; 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=GionfvfpXdho8bSgUgv2S/UxEe7l6eDaHJFyaw0ZCpU=; b=UOYVWWB66o7q7qLs+QNigb+NxYNkYpiZdntHMSKfG3Tqy7tuZPiPV5Tz5HXsdUYPT1uKry Co0Ugy2lGajx2JGlVx2jGpd16lacqkgTFZ1HtSbN1fUOkHEjchAhIypw6ZRiNGC5681qj0 PGNUrEF8Wk78l1LjFcw9qZ0i/rp63c8= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1775540350; 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=GionfvfpXdho8bSgUgv2S/UxEe7l6eDaHJFyaw0ZCpU=; b=u1EiM68hlYFJjXaR8irj8AQs9hhXV6G9TRnK6+6A4Bi52GdNyQ2A43xGd4uBWFqs5twfby IPwWcB3ofqOIQqDw== 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 23ADD4A0B0; Tue, 7 Apr 2026 05:39:10 +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 MYuGB36Y1GnjZQAAD6G6ig (envelope-from ); Tue, 07 Apr 2026 05:39:10 +0000 Message-ID: <5d3fecf4-9101-4028-858d-bfbbccf3d8d3@suse.de> Date: Tue, 7 Apr 2026 07:39:09 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 08/15] nvme: Implement cross-controller reset recovery To: Mohamed Khalfella Cc: Justin Tee , Naresh Gottumukkala , Paul Ely , Chaitanya Kulkarni , Jens Axboe , Keith Busch , Sagi Grimberg , James Smart , Aaron Dailey , Randy Jennings , Dhaval Giani , linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org References: <20260328004518.1729186-1-mkhalfella@purestorage.com> <20260328004518.1729186-9-mkhalfella@purestorage.com> <20260331164733.GC2861-mkhalfella@purestorage.com> Content-Language: en-US From: Hannes Reinecke In-Reply-To: <20260331164733.GC2861-mkhalfella@purestorage.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spamd-Result: default: False [-4.51 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; RCVD_TLS_ALL(0.00)[]; FUZZY_RATELIMITED(0.00)[rspamd.com]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_TWELVE(0.00)[14]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; MID_RHS_MATCH_FROM(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_HAS_DN(0.00)[]; FREEMAIL_CC(0.00)[broadcom.com,gmail.com,nvidia.com,kernel.dk,kernel.org,grimberg.me,purestorage.com,lists.infradead.org,vger.kernel.org]; TO_DN_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,suse.de:dkim,suse.de:email]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Spam-Flag: NO X-Spam-Score: -4.51 X-Spam-Level: X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Rspamd-Queue-Id: 724D34E2B3 On 3/31/26 18:47, Mohamed Khalfella wrote: > On Mon 2026-03-30 12:50:24 +0200, Hannes Reinecke wrote: >> On 3/28/26 01:43, Mohamed Khalfella wrote: >>> A host that has more than one path connecting to an nvme subsystem >>> typically has an nvme controller associated with every path. This is >>> mostly applicable to nvmeof. If one path goes down, inflight IOs on that >>> path should not be retried immediately on another path because this >>> could lead to data corruption as described in TP4129. TP8028 defines >>> cross-controller reset mechanism that can be used by host to terminate >>> IOs on the failed path using one of the remaining healthy paths. Only >>> after IOs are terminated, or long enough time passes as defined by >>> TP4129, inflight IOs should be retried on another path. Implement core >>> cross-controller reset shared logic to be used by the transports. >>> >>> Signed-off-by: Mohamed Khalfella >>> --- >>> drivers/nvme/host/constants.c | 1 + >>> drivers/nvme/host/core.c | 145 ++++++++++++++++++++++++++++++++++ >>> drivers/nvme/host/nvme.h | 9 +++ >>> 3 files changed, 155 insertions(+) >>> [ .. ] >>> + >>> +int nvme_fence_ctrl(struct nvme_ctrl *ictrl) >>> +{ >>> + unsigned long deadline, timeout; >>> + struct nvme_ctrl *sctrl; >>> + u32 min_cntlid = 0; >>> + int ret; >>> + >>> + timeout = nvme_fence_timeout_ms(ictrl); >>> + dev_info(ictrl->device, "attempting CCR, timeout %lums\n", timeout); >>> + >>> + deadline = jiffies + msecs_to_jiffies(timeout); >>> + while (time_is_after_jiffies(deadline)) { >>> + sctrl = nvme_find_ctrl_ccr(ictrl, min_cntlid); >>> + if (!sctrl) { >>> + dev_dbg(ictrl->device, >>> + "failed to find source controller\n"); >>> + return -EIO; >>> + } >>> + >>> + ret = nvme_issue_wait_ccr(sctrl, ictrl, deadline); >>> + if (!ret) { >>> + dev_info(ictrl->device, "CCR succeeded using %s\n", >>> + dev_name(sctrl->device)); >>> + nvme_put_ctrl_ccr(sctrl); >>> + return 0; >>> + } >>> + >>> + min_cntlid = sctrl->cntlid + 1; >>> + nvme_put_ctrl_ccr(sctrl); >>> + >>> + if (ret == -EIO) /* CCR command failed */ >>> + continue; >>> + >>> + /* CCR operation failed or timed out */ >>> + return ret; >>> + } >>> + >>> + dev_info(ictrl->device, "CCR operation timeout\n"); >>> + return -ETIMEDOUT; >>> +} >> >> Please restructure the loop. >> Having a comment 'CCR operation failed or timed out', >> returning a status, and then have a comment >> 'CCR operation timeout' _after_ the return is confusing. > > I can change /* CCR operation failed or timed out */ to something like > > /* > * Source controller accepted CCR command but CCR operation > * timed out or failed. Retrying another path is not likely > * to succeed, return an error. > */ > > And change the log line "CCR operation timeout\n" outside the while > loop to "fencing timedout\n". > > Will this help? > Yes, thank you. Cheers, Hannes -- Dr. Hannes Reinecke Kernel Storage Architect hare@suse.de +49 911 74053 688 SUSE Software Solutions GmbH, Frankenstr. 146, 90461 Nürnberg HRB 36809 (AG Nürnberg), GF: I. Totev, A. McDonald, W. Knoblich