Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5614511img; Wed, 27 Mar 2019 11:44:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqyUHGzyruIk2oR3xFhiTln5AHDBkvczhbxTTjenELsK3XQcS6JElmMUtHiKp3c6aMCAqz30 X-Received: by 2002:a17:902:1e6:: with SMTP id b93mr38400414plb.325.1553712297553; Wed, 27 Mar 2019 11:44:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553712297; cv=none; d=google.com; s=arc-20160816; b=NsqMzhAQXM9IdreUadZsAglkIeQ3CxTGb+lmkezkL1B+ld/Ijjwlrm9haZ1f2HKvTl 6hshZYkrIgOVKpc5sztgfTzaymP97MQq0k2SdL7IsdSIiId1MSJ5KdWB16NKrjoedSRW zlo5+sumQ0d+8yjhayGO92Hur32IscNDrPgR3PF4e3Df6dJcNeEcGCUXBpgSHxdh6bTb gPS/Qd7Zfs3yyqmg9edoCliDSUOCU2s2FtPvk71g68bp9YyPKSGCPTkUoKaqrStr4Prz QNnT9nBCs8C2azx2B9QEcH1MWzIvwUHAUHPuAkFhXEbTz+3BIiPPkEjbUOGrM4g/Mmh0 uoOw== 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=dR380VDiG8ZvL0GfjckqbxOe37VcVuy54KV7Ov7P48g=; b=IM5FvL6iIje+4iuICTvxxPapSFxYJmbkSBVqzar99HByNKEQuqga0sAroLIuIniZHT 71taTfUUR9edajubnpj29EnqVS9RlOMrf10ULYkpxYDoQ1B2G/0g8rasVZz2quHNC5M9 zYem09dOMJdJoPwN4eqQW3t5oZitdzEpNg1fPh6XPd+amlwXn1IzEJf6hwbNhl7x4Fd8 f4mvWkEDZbFOHVzvIOMG6xY4Afl2BVh1fI0NcHlfvsXN82X5Su8PAmgqRoWIlRdG5CuA IilThHINCMi/SMRFn5/u6nqo853Zqo+B8JJaUhjdDp/QrtsW3MBHh/YNu25Ptwz7i5p5 WA3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=io8gtQ+H; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id cu15si9618077plb.83.2019.03.27.11.44.42; Wed, 27 Mar 2019 11:44:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=io8gtQ+H; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S2391904AbfC0SnW (ORCPT + 99 others); Wed, 27 Mar 2019 14:43:22 -0400 Received: from mail.kernel.org ([198.145.29.99]:39546 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391204AbfC0SVh (ORCPT ); Wed, 27 Mar 2019 14:21:37 -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 ED29C20449; Wed, 27 Mar 2019 18:21:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553710896; bh=7gPGMqwf5wZtKk/WecHdXqu62CrGFL/zrtfTytC5XaU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=io8gtQ+Hwr5UzZPvXzMLMe4OPfom+RP5wJHVAH61pY5YJCCC0mk9U88hsXFLuJYCr Bp+NcZ4H8BuYSaaX559HmW80ua3Z/f3vKLMY62o6Rl1ebRS4LEpmnB8gNFEYgWlpik JcbYaV8JeG2IX3TqrVGpnxXhthjIBKHb9n96hfP4= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: =?UTF-8?q?H=C3=A5kon=20Bugge?= , Jason Gunthorpe , Sasha Levin , linux-rdma@vger.kernel.org Subject: [PATCH AUTOSEL 4.9 34/87] IB/mlx4: Increase the timeout for CM cache Date: Wed, 27 Mar 2019 14:19:47 -0400 Message-Id: <20190327182040.17444-34-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190327182040.17444-1-sashal@kernel.org> References: <20190327182040.17444-1-sashal@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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: Håkon Bugge [ Upstream commit 2612d723aadcf8281f9bf8305657129bd9f3cd57 ] Using CX-3 virtual functions, either from a bare-metal machine or pass-through from a VM, MAD packets are proxied through the PF driver. Since the VF drivers have separate name spaces for MAD Transaction Ids (TIDs), the PF driver has to re-map the TIDs and keep the book keeping in a cache. Following the RDMA Connection Manager (CM) protocol, it is clear when an entry has to evicted form the cache. But life is not perfect, remote peers may die or be rebooted. Hence, it's a timeout to wipe out a cache entry, when the PF driver assumes the remote peer has gone. During workloads where a high number of QPs are destroyed concurrently, excessive amount of CM DREQ retries has been observed The problem can be demonstrated in a bare-metal environment, where two nodes have instantiated 8 VFs each. This using dual ported HCAs, so we have 16 vPorts per physical server. 64 processes are associated with each vPort and creates and destroys one QP for each of the remote 64 processes. That is, 1024 QPs per vPort, all in all 16K QPs. The QPs are created/destroyed using the CM. When tearing down these 16K QPs, excessive CM DREQ retries (and duplicates) are observed. With some cat/paste/awk wizardry on the infiniband_cm sysfs, we observe as sum of the 16 vPorts on one of the nodes: cm_rx_duplicates: dreq 2102 cm_rx_msgs: drep 1989 dreq 6195 rep 3968 req 4224 rtu 4224 cm_tx_msgs: drep 4093 dreq 27568 rep 4224 req 3968 rtu 3968 cm_tx_retries: dreq 23469 Note that the active/passive side is equally distributed between the two nodes. Enabling pr_debug in cm.c gives tons of: [171778.814239] mlx4_ib_multiplex_cm_handler: id{slave: 1,sl_cm_id: 0xd393089f} is NULL! By increasing the CM_CLEANUP_CACHE_TIMEOUT from 5 to 30 seconds, the tear-down phase of the application is reduced from approximately 90 to 50 seconds. Retries/duplicates are also significantly reduced: cm_rx_duplicates: dreq 2460 [] cm_tx_retries: dreq 3010 req 47 Increasing the timeout further didn't help, as these duplicates and retries stems from a too short CMA timeout, which was 20 (~4 seconds) on the systems. By increasing the CMA timeout to 22 (~17 seconds), the numbers fell down to about 10 for both of them. Adjustment of the CMA timeout is not part of this commit. Signed-off-by: Håkon Bugge Acked-by: Jack Morgenstein Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin --- drivers/infiniband/hw/mlx4/cm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/mlx4/cm.c b/drivers/infiniband/hw/mlx4/cm.c index 39a488889fc7..5dc920fe1326 100644 --- a/drivers/infiniband/hw/mlx4/cm.c +++ b/drivers/infiniband/hw/mlx4/cm.c @@ -39,7 +39,7 @@ #include "mlx4_ib.h" -#define CM_CLEANUP_CACHE_TIMEOUT (5 * HZ) +#define CM_CLEANUP_CACHE_TIMEOUT (30 * HZ) struct id_map_entry { struct rb_node node; -- 2.19.1