Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1980036ybh; Tue, 14 Jul 2020 12:11:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzOk8CcFMKB1VIrrp0H4VBhy1dWRjcQWRIcVUfiA5bcT3gSmL3oz1PCFKffuyN4f76RVwuP X-Received: by 2002:a17:907:1114:: with SMTP id qu20mr6119066ejb.41.1594753876183; Tue, 14 Jul 2020 12:11:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594753876; cv=none; d=google.com; s=arc-20160816; b=nVsKtwVQReyypGKaRKLgeHDVTgwCql3VW+nOKP9YJNKVBheQwCTfI+PpqohtHsi31L Ks5CzXtf0ksgxWV9Tnfk4/oVLPioe/GD3Fz6uU9081SSMxZMFWzz+OgJilszwtCmloBp D03SkvsN0aerOJKO9sCemoKnqy2hnNacVswZHlG1Fmu8AoU33XXWaVUGtQqRoMO9hWb4 uo8c5YHilc4K8lpJtYrILUAbVpq0NHCirZVpt8xlI+ZldJfQAaHSwDxgZgoE5OB3pwi8 n/LukYI8z4sHxzBlGlqaIvxXMRGa6v/KCCKu06zdA1eHwHcjgaMhyyirUNhOgLiS7zPv BAXA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=vHwK18KjVVgVTOg4MF+e0QbUrF80rred4uqCzLQb8gw=; b=D9Hxk4pVPLtNFCpFWLBc2l3TYxH6pdI+T6yKH96RNesgnYY4ctLIY/1H+mVLlbAGHU oomCIIVxmELxA/pZNmEb7tD9Lb2hHMmEZr7nD6U4+Yd6yUhZmnhtMimuKfDEymMJxJDp U9BYkQV2HqP2Vd7ztyNSKTea1nx8NPzBbcDOLdXcqon40htfgMGrFDlRhQv+Kz1RmPV4 TPWJXUd6+lZpjSZ9jQvONozu8o0aXcQIzApRb0o7wZsV5b3LQPxgmtj1fa3vlxKSITwg YKXKSdtSWRH0aIKujWniGABXh2kgcNKwr0KhojFpOLVrYnXj457GtsrxJ9gzt7BFY66G uJDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=opVQyVaH; 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 ds2si15471014ejc.114.2020.07.14.12.10.52; Tue, 14 Jul 2020 12:11:16 -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=opVQyVaH; 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 S1730199AbgGNStr (ORCPT + 99 others); Tue, 14 Jul 2020 14:49:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:45588 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729612AbgGNSto (ORCPT ); Tue, 14 Jul 2020 14:49:44 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 98A7F222E9; Tue, 14 Jul 2020 18:49:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594752584; bh=LfinL+qf+xYekFkB6evl9bPpa9Gp5TmB/+oAhC/yJoM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=opVQyVaHZg6ZWnUY6dYKv78REJuQIcMo3auwCQWaNJMWSd79q2n3jdKQ7pWWWTJql GZfyejZkcrwShZhzwRPpqCgfpn0hc1Y2qJOHdYc8R0Dtux66J5mRuGDh95SnBaq5vY Qx/eqDpEzsgd5HAl/JOpIfoyk1jBPlzSysJkS3PA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Max Gurtovoy , Christoph Hellwig , Sasha Levin Subject: [PATCH 5.4 032/109] nvme-rdma: assign completion vector correctly Date: Tue, 14 Jul 2020 20:43:35 +0200 Message-Id: <20200714184107.058322073@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200714184105.507384017@linuxfoundation.org> References: <20200714184105.507384017@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 73e8475ddc8ab..cd0d499781908 100644 --- a/drivers/nvme/host/rdma.c +++ b/drivers/nvme/host/rdma.c @@ -451,7 +451,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