From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C6847C433E0 for ; Wed, 3 Feb 2021 06:04:27 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7220364DF4 for ; Wed, 3 Feb 2021 06:04:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229735AbhBCGEL (ORCPT ); Wed, 3 Feb 2021 01:04:11 -0500 Received: from mail.kernel.org ([198.145.29.99]:35530 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229776AbhBCGEF (ORCPT ); Wed, 3 Feb 2021 01:04:05 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 46C3464F5F; Wed, 3 Feb 2021 06:03:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1612332204; bh=TamFsy+dl4YKadlK6KUmKSWE8+JRnBdDbFZmUJ9evl4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=KndeHYtdEEwNxKe27RLvOZB++RzvTRcR5yBYQKy+ZDYs7mcRdDtw/FKLBVAGLOyAT Xd69sTTDSNxKnTmtbeplQ2aaxT3TS+GarfhpRHpO/O+tMyZU7mF1TBKE/fzm7jz7TD Xnj5BfFHtRurDNrZB4SRvihgfz/1FbIUsKPoDQLA6EFIGD1KsksKUYvJpAu9yJEsXW Yz+Ouj3WpC919UuZcRoFSchUd2200T3hMs2c2ejijD0AIjO8VmeIqmi1bKnTJhxDRm TlGkV++KHs1YJdy9XLinKRdquUpRCHI2q3p0okjI3an5AYkG/EOTqxaUOpP3bLTxG0 8jxTGc/GfQ30A== Date: Wed, 3 Feb 2021 08:03:20 +0200 From: Leon Romanovsky To: Daniel Vetter Cc: "Xiong, Jianxin" , Jason Gunthorpe , Gal Pressman , Yishai Hadas , linux-rdma , Edward Srouji , dri-devel , Christian Koenig , Doug Ledford , "Vetter, Daniel" Subject: Re: [PATCH rdma-core v7 4/6] pyverbs: Add dma-buf based MR support Message-ID: <20210203060320.GK3264866@unreal> References: <1611604622-86968-1-git-send-email-jianxin.xiong@intel.com> <1611604622-86968-5-git-send-email-jianxin.xiong@intel.com> <137f406b-d3e0-fdeb-18e7-194a2aed927c@amazon.com> <20210201061603.GC4593@unreal> <20210201152922.GC4718@ziepe.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org On Tue, Feb 02, 2021 at 04:24:45PM +0100, Daniel Vetter wrote: > On Mon, Feb 01, 2021 at 05:03:44PM +0000, Xiong, Jianxin wrote: > > > -----Original Message----- > > > From: Jason Gunthorpe > > > Sent: Monday, February 01, 2021 7:29 AM > > > To: Daniel Vetter > > > Cc: Leon Romanovsky ; Gal Pressman ; Xiong, Jianxin ; Yishai Hadas > > > ; linux-rdma ; Edward Srouji ; dri-devel > > devel@lists.freedesktop.org>; Christian Koenig ; Doug Ledford ; Vetter, Daniel > > > > > > Subject: Re: [PATCH rdma-core v7 4/6] pyverbs: Add dma-buf based MR support > > > > > > On Mon, Feb 01, 2021 at 03:10:00PM +0100, Daniel Vetter wrote: > > > > On Mon, Feb 1, 2021 at 7:16 AM Leon Romanovsky wrote: > > > > > > > > > > On Sun, Jan 31, 2021 at 05:31:16PM +0200, Gal Pressman wrote: > > > > > > On 25/01/2021 21:57, Jianxin Xiong wrote: > > > > > > > Define a new sub-class of 'MR' that uses dma-buf object for the > > > > > > > memory region. Define a new class 'DmaBuf' as a wrapper for > > > > > > > dma-buf allocation mechanism implemented in C. > > > > > > > > > > > > > > Update the cmake function for cython modules to allow building > > > > > > > modules with mixed cython and c source files. > > > > > > > > > > > > > > Signed-off-by: Jianxin Xiong > > > > > > > buildlib/pyverbs_functions.cmake | 78 +++++++---- > > > > > > > pyverbs/CMakeLists.txt | 11 +- > > > > > > > pyverbs/dmabuf.pxd | 15 +++ > > > > > > > pyverbs/dmabuf.pyx | 73 ++++++++++ > > > > > > > pyverbs/dmabuf_alloc.c | 278 +++++++++++++++++++++++++++++++++++++++ > > > > > > > pyverbs/dmabuf_alloc.h | 19 +++ > > > > > > > pyverbs/libibverbs.pxd | 2 + > > > > > > > pyverbs/mr.pxd | 6 + > > > > > > > pyverbs/mr.pyx | 105 ++++++++++++++- > > > > > > > 9 files changed, 557 insertions(+), 30 deletions(-) create > > > > > > > mode 100644 pyverbs/dmabuf.pxd create mode 100644 > > > > > > > pyverbs/dmabuf.pyx create mode 100644 pyverbs/dmabuf_alloc.c > > > > > > > create mode 100644 pyverbs/dmabuf_alloc.h > > > > > > > > > > <...> > > > > > > > > > > > > index 0000000..05eae75 > > > > > > > +++ b/pyverbs/dmabuf_alloc.c > > > > > > > @@ -0,0 +1,278 @@ > > > > > > > +// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB > > > > > > > +/* > > > > > > > + * Copyright 2020 Intel Corporation. All rights reserved. See > > > > > > > +COPYING file */ > > > > > > > + > > > > > > > +#include > > > > > > > +#include > > > > > > > +#include > > > > > > > +#include > > > > > > > +#include > > > > > > > +#include > > > > > > > +#include > > > > > > > +#include > > > > > > > +#include > > > > > > > +#include > > > > > > > > > > > > I assume these should come from the kernel headers package, right? > > > > > > > > > > This is gross, all kernel headers should be placed in > > > > > kernel-headers/* and "update" script needs to be extended to take drm/* files too :(. > > > > > > > > drm kernel headers are in the libdrm package. You need that anyway for > > > > doing the ioctls (if you don't hand-roll the restarting yourself). > > > > > > > > Also our userspace has gone over to just outright copying the driver > > > > headers. Not the generic headers, but for the rendering side of gpus, > > > > which is the topic here, there's really not much generic stuff. > > > > > > > > > Jianxin, are you fixing it? > > > > > > > > So fix is either to depend upon libdrm for building, or have copies of > > > > the headers included in the package for the i915/amdgpu/radeon headers > > > > (drm/drm.h probably not so good idea). > > > > > > We should have a cmake test to not build the drm parts if it can't be built, and pyverbs should skip the tests. > > > > > > > Yes, I will add a test for that. Also, on SLES, the headers could be under /usr/include/libdrm instead of /usr/include/drm. The make test should check that and use proper path. > > Please use pkgconfig for this, libdrm installs a .pc file to make sure you > can find the right headers. rdma-core uses cmake build system and in our case cmake find_library() is preferable over pkgconfig. Thanks > -Daniel > -- > Daniel Vetter > Software Engineer, Intel Corporation > http://blog.ffwll.ch From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D98BEC433DB for ; Wed, 3 Feb 2021 06:03:27 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 4874964F67 for ; Wed, 3 Feb 2021 06:03:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4874964F67 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 862376E435; Wed, 3 Feb 2021 06:03:26 +0000 (UTC) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by gabe.freedesktop.org (Postfix) with ESMTPS id 708106E433 for ; Wed, 3 Feb 2021 06:03:24 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 46C3464F5F; Wed, 3 Feb 2021 06:03:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1612332204; bh=TamFsy+dl4YKadlK6KUmKSWE8+JRnBdDbFZmUJ9evl4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=KndeHYtdEEwNxKe27RLvOZB++RzvTRcR5yBYQKy+ZDYs7mcRdDtw/FKLBVAGLOyAT Xd69sTTDSNxKnTmtbeplQ2aaxT3TS+GarfhpRHpO/O+tMyZU7mF1TBKE/fzm7jz7TD Xnj5BfFHtRurDNrZB4SRvihgfz/1FbIUsKPoDQLA6EFIGD1KsksKUYvJpAu9yJEsXW Yz+Ouj3WpC919UuZcRoFSchUd2200T3hMs2c2ejijD0AIjO8VmeIqmi1bKnTJhxDRm TlGkV++KHs1YJdy9XLinKRdquUpRCHI2q3p0okjI3an5AYkG/EOTqxaUOpP3bLTxG0 8jxTGc/GfQ30A== Date: Wed, 3 Feb 2021 08:03:20 +0200 From: Leon Romanovsky To: Daniel Vetter Subject: Re: [PATCH rdma-core v7 4/6] pyverbs: Add dma-buf based MR support Message-ID: <20210203060320.GK3264866@unreal> References: <1611604622-86968-1-git-send-email-jianxin.xiong@intel.com> <1611604622-86968-5-git-send-email-jianxin.xiong@intel.com> <137f406b-d3e0-fdeb-18e7-194a2aed927c@amazon.com> <20210201061603.GC4593@unreal> <20210201152922.GC4718@ziepe.ca> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Yishai Hadas , linux-rdma , Edward Srouji , Gal Pressman , dri-devel , Jason Gunthorpe , Doug Ledford , "Vetter, Daniel" , Christian Koenig , "Xiong, Jianxin" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Tue, Feb 02, 2021 at 04:24:45PM +0100, Daniel Vetter wrote: > On Mon, Feb 01, 2021 at 05:03:44PM +0000, Xiong, Jianxin wrote: > > > -----Original Message----- > > > From: Jason Gunthorpe > > > Sent: Monday, February 01, 2021 7:29 AM > > > To: Daniel Vetter > > > Cc: Leon Romanovsky ; Gal Pressman ; Xiong, Jianxin ; Yishai Hadas > > > ; linux-rdma ; Edward Srouji ; dri-devel > > devel@lists.freedesktop.org>; Christian Koenig ; Doug Ledford ; Vetter, Daniel > > > > > > Subject: Re: [PATCH rdma-core v7 4/6] pyverbs: Add dma-buf based MR support > > > > > > On Mon, Feb 01, 2021 at 03:10:00PM +0100, Daniel Vetter wrote: > > > > On Mon, Feb 1, 2021 at 7:16 AM Leon Romanovsky wrote: > > > > > > > > > > On Sun, Jan 31, 2021 at 05:31:16PM +0200, Gal Pressman wrote: > > > > > > On 25/01/2021 21:57, Jianxin Xiong wrote: > > > > > > > Define a new sub-class of 'MR' that uses dma-buf object for the > > > > > > > memory region. Define a new class 'DmaBuf' as a wrapper for > > > > > > > dma-buf allocation mechanism implemented in C. > > > > > > > > > > > > > > Update the cmake function for cython modules to allow building > > > > > > > modules with mixed cython and c source files. > > > > > > > > > > > > > > Signed-off-by: Jianxin Xiong > > > > > > > buildlib/pyverbs_functions.cmake | 78 +++++++---- > > > > > > > pyverbs/CMakeLists.txt | 11 +- > > > > > > > pyverbs/dmabuf.pxd | 15 +++ > > > > > > > pyverbs/dmabuf.pyx | 73 ++++++++++ > > > > > > > pyverbs/dmabuf_alloc.c | 278 +++++++++++++++++++++++++++++++++++++++ > > > > > > > pyverbs/dmabuf_alloc.h | 19 +++ > > > > > > > pyverbs/libibverbs.pxd | 2 + > > > > > > > pyverbs/mr.pxd | 6 + > > > > > > > pyverbs/mr.pyx | 105 ++++++++++++++- > > > > > > > 9 files changed, 557 insertions(+), 30 deletions(-) create > > > > > > > mode 100644 pyverbs/dmabuf.pxd create mode 100644 > > > > > > > pyverbs/dmabuf.pyx create mode 100644 pyverbs/dmabuf_alloc.c > > > > > > > create mode 100644 pyverbs/dmabuf_alloc.h > > > > > > > > > > <...> > > > > > > > > > > > > index 0000000..05eae75 > > > > > > > +++ b/pyverbs/dmabuf_alloc.c > > > > > > > @@ -0,0 +1,278 @@ > > > > > > > +// SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB > > > > > > > +/* > > > > > > > + * Copyright 2020 Intel Corporation. All rights reserved. See > > > > > > > +COPYING file */ > > > > > > > + > > > > > > > +#include > > > > > > > +#include > > > > > > > +#include > > > > > > > +#include > > > > > > > +#include > > > > > > > +#include > > > > > > > +#include > > > > > > > +#include > > > > > > > +#include > > > > > > > +#include > > > > > > > > > > > > I assume these should come from the kernel headers package, right? > > > > > > > > > > This is gross, all kernel headers should be placed in > > > > > kernel-headers/* and "update" script needs to be extended to take drm/* files too :(. > > > > > > > > drm kernel headers are in the libdrm package. You need that anyway for > > > > doing the ioctls (if you don't hand-roll the restarting yourself). > > > > > > > > Also our userspace has gone over to just outright copying the driver > > > > headers. Not the generic headers, but for the rendering side of gpus, > > > > which is the topic here, there's really not much generic stuff. > > > > > > > > > Jianxin, are you fixing it? > > > > > > > > So fix is either to depend upon libdrm for building, or have copies of > > > > the headers included in the package for the i915/amdgpu/radeon headers > > > > (drm/drm.h probably not so good idea). > > > > > > We should have a cmake test to not build the drm parts if it can't be built, and pyverbs should skip the tests. > > > > > > > Yes, I will add a test for that. Also, on SLES, the headers could be under /usr/include/libdrm instead of /usr/include/drm. The make test should check that and use proper path. > > Please use pkgconfig for this, libdrm installs a .pc file to make sure you > can find the right headers. rdma-core uses cmake build system and in our case cmake find_library() is preferable over pkgconfig. Thanks > -Daniel > -- > Daniel Vetter > Software Engineer, Intel Corporation > http://blog.ffwll.ch _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel