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=-3.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 0391BC4727D for ; Tue, 6 Oct 2020 17:24:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5F9AD207EA for ; Tue, 6 Oct 2020 17:24:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="Ywzegx7i" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725946AbgJFRYo (ORCPT ); Tue, 6 Oct 2020 13:24:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725925AbgJFRYo (ORCPT ); Tue, 6 Oct 2020 13:24:44 -0400 Received: from mail-oi1-x241.google.com (mail-oi1-x241.google.com [IPv6:2607:f8b0:4864:20::241]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E186EC061755 for ; Tue, 6 Oct 2020 10:24:42 -0700 (PDT) Received: by mail-oi1-x241.google.com with SMTP id 16so5768696oix.9 for ; Tue, 06 Oct 2020 10:24:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=RKKopYNcjNeFpv6TLCvBYUo3phBxS/bzVk3ny8U3SZ4=; b=Ywzegx7iJlmxeVjVZylTidxr8VgvtygwAsLLUcnt9O5nTCCs6I2rKesGxA6F19rGvi UravkjBt8BIXUX4j75kb74n5qmm7iOVZZwiuoAEcuxHJbniAoU8uPchZp6IHOGjcoBlX 1QK4XEVHCT1DG5yR53rfHgCYShrIyLE8nZYAA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=RKKopYNcjNeFpv6TLCvBYUo3phBxS/bzVk3ny8U3SZ4=; b=JW3qbU0MOCCQOlVzjsZzzx/YBR8L5ZVzIjakSbbyCYr5s/WWMQhzhuoIYPX97vE68m tsFoHzt8Rc7brzBio6BWkcMfc2ePrGdlDjUz8f5kQOIZ7rEtzF3N6AQFObTRAd2HBTby sb0xr7Tq0r3Ab68ecVOrtJRazmA+X9+96Zi2nuWz861QvNEvSWNT3dRrJWqmWECK5JMD jEstgyE/3WVxxugaoc3lVN98XT4QmBqBfXFqST91Lz9ZNkSgKQ0A5D/bb1nO999OJfvX tZvhvfprjD87NRkZHxSO2GdTuhRc1Eoos4AMxKoMxLPZ6AGFT+m6B++qE3IoNRSq5z29 6hAA== X-Gm-Message-State: AOAM532AmH0SIPRzUodSYaj3IsQ0SxuDWMZJnpkACkhxmJYcxa7n0pzH 9aOHk04cfQChQV5VpH/bKi36z1iYohBS/bVautBL3Q== X-Google-Smtp-Source: ABdhPJwMRUDWMR5gv6uevejjE1dEUzVSRSA7mRuyKG9aJA0erHylD0SSdUS6tuHF6wQyEztNveufIUanB12QJiWFzXA= X-Received: by 2002:aca:6083:: with SMTP id u125mr3479076oib.14.1602005081922; Tue, 06 Oct 2020 10:24:41 -0700 (PDT) MIME-Version: 1.0 References: <1601838751-148544-1-git-send-email-jianxin.xiong@intel.com> <1601838751-148544-2-git-send-email-jianxin.xiong@intel.com> <20201005131302.GQ9916@ziepe.ca> <20201006092214.GX438822@phenom.ffwll.local> <20201006154956.GI5177@ziepe.ca> <20201006163420.GB438822@phenom.ffwll.local> In-Reply-To: <20201006163420.GB438822@phenom.ffwll.local> From: Daniel Vetter Date: Tue, 6 Oct 2020 19:24:30 +0200 Message-ID: Subject: Re: [RFC PATCH v3 1/4] RDMA/umem: Support importing dma-buf as user memory region To: Jason Gunthorpe , =?UTF-8?Q?Christian_K=C3=B6nig?= Cc: "Xiong, Jianxin" , Leon Romanovsky , "linux-rdma@vger.kernel.org" , "dri-devel@lists.freedesktop.org" , Doug Ledford , "Vetter, Daniel" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org On Tue, Oct 6, 2020 at 6:34 PM Daniel Vetter wrote: > > On Tue, Oct 06, 2020 at 12:49:56PM -0300, Jason Gunthorpe wrote: > > On Tue, Oct 06, 2020 at 11:22:14AM +0200, Daniel Vetter wrote: > > > > > > For reinstanting the pages you need: > > > > > > - dma_resv_lock, this prevents anyone else from issuing new moves or > > > anything like that > > > - dma_resv_get_excl + dma_fence_wait to wait for any pending moves to > > > finish. gpus generally don't wait on the cpu, but block the dependent > > > dma operations from being scheduled until that fence fired. But for rdma > > > odp I think you need the cpu wait in your worker here. > > > > Reinstating is not really any different that the first insertion, so > > then all this should be needed in every case? > > Yes. Without move_notify we pin the dma-buf into system memory, so it > can't move, and hence you also don't have to chase it. But with > move_notify this all becomes possible. I just realized I got it wrong compared to gpus. I needs to be: 1. dma_resv_lock 2. dma_buf_map_attachment, which might have to move the buffer around again if you're unlucky 3. wait for the exclusive fence 4. put sgt into your rdma ptes 5 dma_resv_unlock Maybe also something we should document somewhere for dynamic buffers. Assuming I got it right this time around ... Christian? -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=-3.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no 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 75397C41604 for ; Tue, 6 Oct 2020 17:24:45 +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 6135020782 for ; Tue, 6 Oct 2020 17:24:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="Ywzegx7i" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6135020782 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch 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 D3DC16E4E3; Tue, 6 Oct 2020 17:24:43 +0000 (UTC) Received: from mail-oi1-x244.google.com (mail-oi1-x244.google.com [IPv6:2607:f8b0:4864:20::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id A62A66E4E3 for ; Tue, 6 Oct 2020 17:24:42 +0000 (UTC) Received: by mail-oi1-x244.google.com with SMTP id m7so13413716oie.0 for ; Tue, 06 Oct 2020 10:24:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=RKKopYNcjNeFpv6TLCvBYUo3phBxS/bzVk3ny8U3SZ4=; b=Ywzegx7iJlmxeVjVZylTidxr8VgvtygwAsLLUcnt9O5nTCCs6I2rKesGxA6F19rGvi UravkjBt8BIXUX4j75kb74n5qmm7iOVZZwiuoAEcuxHJbniAoU8uPchZp6IHOGjcoBlX 1QK4XEVHCT1DG5yR53rfHgCYShrIyLE8nZYAA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=RKKopYNcjNeFpv6TLCvBYUo3phBxS/bzVk3ny8U3SZ4=; b=R0Xmpfz8M/VIvT6HbleyF1DXdaPvyYSt3vHsiHvfJQ+Ehe98jlqRCiIBy1N9rBVwUH 7HVKKS4f4KQJTSlWBeDSmx3DgNSV05z56oMky81utF3saf93nKhykOExIsFoZZUQFbA7 dEQoBcdO1uFj989tN+upfMujU2WD1oJRSQLI7yoYGcdrDzQhcQy/lBWiJ/4stzcjY/VT qVXppW+8lOxrefwyqod/4Tf0S1SWlj7uql6B0Vm9iukcZMcfNdsqALlp/sSyNVYE28At CRgEe2T4w2z7eRHmOuUA5JaHSZRs12sZTOwmvRd3dkw184NI4LiOxUwQVMBK1oNDAdZF PENA== X-Gm-Message-State: AOAM533EIEqeA+9fYHYsxj5+FmXFzmoRRTaVOT4Cjq96jPGO0F5pyY8k PhHtxpTLf0+HItMlbuwqI6e4+q7NQw0M16JF4llceA== X-Google-Smtp-Source: ABdhPJwMRUDWMR5gv6uevejjE1dEUzVSRSA7mRuyKG9aJA0erHylD0SSdUS6tuHF6wQyEztNveufIUanB12QJiWFzXA= X-Received: by 2002:aca:6083:: with SMTP id u125mr3479076oib.14.1602005081922; Tue, 06 Oct 2020 10:24:41 -0700 (PDT) MIME-Version: 1.0 References: <1601838751-148544-1-git-send-email-jianxin.xiong@intel.com> <1601838751-148544-2-git-send-email-jianxin.xiong@intel.com> <20201005131302.GQ9916@ziepe.ca> <20201006092214.GX438822@phenom.ffwll.local> <20201006154956.GI5177@ziepe.ca> <20201006163420.GB438822@phenom.ffwll.local> In-Reply-To: <20201006163420.GB438822@phenom.ffwll.local> From: Daniel Vetter Date: Tue, 6 Oct 2020 19:24:30 +0200 Message-ID: Subject: Re: [RFC PATCH v3 1/4] RDMA/umem: Support importing dma-buf as user memory region To: Jason Gunthorpe , =?UTF-8?Q?Christian_K=C3=B6nig?= 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: Leon Romanovsky , "linux-rdma@vger.kernel.org" , "dri-devel@lists.freedesktop.org" , Doug Ledford , "Vetter, Daniel" , "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, Oct 6, 2020 at 6:34 PM Daniel Vetter wrote: > > On Tue, Oct 06, 2020 at 12:49:56PM -0300, Jason Gunthorpe wrote: > > On Tue, Oct 06, 2020 at 11:22:14AM +0200, Daniel Vetter wrote: > > > > > > For reinstanting the pages you need: > > > > > > - dma_resv_lock, this prevents anyone else from issuing new moves or > > > anything like that > > > - dma_resv_get_excl + dma_fence_wait to wait for any pending moves to > > > finish. gpus generally don't wait on the cpu, but block the dependent > > > dma operations from being scheduled until that fence fired. But for rdma > > > odp I think you need the cpu wait in your worker here. > > > > Reinstating is not really any different that the first insertion, so > > then all this should be needed in every case? > > Yes. Without move_notify we pin the dma-buf into system memory, so it > can't move, and hence you also don't have to chase it. But with > move_notify this all becomes possible. I just realized I got it wrong compared to gpus. I needs to be: 1. dma_resv_lock 2. dma_buf_map_attachment, which might have to move the buffer around again if you're unlucky 3. wait for the exclusive fence 4. put sgt into your rdma ptes 5 dma_resv_unlock Maybe also something we should document somewhere for dynamic buffers. Assuming I got it right this time around ... Christian? -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