Received: by 2002:ab2:687:0:b0:1f4:6588:b3a7 with SMTP id s7csp223151lqe; Tue, 9 Apr 2024 23:02:00 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVpjeScF7viKb+AfwL5fYlLFZ5J0qxUTGYRHIccyNHpzeWk7y/nASMEzC8Er8zbj00vQpkK5VI0v51LcWvQseKZhz2kuAfZHMB1BRCBYQ== X-Google-Smtp-Source: AGHT+IGzhDQaHWvASOse+UAoT8j0OdAywzApRYsqVhw12X3J3BhZHc004jKg5JzUc5uoxMKy5nJE X-Received: by 2002:a05:6358:980c:b0:186:24ee:8052 with SMTP id y12-20020a056358980c00b0018624ee8052mr2200921rwa.12.1712728920286; Tue, 09 Apr 2024 23:02:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712728920; cv=pass; d=google.com; s=arc-20160816; b=WMilaP42eurLjdvO6nEw8ki1jpRdm9L5HFhWXgZvDYj7fCTe052mr6JMAJXawev39/ AN4X6wYxOxi/y8/ahy3iWYXB38RuT+QyNdQvx1sEbresD5yvbrJ4nZZ8lv+NmpyxAShd zB44ZKq3x6v2Uhwmip7F/5fOAPCagfBw585YW/lqwoJie2Jh54nbe0JVQeiEZuiHBejW TBz3u+ptN3hfKE1czg3WfAlYUJve/aDsd0aPmVOEMF3nUpkgLWnwt9i4UyY2HWvvJR0W t+xmKFXcQ+7eH0kXADkCR0nc9bSAK/DKSkv8ibB9EQho8057wmesPo4d+AW3LBdJmhwh OsHg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature :dkim-signature:dkim-signature:dkim-signature; bh=d0M7jKhmdMOsWzkxHcH3wZyl/PZBBuzlnSutY/U1M5s=; fh=/5KKe8PHGvAACs7zPR5H1382/9hkTY5X3D4agDK3mrQ=; b=PGVncRNBillZUsrp1eIk6ufz4/T1tjNcbECgh/hzPSV332+N+MNbwE+TYak6m4tFCX PWbtnRobF+oueQllgQEZYYf24/FdFrzX+UBhDiRoV7hITxE9ct6lPIgQifaGCWvEfGTn X4FDkVj3eaD/2IDY9vB1TFlrdlI6plDhCjcA+TKpVaxc3JKxkqJ5hSkuvXhmOtLxLuSP 55HlRLkgHDD9RsiLg29B9nu6SwlJOf5s/DyExVJyBM4A23SJqN1M1Z1SGObjDoT5eva0 WnfyDJi/2dUOn5IaNxjSNNEpVrx456SK+RuE9gmsSKsAR+8QJI7V50ag+1mk1NMKgm5j dNUw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=DrnA2H3g; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b="x59rp1/Z"; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=DrnA2H3g; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.de dkim=pass dkdomain=suse.de dkim=pass dkdomain=suse.de dmarc=pass fromdomain=suse.de); spf=pass (google.com: domain of linux-kernel+bounces-137955-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-137955-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id p17-20020a63c151000000b005f0a54c1d8csi10145755pgi.838.2024.04.09.23.01.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Apr 2024 23:02:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-137955-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=DrnA2H3g; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519 header.b="x59rp1/Z"; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=DrnA2H3g; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.de dkim=pass dkdomain=suse.de dkim=pass dkdomain=suse.de dmarc=pass fromdomain=suse.de); spf=pass (google.com: domain of linux-kernel+bounces-137955-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-137955-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id AF4942841E3 for ; Wed, 10 Apr 2024 06:01:59 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 495D7200D9; Wed, 10 Apr 2024 06:01:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="DrnA2H3g"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="x59rp1/Z"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="DrnA2H3g"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="x59rp1/Z" Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (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 BBC2D17745 for ; Wed, 10 Apr 2024 06:01:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712728914; cv=none; b=Fdc7Jipj5rHu6/WAcyQokSk30VHp4qz1UmOluOUB0PRwliLHkvmNH/eS7oaAFHDmRkbyW60pJd1/7k/6oeg+iVgj8RTA29+cF42EfiSyJb1MQsf64PcWWawYUWW5ctazgwj7032eDewCJJJnftJY/2ESLE/Bgzm7Vf21ZgeTxi4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712728914; c=relaxed/simple; bh=ZaYlA2FxEECAx2ZAnSZ+wzX32SObTTpNIzT6AyS6Ik8=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=swk4R4Ng3BXmXECcwtHAjp87oa0wV9cPyGnIm4MihlJIMwaJpfbdIZEOL90QcuVezGTxszeLaxhxGKPsUytIHZQ0MeZaz8h48+a9BC4mq8OqrJEGoLooRXDwQ3yww5WOe715YdvsaFv+jHl2iSTs3j7RyXyttwJB4vPf1CtCSBE= 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=DrnA2H3g; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=x59rp1/Z; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=DrnA2H3g; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=x59rp1/Z; arc=none smtp.client-ip=195.135.223.131 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 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [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-out2.suse.de (Postfix) with ESMTPS id D0EE15C556; Wed, 10 Apr 2024 06:01:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1712728910; 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=d0M7jKhmdMOsWzkxHcH3wZyl/PZBBuzlnSutY/U1M5s=; b=DrnA2H3ghV+heTuVaOtxI73/hJf8WSaFu97lNbJLTH0t97GQlwfbT0YmlFfXs3wldzpp8y zLDI68+iNlaQPggs2yt0ze31CBhbjKAfNnHEC289RyDQ3DRqqFBo2Pjd1HMB/mqATVBiWV WZsUKofuu+GJ4wfzxyRcj+cz/mQ5ixc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1712728910; 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=d0M7jKhmdMOsWzkxHcH3wZyl/PZBBuzlnSutY/U1M5s=; b=x59rp1/Zq4R3FFovqSee2qBOr4y9xzyLtOuM/4eBWHigwhjL/At1aVhcTYkBba7RoO4KCM GSKE7w/kQGNRFhAw== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1712728910; 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=d0M7jKhmdMOsWzkxHcH3wZyl/PZBBuzlnSutY/U1M5s=; b=DrnA2H3ghV+heTuVaOtxI73/hJf8WSaFu97lNbJLTH0t97GQlwfbT0YmlFfXs3wldzpp8y zLDI68+iNlaQPggs2yt0ze31CBhbjKAfNnHEC289RyDQ3DRqqFBo2Pjd1HMB/mqATVBiWV WZsUKofuu+GJ4wfzxyRcj+cz/mQ5ixc= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1712728910; 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=d0M7jKhmdMOsWzkxHcH3wZyl/PZBBuzlnSutY/U1M5s=; b=x59rp1/Zq4R3FFovqSee2qBOr4y9xzyLtOuM/4eBWHigwhjL/At1aVhcTYkBba7RoO4KCM GSKE7w/kQGNRFhAw== 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 1965513691; Wed, 10 Apr 2024 06:01:49 +0000 (UTC) Received: from dovecot-director2.suse.de ([10.150.64.162]) by imap1.dmz-prg2.suse.org with ESMTPSA id 8/i3Ok0rFmYZFQAAD6G6ig (envelope-from ); Wed, 10 Apr 2024 06:01:49 +0000 Message-ID: Date: Wed, 10 Apr 2024 08:01:49 +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 v5 3/6] nvme-tcp: short-circuit reconnect retries Content-Language: en-US To: Sagi Grimberg , Daniel Wagner , Christoph Hellwig Cc: Keith Busch , James Smart , linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org References: <20240409093510.12321-1-dwagner@suse.de> <20240409093510.12321-4-dwagner@suse.de> From: Hannes Reinecke In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Level: X-Spamd-Result: default: False [-4.29 / 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]; XM_UA_NO_VERSION(0.01)[]; RCPT_COUNT_SEVEN(0.00)[7]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_TLS_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; 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)[suse.de:email,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns] X-Spam-Score: -4.29 X-Spam-Flag: NO On 4/9/24 22:20, Sagi Grimberg wrote: > > > On 09/04/2024 12:35, Daniel Wagner wrote: >> From: Hannes Reinecke >> >> Returning an nvme status from nvme_tcp_setup_ctrl() indicates that the >> association was established and we have received a status from the >> controller; consequently we should honour the DNR bit. If not any future >> reconnect attempts will just return the same error, so we can >> short-circuit the reconnect attempts and fail the connection directly. >> >> Signed-off-by: Hannes Reinecke >> [dwagner: add helper to decide to reconnect] >> Signed-off-by: Daniel Wagner >> --- >>   drivers/nvme/host/nvme.h | 24 ++++++++++++++++++++++++ >>   drivers/nvme/host/tcp.c  | 23 +++++++++++++++-------- >>   2 files changed, 39 insertions(+), 8 deletions(-) >> >> diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h >> index 9b8904a476b8..dfe103283a3d 100644 >> --- a/drivers/nvme/host/nvme.h >> +++ b/drivers/nvme/host/nvme.h >> @@ -701,6 +701,30 @@ static inline bool nvme_is_path_error(u16 status) >>       return (status & 0x700) == 0x300; >>   } >> +/* >> + * Evaluate the status information returned by the LLDD in order to >> + * decided if a reconnect attempt should be scheduled. >> + * >> + * There are two cases where no reconnect attempt should be attempted: >> + * >> + * 1) The LLDD reports an negative status. There was an error (e.g. no >> + *    memory) on the host side and thus abort the operation. >> + *    Note, there are exception such as ENOTCONN which is >> + *    not an internal driver error, thus we filter these errors >> + *    out and retry later. >> + * 2) The DNR bit is set and the specification states no further >> + *    connect attempts with the same set of paramenters should be >> + *    attempted. >> + */ >> +static inline bool nvme_ctrl_reconnect(int status) >> +{ >> +    if (status < 0 && status != -ENOTCONN) >> +        return false; > > So if the host failed to allocate a buffer it will never attempt > another reconnect? doesn't sound right to me.., Memory allocation errors are always tricky. If a system is under memory pressure yours won't be the only process which will exhibit issues, so it's questionable whether you should retry, or whether it wouldn't be safer to just abort the operation, and retry manually once the system has recovered. Also we just have the interesting case where RDMA goes haywire and reports a log buffer size of several TB. No amount of retries will be fixing that. 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