Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp3006861pxb; Tue, 24 Aug 2021 12:47:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzCWicMQC084dNmelPoelyQ4o+5nPm5y2MIfuVoZtznUvM7FUBfFaQ1F80sy/ckQpGnwMTX X-Received: by 2002:aa7:d351:: with SMTP id m17mr11849212edr.72.1629834443627; Tue, 24 Aug 2021 12:47:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629834443; cv=none; d=google.com; s=arc-20160816; b=LX7R60hGhJ6usid4zLiY1VeVDKRihqEvylHdXFzmcS5u+P+XJ0/+rty62T8RmUAwWC Dryjuxv9O5bUWEdYJPrvJe4XEiI+tM0hhoDyb02ddnWbLwdSaWDJuwX6IUXCgCUiI3nC IaA8UQEThleZr9dPqTVrfdk+Y5VJHEV6X//7gLqEMTb2YqHTauAeMMMqXWW6aB9MXa7E 9fdVfkThpgZ1nagu3b4Fa+0TbcGqREfv3Ll3msqtMAs2hTf2QUXYVwPM8Kfhbs3V6EZF Xw8Y9xF7mxRJZA915NsmuPiJlkV0ekEWfJtlYd/+11HfnhKXdTf3kOTCdI0iwMdH6xFs G5Zg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=QBbTc7OlDYPpYPyI2mJEpC5WNa/R3jML5MemVKt7vxM=; b=NnuOzkNqIE0JjwUxWPtpAroVx0UYtgqzFUKoz0jJxWhCNaCKcXR8Mit+zhvDPKt5Og 7EzIWbkN9hnb9gNo8fwTxjtlG+aCZZ7ay1gvOfsKnZn7HRQpFRzCH5qLBeXNLm7aZ8hM tl3aZyP5XC7M9hWTkX08ECRlvZMnUhYhDvP7YVkap5X9WYKDJE7w0x1vB+X92k5asXkO YvH6DIFsOveODrHDegadizuDpnPah2VNF/Uu6grpxDLBXzRGcfW/v0DiYuT3IELNXbcB IOAI+fS05oe6SejHdDE3Mf2KHi9NKRIym+heSTyd5ACohTD+KVTX0eIMZs8O9DZb1pc8 5uDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=llUXYTXR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v23si17649180eds.259.2021.08.24.12.47.00; Tue, 24 Aug 2021 12:47:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=llUXYTXR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234870AbhHXTom (ORCPT + 99 others); Tue, 24 Aug 2021 15:44:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231417AbhHXTom (ORCPT ); Tue, 24 Aug 2021 15:44:42 -0400 Received: from mail-ot1-x32b.google.com (mail-ot1-x32b.google.com [IPv6:2607:f8b0:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9EC19C061757; Tue, 24 Aug 2021 12:43:57 -0700 (PDT) Received: by mail-ot1-x32b.google.com with SMTP id x10-20020a056830408a00b004f26cead745so49147136ott.10; Tue, 24 Aug 2021 12:43:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=QBbTc7OlDYPpYPyI2mJEpC5WNa/R3jML5MemVKt7vxM=; b=llUXYTXRx7lnpKLnCUSaxUM9p08o9HH4gc9HSkXqS1/cVHmEUtLpColBXFieKfgWzm bRzmeShA6clmtElXKicQAyRIf06K8UbKF5PxLM+JmfSzkjg3G3ORcMXcl4YIknzXem3y /3M9svbfztv2qY+xtdeyAox0bpAIAxUUvWts+kvg+BAZQg5yr2oKM2rbjSdQdxDoWGvV +niP6l4tAPzr5r/ZzIqZwrh3j+bJT51RHudo/0G6vL9b/1zc3jnJ5A9Uxmkq9+0xSTHb qXez/x6ctYhPbKY4HrJmfi/QV0FyMSetwl4bScjQJBtOYAOLsJmQzC1fu0uVbT1UXwB2 osqA== 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=QBbTc7OlDYPpYPyI2mJEpC5WNa/R3jML5MemVKt7vxM=; b=hLOt73c9falSXqYIDdUIyCOmFA/sUiK6fDeHfjh/TrXeZKgk80kUVrbERdIDW2z7go cFhxrcWi4u6USAY64ue7i65YcXXkRgZ4kAn2kGW1/8R1UZx9H7r2P5Nlr5IQBRBKHQn6 G+9bPCXmlKmxIxr4IhT2xR0qcPgcPv0ZIQF+GD7NGwkuBFiLZmhZCZPzH3uDPTYl++QZ tXwu0B4V9XdHZxaAOwyfshv9KsJdFZEkfyTCTpM6r1xKPt7TFb/s6mBr476egRX8Z51e wW9aC4onycGZoN00rr6LgKN0tSZ8PIweWyW5GgRKE0J00MT6ksk09p+V29qoexLf1apF jjdg== X-Gm-Message-State: AOAM530b8tkD6l2uHifzJpRHEUb6ou436AHw0ygS/gC7YZY8nJIN36Jo tTHimPM+DNdCxCwkOjgyDTZ20Kl66tFiwPon7io= X-Received: by 2002:a05:6808:6d2:: with SMTP id m18mr3985768oih.120.1629834237075; Tue, 24 Aug 2021 12:43:57 -0700 (PDT) MIME-Version: 1.0 References: <20210819230602.GU543798@ziepe.ca> <20210820123316.GV543798@ziepe.ca> <0fc94ac0-2bb9-4835-62b8-ea14f85fe512@amazon.com> <20210820143248.GX543798@ziepe.ca> <6b819064-feda-b70b-ea69-eb0a4fca6c0c@amd.com> <20210824173228.GE543798@ziepe.ca> <1d1bd2d0-f467-4808-632b-1cca1174cfd9@nvidia.com> In-Reply-To: From: Alex Deucher Date: Tue, 24 Aug 2021 15:43:46 -0400 Message-ID: Subject: Re: [RFC] Make use of non-dynamic dmabuf in RDMA To: Dave Airlie Cc: John Hubbard , Jason Gunthorpe , =?UTF-8?Q?Christian_K=C3=B6nig?= , Gal Pressman , Daniel Vetter , Sumit Semwal , Doug Ledford , "open list:DMA BUFFER SHARING FRAMEWORK" , dri-devel , Linux Kernel Mailing List , linux-rdma , Oded Gabbay , Tomer Tayar , Yossi Leybovich , Alexander Matushevsky , Leon Romanovsky , Jianxin Xiong Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 24, 2021 at 3:16 PM Dave Airlie wrote: > > On Wed, 25 Aug 2021 at 03:36, John Hubbard wrote: > > > > On 8/24/21 10:32 AM, Jason Gunthorpe wrote: > > ... > > >>> And yes at least for the amdgpu driver we migrate the memory to host > > >>> memory as soon as it is pinned and I would expect that other GPU drivers > > >>> do something similar. > > >> > > >> Well...for many topologies, migrating to host memory will result in a > > >> dramatically slower p2p setup. For that reason, some GPU drivers may > > >> want to allow pinning of video memory in some situations. > > >> > > >> Ideally, you've got modern ODP devices and you don't even need to pin. > > >> But if not, and you still hope to do high performance p2p between a GPU > > >> and a non-ODP Infiniband device, then you would need to leave the pinned > > >> memory in vidmem. > > >> > > >> So I think we don't want to rule out that behavior, right? Or is the > > >> thinking more like, "you're lucky that this old non-ODP setup works at > > >> all, and we'll make it work by routing through host/cpu memory, but it > > >> will be slow"? > > > > > > I think it depends on the user, if the user creates memory which is > > > permanently located on the GPU then it should be pinnable in this way > > > without force migration. But if the memory is inherently migratable > > > then it just cannot be pinned in the GPU at all as we can't > > > indefinately block migration from happening eg if the CPU touches it > > > later or something. > > > > > > > OK. I just want to avoid creating any API-level assumptions that dma_buf_pin() > > necessarily implies or requires migrating to host memory. > > I'm not sure we should be allowing dma_buf_pin at all on > non-migratable memory, what's to stop someone just pinning all the > VRAM and making the GPU unuseable? In a lot of cases we have GPUs with more VRAM than system memory, but we allow pinning in system memory. Alex > > I understand not considering more than a single user in these > situations is enterprise thinking, but I do worry about pinning is > always fine type of thinking when things are shared or multi-user. > > My impression from this is we've designed hardware that didn't > consider the problem, and now to let us use that hardware in horrible > ways we should just allow it to pin all the things. > > Dave.