Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753446AbdFVQRy (ORCPT ); Thu, 22 Jun 2017 12:17:54 -0400 Received: from ale.deltatee.com ([207.54.116.67]:53749 "EHLO ale.deltatee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752037AbdFVQRt (ORCPT ); Thu, 22 Jun 2017 12:17:49 -0400 To: Jon Mason , Allen Hubbe References: <20170615203729.9009-1-logang@deltatee.com> <20170619200659.GA20437@kudzu.us> Cc: linux-ntb@googlegroups.com, linux-kernel@vger.kernel.org, Dave Jiang , Serge Semin , Kurt Schwemmer , Stephen Bates , Greg Kroah-Hartman From: Logan Gunthorpe Message-ID: <9615f074-5b81-210b-eb88-218a59d65198@deltatee.com> Date: Thu, 22 Jun 2017 10:17:43 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <20170619200659.GA20437@kudzu.us> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-SA-Exim-Connect-IP: 172.16.1.111 X-SA-Exim-Rcpt-To: gregkh@linuxfoundation.org, sbates@raithlin.com, kurt.schwemmer@microsemi.com, fancer.lancer@gmail.com, dave.jiang@intel.com, linux-kernel@vger.kernel.org, linux-ntb@googlegroups.com, Allen.Hubbe@emc.com, jdmason@kudzu.us X-SA-Exim-Mail-From: logang@deltatee.com Subject: New NTB API Issue X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +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 Content-Length: 1775 Lines: 39 Hey Guys, I've run into some subtle issues with the new API: It has to do with splitting mw_get_range into mw_get_align and peer_mw_get_addr. The original mw_get_range returned the size of the /local/ memory window's size, address and alignment requirements. The ntb clients then take the local size and transmit it via spads to the peer which would use it in setting up the memory window. However, it made the assumption that the alignment restrictions were symmetric on both hosts seeing they were not sent across the link. The new API makes a sensible change for this in that mw_get_align appears to be intended to return the alignment restrictions (and now size) of the peer. This helps a bit for the Switchtec driver but appears to be a semantic change that wasn't really reflected in the changes to the other NTB code. So, I see a couple of issues: 1) With our hardware, we can't actually know anything about the peer's memory windows until the peer has finished its setup (ie. the link is up). However, all the clients call the function during probe, before the link is ready. There's really no good reason for this, so I think we should change the clients so that mw_get_align is called only when the link is up. 2) The changes to the Intel and AMD driver for mw_get_align sets *max_size to the local pci resource size. (Thus making the assumption that the local is the same as the peer, which is wrong). max_size isn't actually used for anything so it's not _really_ an issue, but I do think it's confusing and incorrect. I'd suggest we remove max_size until something actually needs it, or at least set it to zero in cases where the hardware doesn't support returning the size of the peer's memory window (ie. in the Intel and AMD drivers). Thoughts? Logan