From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753947AbdLIACR (ORCPT ); Fri, 8 Dec 2017 19:02:17 -0500 Received: from ale.deltatee.com ([207.54.116.67]:47398 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753780AbdLIACM (ORCPT ); Fri, 8 Dec 2017 19:02:12 -0500 To: linux-ntb@googlegroups.com, linux-kernel@vger.kernel.org Cc: Jon Mason , Dave Jiang , Allen Hubbe References: <20171209000106.18259-1-logang@deltatee.com> <20171209000106.18259-2-logang@deltatee.com> From: Logan Gunthorpe Message-ID: <205eb69f-9c1c-5391-7145-6cb15a670649@deltatee.com> Date: Fri, 8 Dec 2017 17:02:07 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <20171209000106.18259-2-logang@deltatee.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 172.16.1.162 X-SA-Exim-Rcpt-To: Allen.Hubbe@emc.com, dave.jiang@intel.com, jdmason@kudzu.us, linux-kernel@vger.kernel.org, linux-ntb@googlegroups.com X-SA-Exim-Mail-From: logang@deltatee.com Subject: Re: [PATCH] ntb_transport: fix qp count bug X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: Yes (on ale.deltatee.com) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Sorry, ignore this. I sent an old patch. Logan On 08/12/17 05:01 PM, Logan Gunthorpe wrote: > In cases where there are more mw's than spads/2-2, the mw count gets > reduced to match the limitation. ntb_transport also tries to ensure that > there are fewer qps than mws but uses the full mw count instead of > the reduced one. When this happens, the math in > 'ntb_transport_setup_qp_mw' will get confused and result in a kernel > paging request bug. > > This patch fixes the bug by reducing qp_count to the reduced mw count > instead of the full mw count. > > Signed-off-by: Logan Gunthorpe > Cc: Jon Mason > Cc: Dave Jiang > Cc: Allen Hubbe > --- > drivers/ntb/ntb_transport.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/ntb/ntb_transport.c b/drivers/ntb/ntb_transport.c > index 02ca45fdd892..0a778d2cab94 100644 > --- a/drivers/ntb/ntb_transport.c > +++ b/drivers/ntb/ntb_transport.c > @@ -1128,8 +1128,8 @@ static int ntb_transport_probe(struct ntb_client *self, struct ntb_dev *ndev) > qp_count = ilog2(qp_bitmap); > if (max_num_clients && max_num_clients < qp_count) > qp_count = max_num_clients; > - else if (mw_count < qp_count) > - qp_count = mw_count; > + else if (nt->mw_count < qp_count) > + qp_count = nt->mw_count; > > qp_bitmap &= BIT_ULL(qp_count) - 1; > >