From patchwork Thu Mar 23 09:04:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marta Rybczynska X-Patchwork-Id: 9640603 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A2907602CA for ; Thu, 23 Mar 2017 09:12:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 81145284C2 for ; Thu, 23 Mar 2017 09:12:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 72CEB284E8; Thu, 23 Mar 2017 09:12:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5D03E284C2 for ; Thu, 23 Mar 2017 09:12:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752063AbdCWJMp (ORCPT ); Thu, 23 Mar 2017 05:12:45 -0400 Received: from zimbra1.kalray.eu ([92.103.151.219]:39486 "EHLO zimbra1.kalray.eu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752034AbdCWJMo (ORCPT ); Thu, 23 Mar 2017 05:12:44 -0400 X-Greylist: delayed 513 seconds by postgrey-1.27 at vger.kernel.org; Thu, 23 Mar 2017 05:12:44 EDT Received: from localhost (localhost [127.0.0.1]) by zimbra1.kalray.eu (Postfix) with ESMTP id 0EF5D280C47; Thu, 23 Mar 2017 10:04:10 +0100 (CET) Received: from zimbra1.kalray.eu ([127.0.0.1]) by localhost (zimbra1.kalray.eu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id mepgSUKMzkFg; Thu, 23 Mar 2017 10:04:09 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by zimbra1.kalray.eu (Postfix) with ESMTP id A55E8280C26; Thu, 23 Mar 2017 10:04:09 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.9.2 zimbra1.kalray.eu A55E8280C26 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kalray.eu; s=32AE1B44-9502-11E5-BA35-3734643DEF29; t=1490259849; bh=KxMhwkT8dnHw79mCZAyckWaLbxMigLGZ3NZJPEpSA90=; h=Date:From:To:Message-ID:Subject:MIME-Version:Content-Type: Content-Transfer-Encoding; b=TTyxgxrTLXhVAwR3Ia03TshylNhR8QgDtzYn6HLmYciZSqwhdGTBcyLSpi6Lg57H0 kANkSlRsS3d4a15pPH+sJQXWl99lA299MotQ6JEUD9nBs0nLnuTGTWKgWwAEmc5W/J 4pNOpIotrTszJ8x5usGCVtRJtnPHCQfp6880V0Kc= X-Virus-Scanned: amavisd-new at kalray.eu Received: from zimbra1.kalray.eu ([127.0.0.1]) by localhost (zimbra1.kalray.eu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id eMqMry-na4E1; Thu, 23 Mar 2017 10:04:09 +0100 (CET) Received: from zimbra1.kalray.eu (localhost [127.0.0.1]) by zimbra1.kalray.eu (Postfix) with ESMTP id 8FA1028070E; Thu, 23 Mar 2017 10:04:09 +0100 (CET) Date: Thu, 23 Mar 2017 10:04:09 +0100 (CET) From: Marta Rybczynska To: linux-nvme@lists.infradead.org, linux-rdma@vger.kernel.org, keith.busch@intel.com, axboe@fb.com, hch@lst.de, sagi@grimberg.me Cc: Samuel Jones Message-ID: <1315914765.312051621.1490259849534.JavaMail.zimbra@kalray.eu> Subject: [PATCH RFC] nvme-rdma: support devices with queue size < 32 MIME-Version: 1.0 X-Originating-IP: [192.168.37.210] X-Mailer: Zimbra 8.6.0_GA_1182 (ZimbraWebClient - FF45 (Linux)/8.6.0_GA_1182) Thread-Topic: nvme-rdma: support devices with queue size < 32 Thread-Index: d+jEIyMOxjUesajxvaL7sy2D8GnAZg== Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP In the case of small NVMe-oF queue size (<32) we may enter a deadlock caused by the fact that the IB completions aren't sent waiting for 32 and the send queue will fill up. The error is seen as (using mlx5): [ 2048.693355] mlx5_0:mlx5_ib_post_send:3765:(pid 7273): [ 2048.693360] nvme nvme1: nvme_rdma_post_send failed with error code -12 The patch doesn't change the behaviour for remote devices with larger queues. Signed-off-by: Marta Rybczynska Signed-off-by: Samuel Jones --- drivers/nvme/host/rdma.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c index 779f516..8ea4cba 100644 --- a/drivers/nvme/host/rdma.c +++ b/drivers/nvme/host/rdma.c @@ -1023,6 +1023,7 @@ static int nvme_rdma_post_send(struct nvme_rdma_queue *queue, { struct ib_send_wr wr, *bad_wr; int ret; + int sig_limit; sge->addr = qe->dma; sge->length = sizeof(struct nvme_command), @@ -1054,7 +1055,8 @@ static int nvme_rdma_post_send(struct nvme_rdma_queue *queue, * embedded in request's payload, is not freed when __ib_process_cq() * calls wr_cqe->done(). */ - if ((++queue->sig_count % 32) == 0 || flush) + sig_limit = min(queue->queue_size, 32); + if ((++queue->sig_count % sig_limit) == 0 || flush) wr.send_flags |= IB_SEND_SIGNALED; if (first)