Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1082617ybt; Wed, 1 Jul 2020 18:25:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyICCV02DjY2T1XUOex8l/wyhBagQ9VvRKEmT+ObDHAeE0bvTXeHwEZ2ck/8NHjCDt6Ppi7 X-Received: by 2002:a17:906:1747:: with SMTP id d7mr17265815eje.39.1593653118236; Wed, 01 Jul 2020 18:25:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593653118; cv=none; d=google.com; s=arc-20160816; b=gIoNDoaVDBtHiCOT7HbZXC3KbcSUy2S3KOmJ2vCzXXIPxKsOGvOV3+J/yn9EL1jy3o 4Q+YQZ+WfXeD9hMEvr3OBOQwBZZcceiBI/8y3XA46N82ExODeKlIiVIDEKRoh6DjVHvi a/yrZ9FLsqk9WQOQVSIGCDqsoZx8VSrUXLRH8xX2+EIQnlJeIo0A/BrrGRjLEGzYAmzF VQEvxZl97cceSnxMRmX16fhnImsxrlNpPUkCGEKq9v/6jBFLC6wGQctT4FGWJpR8XBYc qincgdrbkB/RHU0mlsZ3k0FLTfbpUyv1v27etudwTdUzePWZcvROa/QZUlnh3dOHeecu bn2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=is5INy3L6/H2rtUhtIUc6kQfgSEvbtbKFxK+PJgbMeY=; b=h36majcMJFk1OBDPGnr28RbVb5JiEiqfZSrAqoFMQNb1RiS8mTybBjVvRCeoKIDC7j xbk2+TSTZn8HACbJ2/FNOB4Ulnmg5S2rQY/ZMFlgxGZYr09jSYVlrUBS0D8LZmRPXRkb I/T3OGiX9pcopCmRSd5ma1YkQ6JXxCckmuHplp8cOWLlof5DVwhx6xCU0FFa7yzeTrO3 DsEK4oI3ICTQEC8/IH+r6D13EV/vfW0Z1x63WziDe7UcRef6c8kZ/DhCNftduW9JFb+S +CYv3WKb3HbrWTPzv1464A7sOve9gHMq7/93/ZgCtajTdIBMnyUTdrPGV7fUJrj4MiyH /Lpw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=F5ZHT+iQ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o6si5001468ejn.680.2020.07.01.18.24.55; Wed, 01 Jul 2020 18:25:18 -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; dkim=pass header.i=@kernel.org header.s=default header.b=F5ZHT+iQ; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728598AbgGBBYI (ORCPT + 99 others); Wed, 1 Jul 2020 21:24:08 -0400 Received: from mail.kernel.org ([198.145.29.99]:54690 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728521AbgGBBXy (ORCPT ); Wed, 1 Jul 2020 21:23:54 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0C8272082F; Thu, 2 Jul 2020 01:23:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593653033; bh=gYrUy+2BPIkfxEAcimiUvhDES1CyrM816VquNjMev6s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=F5ZHT+iQ2wRGiCYcw/IkRiVnhCkVmv/YEzZ5bH4EWsRTMyW5pJrLDTBGCn6lIpFSu Y184QWXHgBsIYa7zzZgtqQkrbHge2wbvJl1OYl4hQ25KnA6Yc97jHW1mmjmZgjD9wZ tgzdW4xc9IogIot0cYmR+H8ionQBmUSN5x9kG8hY= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Max Gurtovoy , Christoph Hellwig , Sasha Levin , linux-nvme@lists.infradead.org Subject: [PATCH AUTOSEL 5.7 47/53] nvme-rdma: assign completion vector correctly Date: Wed, 1 Jul 2020 21:21:56 -0400 Message-Id: <20200702012202.2700645-47-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200702012202.2700645-1-sashal@kernel.org> References: <20200702012202.2700645-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Max Gurtovoy [ Upstream commit 032a9966a22a3596addf81dacf0c1736dfedc32a ] The completion vector index that is given during CQ creation can't exceed the number of support vectors by the underlying RDMA device. This violation currently can accure, for example, in case one will try to connect with N regular read/write queues and M poll queues and the sum of N + M > num_supported_vectors. This will lead to failure in establish a connection to remote target. Instead, in that case, share a completion vector between queues. Signed-off-by: Max Gurtovoy Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin --- drivers/nvme/host/rdma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c index cac8a930396a0..1f9a45145d0d3 100644 --- a/drivers/nvme/host/rdma.c +++ b/drivers/nvme/host/rdma.c @@ -443,7 +443,7 @@ static int nvme_rdma_create_queue_ib(struct nvme_rdma_queue *queue) * Spread I/O queues completion vectors according their queue index. * Admin queues can always go on completion vector 0. */ - comp_vector = idx == 0 ? idx : idx - 1; + comp_vector = (idx == 0 ? idx : idx - 1) % ibdev->num_comp_vectors; /* Polling queues need direct cq polling context */ if (nvme_rdma_poll_queue(queue)) -- 2.25.1