From patchwork Fri Oct 19 23:34:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shiraz Saleem X-Patchwork-Id: 10650221 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DF1D790 for ; Fri, 19 Oct 2018 23:34:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CEA7F2852D for ; Fri, 19 Oct 2018 23:34:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BD8D328565; Fri, 19 Oct 2018 23:34:42 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI 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 DD0E22852D for ; Fri, 19 Oct 2018 23:34:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727008AbeJTHml (ORCPT ); Sat, 20 Oct 2018 03:42:41 -0400 Received: from mga17.intel.com ([192.55.52.151]:43450 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726349AbeJTHml (ORCPT ); Sat, 20 Oct 2018 03:42:41 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Oct 2018 16:34:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,401,1534834800"; d="scan'208";a="82914361" Received: from ssaleem-mobl4.amr.corp.intel.com ([10.255.33.88]) by orsmga008.jf.intel.com with ESMTP; 19 Oct 2018 16:34:29 -0700 From: Shiraz Saleem To: dledford@redhat.com, jgg@ziepe.ca Cc: linux-rdma@vger.kernel.org, Shiraz Saleem Subject: [PATCH RFC 0/4] Introduce APIs to get DMA addresses aligned to a HW supported page size Date: Fri, 19 Oct 2018 18:34:05 -0500 Message-Id: <20181019233409.1104-1-shiraz.saleem@intel.com> X-Mailer: git-send-email 2.8.3 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 This patch set is aiming to allow drivers that support multiple page sizes to leverage the core umem APIs to obtain suitable HW DMA addresses for the MR, aligned to a supported page size. The APIs accomodates for HW that support single page size or mixed page sizes in an MR. The motivation for this work comes from the discussion in [1]. The first patch modifies current memory registration API ib_umem_get() to build a minimal SG table where each SG entry contain the largest contiguous regions possible. One concern here is whether it is ok to temporarily reserve memory for the array of npage struct page pointers. The second patch introduces a core API that allows drivers to find the best supported page size to use for this MR, from a bitmap of HW supported page sizes. The third patch introduces core APIs that iterates through the SG list and returns suitable HW DMA addresses aligned to a driver supported page size. The fourth patch uses the new core APIs in i40iw to get optimal HW addresses to use for the MR. The use of umem->hugetlb flag and VMA inspection for determining if MR is backed by huge pages is also removed from i40iw. Please note that mixed page portion of the algorithm has not been tested on hardware. The APIs are currently been tested with i40iw hardware. [1] https://patchwork.kernel.org/patch/10499753/ Shiraz Saleem (4): RDMA/umem: Minimize SG table entries RDMA/umem: Add API to find best driver supported page size in an MR RDMA/umem: Add API to return optimal HW DMA addresses from SG list RDMA/i40iw: Use umem APIs to retrieve optimal HW address drivers/infiniband/core/umem.c | 229 +++++++++++++++++++++++++----- drivers/infiniband/hw/i40iw/i40iw_user.h | 5 + drivers/infiniband/hw/i40iw/i40iw_verbs.c | 58 ++------ include/rdma/ib_umem.h | 26 ++++ 4 files changed, 237 insertions(+), 81 deletions(-)