Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2915827pxb; Tue, 24 Aug 2021 10:30:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz2mPQBZKSZ83thcqyeAPPjFC8IlGfeonmzCUJEg6yNIbJ7u1nAx3iAWncwqF2XUT1LQ+s/ X-Received: by 2002:a05:6602:26d2:: with SMTP id g18mr31579331ioo.194.1629826250222; Tue, 24 Aug 2021 10:30:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1629826250; cv=pass; d=google.com; s=arc-20160816; b=iM/8Dc4YXeaXlwtS9g6nJwZGfjGTK6T7lssyrg05BHb+E7YeWjWC+Uw9ulLRAZf3td 8EdQ/jC8BBZlyKpr/MNUeZes9O10Y7YICMa8G1sieM8S1vOprnjqNEozlM8rp+7pazEL voU5tSB9xpAc/nSsj1L8NiHh+Rwxc588H/A/b/RaCumMFLCjYXqFs+iMnU+Ii0ebwCWz iignujp9V6rPLwYRfLd/xgdXafYrcsYB4mR2MqDLQ7GIzlvmpEPvu88N5V95h5iSfwCE TBnqCWAcpaa1UzTTKf1kVfeiIID+cOeFbQlSPOChbfhnINfBGri5W4HZ6VlT7q11Azhx xhtw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:in-reply-to:user-agent:date:message-id:from :references:cc:to:subject:dkim-signature; bh=iMg+xlDRRaGUzbtMimSJUGsRul99+AZJxhTxEAorL5w=; b=Iq2Jljhwsm+eTz+sc7eJud1jMeTBxSyFYDuuq00TNmyzhZlyToa0VG+LOTb55viJPV u55B6WMHNzFEfMCTmgNChy6mrAssJ+Gw1Rjzkd8O3XBV8DgHjVLPZpRq5pKBKzelRjjH zrIl27iS9SdrmKm5QXSIxdZsKg110ZR9UPwvFdaaEnnDKSCE7UDjD8L2I0cbM6z6eRhQ tTJeG793OwuXScGARF+uoDXNYUZm9e85JrKlMVpxAw4LsUFPRc/ich5Ho58A/rFP5SkH N/+csKE2nyDghe4Sk5QuNTWaNK28KoZMIdK2xq9IcAV7cMM3XuxzPfT3Hu1MgdZhcAk8 llAQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b="gt/e9CUF"; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); 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=QUARANTINE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a2si18336564ilp.123.2021.08.24.10.30.38; Tue, 24 Aug 2021 10:30:50 -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=@Nvidia.com header.s=selector2 header.b="gt/e9CUF"; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); 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=QUARANTINE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240415AbhHXRaV (ORCPT + 99 others); Tue, 24 Aug 2021 13:30:21 -0400 Received: from mail-mw2nam08on2047.outbound.protection.outlook.com ([40.107.101.47]:38083 "EHLO NAM04-MW2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233663AbhHXR2L (ORCPT ); Tue, 24 Aug 2021 13:28:11 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=VeulxjUFDDPRebaBoouBDnV03m5tDsOQSi8hK8pUQ1FfnnLXMiltsmi34Qax5h26u1RCAY9u0aFgh8w6eCNC1rgWqDvUsWO9a4RH0b/o+PsWk/stejY5NdPtFFsgwm/1VE7wMm1CN8qzWj9rSH9igbgN+iz1VD3fK7p0J2JUiSDH0uLkdu53FynUpWlP/lxIb5ndBzGkQyW5MXzfoUOdx7Uo8+FL8wak0RwvsuOA28sYQsgTBi/tbJp5xJmSs4fI5867zfd4DU3GXjf4V3Sa/GGTt+uYP49a783Xg5zE03Q4SJeI7cZoEsZKeNLI/STCtfRT06lEbw6z1Yv7GeVprw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iMg+xlDRRaGUzbtMimSJUGsRul99+AZJxhTxEAorL5w=; b=NItPCw72wiGZH8rfIKTigv1XmIe8im+3eGC3OZs2LBG4ZHVUQ/rtZqU2NuiQf5ReCu7ITvWViMmKKV7nx1lRGbXRjw9AegIPkR2ode/ogr5rStdR26F/ZAd8ISsAftXBRp0MnVvJLch8uM1Q0jd4TL/x61EX6Cj1KSEaBov44K8yotMSjEYSLmBU7VsSrDlkW1dCWT/vsZkKPSylM9VqERSckom1NuJg5IQGVqW1JvU+YQhNH+nNUIEQyr2dEqKsZciUsahbBkeIfDSm+uNnqux88iOI8aczYwZIRp8oxIURRxbalu1QekcRmiYUKIcylr0ZfU9f+HM0kCesl0OP4A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=iMg+xlDRRaGUzbtMimSJUGsRul99+AZJxhTxEAorL5w=; b=gt/e9CUFOxYCIXNJcHXPLCDZD+5IogsmxILiwzKlAil7fZjrV/+nP0dSeOHXIVKF3VfD4JienuHTcZAAD72XLuPvMwqIW/8VCe+d1DmI3N3+Se8/pGXrp6hYAnJFU2qUAwK4CUff1HYlO14GwpnzNrhY2tlzpcLBz+ilSA1iWTxiCDz3Pu17Jz3yz6XCOAxEGyxmv8FEdoZrJelrj3s7k7KXV9nmSd0wIUIpVme+PEg/BVsgg/XeE8fmL4UnK6oFbw0wNC2UCqBV/EJUnRKHbPt9qToke+3cPoIvJ2MpfAWVmPFp3b++24fptSNyxTL8NN983x8gsWIJX5074NGJ6w== Authentication-Results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=nvidia.com; Received: from BY5PR12MB4130.namprd12.prod.outlook.com (2603:10b6:a03:20b::16) by BY5PR12MB4129.namprd12.prod.outlook.com (2603:10b6:a03:213::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4415.24; Tue, 24 Aug 2021 17:27:25 +0000 Received: from BY5PR12MB4130.namprd12.prod.outlook.com ([fe80::c557:5e37:2390:beb8]) by BY5PR12MB4130.namprd12.prod.outlook.com ([fe80::c557:5e37:2390:beb8%7]) with mapi id 15.20.4436.019; Tue, 24 Aug 2021 17:27:25 +0000 Subject: Re: [RFC] Make use of non-dynamic dmabuf in RDMA To: =?UTF-8?Q?Christian_K=c3=b6nig?= , Gal Pressman , Jason Gunthorpe Cc: 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 References: <20210818074352.29950-1-galpress@amazon.com> <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> From: John Hubbard Message-ID: Date: Tue, 24 Aug 2021 10:27:23 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 In-Reply-To: <6b819064-feda-b70b-ea69-eb0a4fca6c0c@amd.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-ClientProxiedBy: SJ0PR13CA0132.namprd13.prod.outlook.com (2603:10b6:a03:2c6::17) To BY5PR12MB4130.namprd12.prod.outlook.com (2603:10b6:a03:20b::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [10.2.54.195] (216.228.112.22) by SJ0PR13CA0132.namprd13.prod.outlook.com (2603:10b6:a03:2c6::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4457.8 via Frontend Transport; Tue, 24 Aug 2021 17:27:25 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: eeab5e7b-7ae2-403c-ede0-08d967247086 X-MS-TrafficTypeDiagnostic: BY5PR12MB4129: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:7219; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bjVTIuNRBqAEZptFCqfkZYtefeGDL5iEJNC/FMxYet+0soi9ncwiu8B5lWP0LTI3ZCWqXuss+r3tFrsfliKQ6WVZ1BiCNzBzjMrYZ6gZ1FFg/oCRHMgIuS8eAkCP0TSgNXgA+3MogDHRftoBQ6B3tvI0NFF3/JFSei9r+j/qExJ7uLwb1ETzqaqHbh8dcUdT+6Ri8RYhFF9owd8u4b8JAau5pWvwW05UWLzMbBj7Clm8EZ/IpgVgMpSRoOUnWMzvCbm/iw9EzKIyZFd4d9pbkmAH+Vb9B8GYudScWTcqaTq4sx3uhTStFZxd/0fnyeJRE0q7Z3HFtEFeg8d3ZuiDVwGFBfxr5M50djuQu9D3S8+JtLpflVjp51EiPdM3wU/PftgZu1DOknj7aUgnqOyJZfE9iHnShb4ETs5sIK3ZtnAA1fOC4Tf2QKzPR2QYOmg7ekzfCOaFw/kZdXZUORO9kTQS+B5f/KHjV1+HHojGDLv3nKNftTAERvFScO0XGER7SHBHng6pZt2fkePk7GkZU3Oqpbe9gpeZat8ZijuGQgOu3Qw7VguWStx/U55MKeMZFHsVLCneOZRfzQ+7OwhUR2RSrWhRx+PVloiLeScAfYT8X1+EbZYzFdunSKDkfXjT9LjfD8XiRflC82aPBIWhs6rZ0Jnzdy0h+a/EM6oLoM7z3hkghky0aH1uSqbflcCcQO2PTd8An0a+RCM8nwzlQaoywZIaqrNpSihbjwtBilA= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BY5PR12MB4130.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(39860400002)(136003)(346002)(376002)(366004)(396003)(110136005)(2906002)(66476007)(956004)(7416002)(8936002)(316002)(2616005)(4326008)(83380400001)(8676002)(26005)(5660300002)(6486002)(66556008)(66946007)(478600001)(31696002)(36756003)(31686004)(86362001)(38100700002)(53546011)(16576012)(186003)(66574015)(54906003)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?d3hJMVZsbGtnZGhmM2xUMkRYTjd1OVd3NW9xZXFwTFJtSjJXR3NaSUY0K0JX?= =?utf-8?B?cm5pM2VjblBVVzdUajk0Z2JqbXh6TWNLVlZpQXUvSWFHN3NNZHh5ZkdPMWJQ?= =?utf-8?B?SU53TUVEQkhEcytyYzJQQ2JheEc5M0NINjVJa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doOC82RVpuVktXM0ZGaEJZZTBFcDFDT2YwUEFSYXNkb1Y0RU5NM3k2?= =?utf-8?B?ZHR4Z3ZLTnZYL0owNjh3OUpvVE5kcm1wbGdLT1BuSlVaMjlHMnhLa1BLZ3du?= =?utf-8?B?NzdqRnFmUGxVWVhSbW1oditTQm9TdE1ONFNDQjZvTXIrZ2g4YXBIREVvT1Zh?= =?utf-8?B?dnBxR0lvTlFGQXBrbHJjdzhFUE5OT0NNVXlUZXdpWjdmYnUyUytUOStUc0E4?= =?utf-8?B?WFZQak5CUi9jc0RqUmtHUmlSa3NqdVd2RWRwbmhScy85d3lMRzR5K29pdEdD?= =?utf-8?B?MEJWYVljQ3JjT2IrbnhVengxRlVxRm9aUnBGMDNSaDdVbHZqWGo3VExEUGFS?= =?utf-8?B?emMxMGtZbUNtTUw2NFBkWWVMUmJCK2RLRjFNYTNRSjZoRTlJNlNNd204Z1Fr?= =?utf-8?B?UWs2Q1Y0RG9LQ280elVtdC9WT1MwbUZyMVQ4QmhFcXBuZGlSbTdZOU1wWHlp?= =?utf-8?B?STNxaE5idlkyVTBublROeDQrbXZ5N2xGb2R1NGJxaUFmNnRodlM0ZWxLVWRz?= =?utf-8?B?UmJ4WU5zQkc3RTNLYjZLblJWWVdaQVBnbGJVTDFabkJjSHhJYkcyZWNlbmFQ?= =?utf-8?B?MHZHaGI1U2FUcHkyVU1kbzdvNmUzZUw5UGdvd2Q0cXowQVc1cWt5a3JlWGxK?= =?utf-8?B?cnhEYnovaFhGK1NkSjhBUk05eFpyY3ZpenBNd2RyNndCRUNGcjBUblI5Zy9J?= =?utf-8?Q?8bJe0aYPYlYLQbveB5IJMelTClCgmZPHAkSlUAd?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: eeab5e7b-7ae2-403c-ede0-08d967247086 X-MS-Exchange-CrossTenant-AuthSource: BY5PR12MB4130.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Aug 2021 17:27:25.5473 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 2Dj3t169YjzkoKXM3LHwwoLn1hZJJD9BWFrRpWMXob/44MGgEA3MCXVUhTHBqqbQcbmmeHaMAvvBHjQpuD1Qgg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY5PR12MB4129 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8/24/21 2:32 AM, Christian König wrote: > Am 24.08.21 um 11:06 schrieb Gal Pressman: >> On 23/08/2021 13:43, Christian König wrote: >>> Am 21.08.21 um 11:16 schrieb Gal Pressman: >>>> On 20/08/2021 17:32, Jason Gunthorpe wrote: >>>>> On Fri, Aug 20, 2021 at 03:58:33PM +0300, Gal Pressman wrote: ... >>>> IIUC, we're talking about three different exporter "types": >>>> - Dynamic with move_notify (requires ODP) >>>> - Dynamic with revoke_notify >>>> - Static >>>> >>>> Which changes do we need to make the third one work? >>> Basically none at all in the framework. >>> >>> You just need to properly use the dma_buf_pin() function when you start using a >>> buffer (e.g. before you create an attachment) and the dma_buf_unpin() function >>> after you are done with the DMA-buf. >> I replied to your previous mail, but I'll ask again. >> Doesn't the pin operation migrate the memory to host memory? > > Sorry missed your previous reply. > > 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"? thanks, -- John Hubbard NVIDIA > > This is intentional since we don't want any P2P to video memory with pinned objects and want to > avoid to run into a situation where one device is doing P2P to video memory while another device > needs the DMA-buf in host memory. > > You can still do P2P with pinned object, it's just up to the exporting driver if it is allowed or not. > > The other option is what Daniel suggested that we have some kind of revoke. This is essentially what > our KFD is doing as well when doing interop with 3D GFX, but from Jasons responses I have a bit of > doubt that this will actually work on the hardware level for RDMA. > > Regards, > Christian.