Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752941AbdLKOzv (ORCPT ); Mon, 11 Dec 2017 09:55:51 -0500 Received: from esa1.dell-outbound.iphmx.com ([68.232.153.90]:55078 "EHLO esa1.dell-outbound.iphmx.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752204AbdLKOzt (ORCPT ); Mon, 11 Dec 2017 09:55:49 -0500 IronPort-PHdr: =?us-ascii?q?9a23=3AUX12zBARwJklCUy0cTMvUyQJP3N1i/DPJgcQr6Af?= =?us-ascii?q?oPdwSPX6pMbcNUDSrc9gkEXOFd2CrakV26yO6+jJYi8p2d65qncMcZhBBVcuqP?= =?us-ascii?q?49uEgeOvODElDxN/XwbiY3T4xoXV5h+GynYwAOQJ6tL1LdrWev4jEMBx7xKRR6?= =?us-ascii?q?JvjvGo7Vks+7y/2+94fdbghMhzexe69+IAmrpgjNq8cahpdvJLwswRXTuHtIfO?= =?us-ascii?q?pWxWJsJV2Nmhv3+9m98p1+/SlOovwt78FPX7n0cKQ+VrxYES8pM3sp683xtBnM?= =?us-ascii?q?VhWA630BWWgLiBVIAgzF7BbnXpfttybxq+Rw1DWGMcDwULs5Qiqp4bt1RxD0iS?= =?us-ascii?q?cHLz85/3/Risxsl6JQvRatqwViz4LIfI2ZMfxzdb7fc9wHX2pMRsZfWTJPAoy+?= =?us-ascii?q?coUBAekPMulEoIfyoFUOsQCzBRWuCePg1jNEmGP60K883u88EQ/GxgsgH9cWvX?= =?us-ascii?q?jasNj1MKMSXv6zzKLVzzvDcuhZ1izj54TGbxsspu2BXbZ0ccXPz0kjDQHLjkiL?= =?us-ascii?q?poP+ITyYzfkCvHaf7+pkT+6gl2knqwRorzWp28wiiZHJi5oUx13H7yl13og4Kc?= =?us-ascii?q?OiREJmYdOpHoFcuz+GO4drWs8uXmBltSUgxrEbuZO2eDIGxIo6yxPRcfCLboeF?= =?us-ascii?q?7g/lWe2MOzl3nmhld6i6hxuq9EigzfDzWd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IFb4J4QIIighFagSCFdwEmgiEBA?= =?us-ascii?q?QE?= X-IPAS-Result: =?us-ascii?q?A2EYAgCUmy5ah8mZ6ERbGQEBAQEBAQEBAQEBAQcBAQEBAYQ?= =?us-ascii?q?UgQQnhAKLFY4IgX2DRJNIFIIBCoU7AoRyQBcBAQEBAQEBAQEBAhABAQEKCwkIK?= =?us-ascii?q?C9CEAGBZSQBgkYBAQEBAwgCGQQBKwsBGg0DAgkVBQImAgIZPgIEARILBYoYqBu?= =?us-ascii?q?BbQI4imMBAQEBAQUBAQEBASOBD4JZgguBVoUUhGMVAYM7gmMFkyOPbgKCO5Jkk?= =?us-ascii?q?2NIlWkCBAIEBQIagTshAoIFb4J4QIIighFagSCFdwEmgiEBAQE?= X-DKIM: OpenDKIM Filter v2.4.3 mailuogwprd04.lss.emc.com vBBEtebs000330 From: "Allen Hubbe" To: "'Logan Gunthorpe'" , , Cc: "'Jon Mason'" , "'Dave Jiang'" References: <20171209000217.18366-1-logang@deltatee.com> In-Reply-To: <20171209000217.18366-1-logang@deltatee.com> Subject: RE: [PATCH 1/2] ntb_transport: Fix bug with max_mw_size parameter Date: Mon, 11 Dec 2017 09:55:25 -0500 Message-ID: <000101d37290$148f0250$3dad06f0$@dell.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 15.0 Thread-Index: AQHTcIEBH6FTLGeN0EaqMrseJNfmuKM+PsKw Content-Language: en-us X-RSA-Classifications: public X-Sentrion-Hostname: mailuogwprd04.lss.emc.com Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1533 Lines: 42 From: Logan Gunthorpe > When using the max_mw_size parameter of ntb_transport to limit the size of > the Memory windows, communication cannot be established and the queues > freeze. > > This is because the mw_size that's reported to the peer is correctly > limited but the size used locally is not. So the MW is initialized > with a buffer smaller than the window but the TX side is using the > full window. This means the TX side will be writing to a region of the > window that points nowhere. > > This is easily fixed by applying the same limit to tx_size in > ntb_transport_init_queue(). > > Fixes: e26a5843f7f5 ("NTB: Split ntb_hw_intel and ntb_transport drivers") > Signed-off-by: Logan Gunthorpe > Cc: Jon Mason > Cc: Dave Jiang > Cc: Allen Hubbe Acked-by: Allen Hubbe > --- > drivers/ntb/ntb_transport.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c > index 045e3dd4750e..9878c48826e3 100644 > --- a/drivers/ntb/ntb_transport.c > +++ b/drivers/ntb/ntb_transport.c > @@ -1003,6 +1003,9 @@ static int ntb_transport_init_queue(struct ntb_transport_ctx *nt, > mw_base = nt->mw_vec[mw_num].phys_addr; > mw_size = nt->mw_vec[mw_num].phys_size; > > + if (max_mw_size && mw_size > max_mw_size) > + mw_size = max_mw_size; > + > tx_size = (unsigned int)mw_size / num_qps_mw; > qp_offset = tx_size * (qp_num / mw_count); > > -- > 2.11.0