Received: by 2002:a05:6a10:c604:0:0:0:0 with SMTP id y4csp891407pxt; Fri, 6 Aug 2021 17:09:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1208wPWxRmgqPUAz7aSC6oLECeshmTOLMotmuqTSt7Rt2A+AEvL/gpLxkXpK94HTNWwyf X-Received: by 2002:a02:c9c4:: with SMTP id c4mr10348845jap.67.1628294954242; Fri, 06 Aug 2021 17:09:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628294954; cv=none; d=google.com; s=arc-20160816; b=vApKCOsytOcUjzDPVZpVTPLbPz4c2gTf/KmgiyTAsaDd/8AGvnMzKMg6h7y0zDVg9J yfZcqxIw4Lh8HaWym5RXLV2ax+uDFQm+gw9GT/FsLhrZZb/l1wG3PeKqqMt67I8v00+L L7TsHZE/4W23kTZmOdmb8WigSAmdm9MI2jIkpf1d4h20SqMgsRXCElNeqRhxz5ZSTPTG kIx2uIVjqEDoD/pOP3R4G4xYd73xZWYZ30mj+0Aaq9I9N+K/NH1FbKAy19mW/Y3b1GIn ocfgzsuyRGi4UOJh2/D0J/+bIxhoxn52zmnGFNxGGLxhs4PIO1b34yYxwZvTpBELBKoa rcaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=r3vnzaT72y5e2wz7p02YKqBIGki8uRtZL1NCQSFt+Ng=; b=rliLtyHD/cUwo/iKuUejuowla++YeSP8PM8/MFyCQrlQvRrlWtzOgvG56dpUAMr3TV wyAeq/nDw6RWl6JW50dRVEwbm9/8sl9k9rq8X8pfXadf3Feczu6dJ2KUThsdxnzZ840n 8R1hCeWDkzG+5gw9id9cWWEzaG4bnMOTC8XW0nUJaS5i4LH8LigW/rFs+mIIY4hEJm4t bvi20Wsnbm9L07YvO3gvUKYO8ZmZt5On2BWg9elha40O5mPlpu8fWHyoUcGPNfQ1mLUL vf+21TPdIm+uZCEa606UgULajM8wFEYV3TAl8hRndjq+kwdzn6nUr4EKsmbCNUeNrPJX UFAQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id j17si10916150ilq.87.2021.08.06.17.09.02; Fri, 06 Aug 2021 17:09:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244228AbhHFT5m (ORCPT + 99 others); Fri, 6 Aug 2021 15:57:42 -0400 Received: from mail-pj1-f54.google.com ([209.85.216.54]:46057 "EHLO mail-pj1-f54.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244216AbhHFT5g (ORCPT ); Fri, 6 Aug 2021 15:57:36 -0400 Received: by mail-pj1-f54.google.com with SMTP id m10-20020a17090a34cab0290176b52c60ddso19484833pjf.4 for ; Fri, 06 Aug 2021 12:57:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=r3vnzaT72y5e2wz7p02YKqBIGki8uRtZL1NCQSFt+Ng=; b=VP8tUZITaVTpk4XdtW2CdI7OUYWBku65Tuonjgq85sZW4FU9r/qoVEkYVsDyqUjYBU GjfqLxb5mFL+Rc5m+EXeF7b1NFic09HG539lFlC/wrtH4DlwitJe3vLjGZmTAykzCm1o 525oDXwUTvmQz6SAK7d0KNl1LtV3TEDRnr3P1REgHr0AQZSQBfemI1NRux1RoTvpt340 LsplLMwig3ll6TRv4EGQMw4bPJF2UbPev+IafGA7+i53lUAS9fgCq+1FU6KZ18hsuqOC p+6yEMOCLEDmJAWmMiSSUcwXjOj1iwp7jr4oBL8Kc6wrs6yQzd0wLL2TiisuuTYbkKtt iNrg== X-Gm-Message-State: AOAM533VGQvrIAZZc49UAkeUHbbflkPzHcVBDT+jSAfcQ+WHaxClWd1m C15vojCwO3PIukW0reSNd0M= X-Received: by 2002:a65:51c9:: with SMTP id i9mr7444pgq.102.1628279839583; Fri, 06 Aug 2021 12:57:19 -0700 (PDT) Received: from ?IPv6:2601:647:4802:9070:4a77:cdda:c1bf:a6b7? ([2601:647:4802:9070:4a77:cdda:c1bf:a6b7]) by smtp.gmail.com with ESMTPSA id v25sm11198844pfm.202.2021.08.06.12.57.18 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 06 Aug 2021 12:57:19 -0700 (PDT) Subject: Re: [PATCH v4 2/8] nvme-tcp: Update number of hardware queues before using them To: Daniel Wagner , linux-nvme@lists.infradead.org Cc: linux-kernel@vger.kernel.org, James Smart , Keith Busch , Ming Lei , Hannes Reinecke , Wen Xiong References: <20210802112658.75875-1-dwagner@suse.de> <20210802112658.75875-3-dwagner@suse.de> From: Sagi Grimberg Message-ID: <8373c07f-f5df-1ec6-9fda-d0262fc1b377@grimberg.me> Date: Fri, 6 Aug 2021 12:57:17 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210802112658.75875-3-dwagner@suse.de> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > From: Hannes Reinecke > > When the number of hardware queues changes during resetting we should > update the tagset first before using it. > > Signed-off-by: Hannes Reinecke > Signed-off-by: Daniel Wagner > --- > drivers/nvme/host/tcp.c | 14 ++++++-------- > 1 file changed, 6 insertions(+), 8 deletions(-) > > diff --git a/drivers/nvme/host/tcp.c b/drivers/nvme/host/tcp.c > index 0a97ba02f61e..32268f24f62a 100644 > --- a/drivers/nvme/host/tcp.c > +++ b/drivers/nvme/host/tcp.c > @@ -1789,6 +1789,7 @@ static void nvme_tcp_destroy_io_queues(struct nvme_ctrl *ctrl, bool remove) > static int nvme_tcp_configure_io_queues(struct nvme_ctrl *ctrl, bool new) > { > int ret; > + u32 prior_q_cnt = ctrl->queue_count; > > ret = nvme_tcp_alloc_io_queues(ctrl); > if (ret) > @@ -1806,14 +1807,7 @@ static int nvme_tcp_configure_io_queues(struct nvme_ctrl *ctrl, bool new) > ret = PTR_ERR(ctrl->connect_q); > goto out_free_tag_set; > } > - } > - > - ret = nvme_tcp_start_io_queues(ctrl); > - if (ret) > - goto out_cleanup_connect_q; > - > - if (!new) { > - nvme_start_queues(ctrl); > + } else if (prior_q_cnt != ctrl->queue_count) { So if the queue count did not change we don't wait to make sure the queue g_usage_counter ref made it to zero? What guarantees that it did? > if (!nvme_wait_freeze_timeout(ctrl, NVME_IO_TIMEOUT)) { > /* > * If we timed out waiting for freeze we are likely to > @@ -1828,6 +1822,10 @@ static int nvme_tcp_configure_io_queues(struct nvme_ctrl *ctrl, bool new) > nvme_unfreeze(ctrl); > } > > + ret = nvme_tcp_start_io_queues(ctrl); > + if (ret) > + goto out_cleanup_connect_q; > + Did you test this with both heavy I/O, reset loop and ifdown/ifup loop? If we unquiesce and unfreeze before we start the queues the pending I/Os may resume before the connect and not allow the connect to make forward progress. > return 0; > > out_wait_freeze_timed_out: >