From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9B2EA233954 for ; Fri, 29 May 2026 23:50:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780098616; cv=none; b=ktKzFLSszEe4MsfuBeVKawS5KI4iNVySsIHGvcPO2OdlI39e06E2Sxi+5aMDCKaEKtkIWH/TK7wQY4He5CvhMhXHuSTtI9FQEIDNo1urb1YQbDcfqTi2XQ7ZFiw+OaCJN/zqcvL+rIlmd27x60z9hs4FJXXDE+2eYT6Pt8HRsBA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780098616; c=relaxed/simple; bh=WoDBPj9GGTyZs2bEud49LCyXT1O31cLaChY5U9CWkXQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=X5K6l7TLlaTi1c9R+pD7924Ej8s3Rh+Rh4dfmc0mshw0pIa/1rRz0gMBI0H/6RdXb5MQ9fps+UbfrFn3E/L3EvTcCqI57bB0nM2970szzJ8Br7H1hfTuA8ygGKiuFWD4YtFtqMJOdTTIFpRcz5v+lZC42GPegKi6mpfZn3WbskM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=KVamTLbB; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="KVamTLbB" Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA4691F00893; Fri, 29 May 2026 23:50:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1780098615; bh=DLY5DzRtCqSdJHS1AhA7kLUck0pnN6xgv+TwDnrP08k=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=KVamTLbBRo98mcmRMFGDhw+GT7k6jeDGMQ4FXw8OfO/3ycjg8Ax0d8X5q6308SF2g k9eY7d7oNaQj0JOl9agP4OHPG97xH/pBTN2JP7Kh5PBxgNOTDIhsKf9Zy7erHgYUxt hGDsIhS0ASk11+R6Avm2w49A4UO2Ilz7bmXkpTj1HopsR6fZa9EGqR63uh6vGI4Jry 5FB75r92Pe6ZxOrxx3Picypnvz+jEAGy5UaQjyQhlQI5supHeimfjudQwPA6AxrMpz 9+jNI1PPLbD4H08evnBmcoxCIY+jHGnfyjZkOtkBOt3qZcCPS2jJl/3XzsQNylJ5RP oZtISMDVtrLRg== Date: Fri, 29 May 2026 17:50:13 -0600 From: Keith Busch To: Surabhi Gogte Cc: axboe@kernel.dk, hch@lst.de, sagi@grimberg.me, linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, mkhalfella@purestorage.com, randyj@purestorage.com Subject: Re: [PATCH] nvme-rdma: parallelize I/O queue allocation and startup Message-ID: References: <20260529001354.1003640-1-sgogte@purestorage.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=us-ascii Content-Disposition: inline In-Reply-To: <20260529001354.1003640-1-sgogte@purestorage.com> On Thu, May 28, 2026 at 06:13:54PM -0600, Surabhi Gogte wrote: > Refactor nvme rdma I/O queue setup to use parallel work queues, > combining allocation and startup into a single parallel operation per > queue. This reduces connection and reconnection setup time when there > are delays in establishing connections, which is especially important > for high-core-count hosts. Seems like a good idea. > +struct workqueue_struct *nvme_setup_wq; > +EXPORT_SYMBOL_GPL(nvme_setup_wq); RDMA is the only one using it, so I don't think we want burden the common core with this. But I also think a new workqueue is overkill. Just use the async APIs. Suggestions below: > +static void nvme_rdma_setup_queue_work(struct work_struct *work) > { > - int i, ret = 0; > + struct nvme_rdma_queue *queue = > + container_of(work, struct nvme_rdma_queue, setup_work); static void nvme_rdma_setup_queue_async(void *data, async_cookie_t cookie) { struct nvme_rdma_queue *queue = data; ... } > +static int nvme_rdma_setup_io_queues(struct nvme_rdma_ctrl *ctrl, int first, > + int last, size_t queue_size) > { ... > + for (i = 0; i < nr_queues; i++) { > + struct nvme_rdma_queue *queue = &ctrl->queues[first + i]; > > - nvmf_set_io_queues(opts, nr_io_queues, ctrl->io_queues); > - for (i = 1; i < ctrl->ctrl.queue_count; i++) { > - ret = nvme_rdma_alloc_queue(ctrl, i, > - ctrl->ctrl.sqsize + 1); > - if (ret) > - goto out_free_queues; > + queue->ctrl = ctrl; > + queue->queue_idx = first + i; > + queue->queue_size = queue_size; > + INIT_WORK(&queue->setup_work, nvme_rdma_setup_queue_work); > + queue_work(nvme_setup_wq, &queue->setup_work); > } > > - return 0; > + for (i = 0; i < nr_queues; i++) > + flush_work(&ctrl->queues[first + i].setup_work); And this part can be: ASYNC_DOMAIN_EXCLUSIVE(domain); ... for (i = 0; i < nr_queues; i++) { ... async_schedule_domain(nvme_rdma_setup_queue_async, queue, &domain); } async_synchronize_full_domain(&domain); It's simpler this way.