Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2922803pxb; Tue, 24 Aug 2021 10:40:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz58B5dCw46qbyaW3jdF0cor3k5TJ3dzHn9ViUWlbFKkaAGgJCFO/IJYerP6NSEXkDmx3TR X-Received: by 2002:a17:906:a18f:: with SMTP id s15mr33252387ejy.269.1629826851690; Tue, 24 Aug 2021 10:40:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1629826851; cv=pass; d=google.com; s=arc-20160816; b=A54OJ/PhGfUyoik8S00+blKCeqtH+qIqtlNwGwjL0Pa0XVhI3Iw6CPgdr2dhoFkFau hYofn9s5+pujLUgTh69h1KknPv2PyUG5H1VSZNHkhyqo3gKiTQfa4IECKA4Hz0euLBIc 3vgVR/YlK6iSX0pyaxCu5EjNqcbsig+txZoQGO4d2Xh61m+nQVrDtsx1+aug1JNhW+56 KXvVDzdTASFh6H/ozVeyBrFl0o3Mb4+MxLQ/3iosVKyffHYAHBgVyhoY6XxudGhEWRQa rWfkG8M9PdYADyXduoOcgPDy25bfCKH++id70QhrRi5vXYr23lSqu2I9UMeSSNO/v2y0 DfAA== 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=JqrMqXGW3k7lyXx6xxiJ85q4YgI6iQzpgxpkx54miu4=; b=EakawylDyBaYn9lZ14s6xIeurmudOX8bH2f4Q5adyo1RZqYAEY7eYTn8KoT3pBUleh fsSZBkk9TO2Fr9zjcswj1WIajb371KKKvx6cKGXtNDPLxzgvFUjZpvgMNKu/0pJRXV/f 2ZtFmlSH0CgVbNXhIaOrUodUbbCB/5x83khKf4/HS6ZR8xyzvjPdgnYBkwgpc5323wOP gtmfDG/tExhloi5cTUjOm/VZXE0REI1YA/yltIm5uz8vxyHjx8zxLvfWaeY6+cmWfBpM U7BJec891QslPVEEUCB5McL1EH69wXI4FBMd3pjFZveqWPjmoQU22324mBE2O89BdgcH lQeA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=XeEPR+DH; 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 r21si21079850ejo.47.2021.08.24.10.40.27; Tue, 24 Aug 2021 10:40:51 -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=XeEPR+DH; 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 S242603AbhHXRjc (ORCPT + 99 others); Tue, 24 Aug 2021 13:39:32 -0400 Received: from mail-dm6nam12on2057.outbound.protection.outlook.com ([40.107.243.57]:21796 "EHLO NAM12-DM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S241631AbhHXRgp (ORCPT ); Tue, 24 Aug 2021 13:36:45 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C65z136P1B1bguvEokk0B5JWd7Pf7LjymwOGq9zQxqHODeKgCVnlosdaH2Zm5oLmYGHNAHbyK91/Xt7E777GKWUmeLPmv9aslhqms/7WSDAb9IEROlB4yZN5VvgutpaEsLlsw1MJOYZ33Du4qkXcYZbkRq+YhMyMQl8cDg+Ocn8ME9XLxzsryuGslnJk8jQ34z85evqaS2Kfi/bSI40V99qBpujePpEnFmzRd5rCdl8XSXhYeHMrrCjd/oZcHiRv7YIi9m8viY2v2tlRtpQibuJsxF6NIAVIKi/Tol8fyXjVnZSnW7McsJZODRIzlaEhsylilqY8616Jg5JTvsTH6A== 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=JqrMqXGW3k7lyXx6xxiJ85q4YgI6iQzpgxpkx54miu4=; b=PeIphueFRq6aM9G4R1R9hySpxpBwrl9zrZRskWFH6ixZ4bsy6T9LR1lCmyqGKRY4iAtRCncG8KR5RIY6wS3VpcqrdKIqGIFmoh4P24rx8zkPaylQK4Ob3a6X1lquo9rO5qtIzBl/EcIeBFhYOnsMv0G4Mr1M9fKuA2taAliwgI9zRxFNK7UQbx8da0RBGE/CXzd5gB19qQKtKGvrHzcNulnSZXIP+YpsXcqCoeeti7TpnI25UCNgNB+WOW+wWxo0mTdRFt12VydrYGQzcFfVC2+JCG9cjr2CtFyzMOw3pw7m9rVSSU12DvLsybTqoW53ehO+b9MQDQRp4dwAac5Hvg== 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=JqrMqXGW3k7lyXx6xxiJ85q4YgI6iQzpgxpkx54miu4=; b=XeEPR+DHNY8zUOPJrKxOTbot7z8cgr8lIP7waifOqP/21sJDlMyxq721cPkCeUtH3gGc7zonT7wpsf44a9WEwkZT2SGulYSuJW+B9CUej5KQWznR3spzhc0Z6E8M1q+DJ9s8vlqxTnVFOYoLomabDml4e7DB9CgQe2bDIRw/Y6s222Uqr1WT9jUA5MbH8fnjHzWvlkNh15/vEC8ZJuQzYAAb+DePXM8xMWj1TMfdgtk1+XUGizjAHQ3L/O3zCkPnjWnT8ODF7eY4ez79F7IUOnfSfbu8v4TNW71yKLqxyY5jA9cIcbnqfE8W+ACYwdXfWBTyxYytga5Z/jY5n47pwQ== 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 BYAPR12MB2678.namprd12.prod.outlook.com (2603:10b6:a03:71::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19; Tue, 24 Aug 2021 17:35:59 +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:35:59 +0000 Subject: Re: [RFC] Make use of non-dynamic dmabuf in RDMA To: Jason Gunthorpe Cc: =?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 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> From: John Hubbard Message-ID: <1d1bd2d0-f467-4808-632b-1cca1174cfd9@nvidia.com> Date: Tue, 24 Aug 2021 10:35:57 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 In-Reply-To: <20210824173228.GE543798@ziepe.ca> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-ClientProxiedBy: BY5PR03CA0010.namprd03.prod.outlook.com (2603:10b6:a03:1e0::20) 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 BY5PR03CA0010.namprd03.prod.outlook.com (2603:10b6:a03:1e0::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4436.19 via Frontend Transport; Tue, 24 Aug 2021 17:35:58 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e3e4ddb9-719b-4edb-c304-08d96725a292 X-MS-TrafficTypeDiagnostic: BYAPR12MB2678: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: byf9b2XDry4nSzz637gTsG0ynJtigJKad0ldPUIDcRBhLDkxov9jF/Oic1/FGl00o23qCkcfdCt4csQYC/uXu7ygCrLBrVNbrrlNwFjRPXmoC2Wrj4NY4IRqat0rU6pd0VyVUyTTWKCB4DPLA9OYXD4qgSpZWqMnOoQDk39QM6BpG6IUbpYatBNTt1DS8ZxFLwq38yVjzViPx6E888PgnTBfhrb4S2f60ktRDGwrl/2TuhdlDR4QL0rBEH7KEqs473br+T549hSFaTSnsjro4ZsVdCqUuaNv65oZjD7CtBu4ItNbzfQavg33R7qiYJnCZwRiTZ4M/osOcnT/UXx16qrK6ntPyilDhE72+WehsUiV2+mFfVVOEXUz292AF7VGzbH8FYng+8WTbC+H6eE0AFJ5Phv1eNg/9336wCIgZIJe9Pi5uDdQxj+kMzxymhaEGHBNV5PgdTK08qOEoSTCd1k8yeLeNAOOCh1bfNL3dztVqdFbXnOyJxaxI/oOS+3NcedXxBKGqWTthjo7sR5SdTWDNX0T1NnMdRjF7Q/E1WtTzoJfyGr25pTosXf6be+usVBAHEQLcXDO+aOML1/UEs1UdMBYPUT8qNjW6z0MR5e+waogMrodZ+NomugOVBDEd8d+GbS2TfT/oBY4duCtxI+1PONPSwcqsRelXXFHB8DH+tBTFFq1sw1fsH//LdHqBU216BxRbwp1kOnm8GMEc2WXgML+VRbNjjJV1n5HdU4= 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)(396003)(39860400002)(376002)(366004)(136003)(346002)(16576012)(7416002)(6916009)(316002)(478600001)(54906003)(2906002)(4326008)(66476007)(38100700002)(8676002)(5660300002)(53546011)(31696002)(86362001)(31686004)(36756003)(26005)(2616005)(956004)(6486002)(8936002)(66946007)(83380400001)(66556008)(186003)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?YmwwL0VBU245SXRkU0RWSFB0SWdkRW5GV3pUNXdWenJLNnI4dzRlM0V0WFRD?= =?utf-8?B?Y0V1YTVlWGNSTkFnWGlQejBHYUppVnBUelFla0JzYkUxWXRTMWJ2SEcxdk9n?= =?utf-8?B?aktYVDIrT0dUczYwdEticGhpQ25obklpeTJ2R0V1bC9LM1NBUUZZcjJrcDds?= =?utf-8?B?TV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ZDBw?= =?utf-8?B?Njd1VlRXOHdZUUNNZmQ4S0FITHZRaDhpS0owTENSN2ZkMFlObWl2TUNER2t3?= =?utf-8?B?eWVNaW9NWVBYNmozUU5vZ3h1TUNvNkZ4Wi9ia3Jxc1JiZ2hnMlBGTXMrYjJl?= =?utf-8?B?dGVGdjBxUmZNb3BGb09VL2FUNEpweklMV1pFTVAwLzJ3ZU00TUZKVXZlQmNJ?= =?utf-8?B?MzZKcVpNTUJJZWh6YUJzR3B2SmlCU2dFWC9lWFNpL2YzWWZwekQxWHcwYjdY?= =?utf-8?B?di8vZ1VTUVpRRDgvbVRlQmc1cGozdHBaVEt0WC91YWVTZmdMcktVUkh4YlFW?= =?utf-8?B?NzIxRlh2YWdsalE0cmUrVEhFbFVWVG5BaUhjOU53R1FlQlR4L3BDWXZxT3Nz?= =?utf-8?B?UHBNdXdrZTFmVVV4MGY2SFdQS0dZa3NXQlFQdUNOSGFVQ21XTlRlQy8rWXlY?= =?utf-8?B?bmJiNjZvZmxuM215SHdvdHRJeWJXbTRDNlQzNlJFaGNhUmJMUW9Gem5XWDJn?= =?utf-8?B?NVhmUWM2c0xjT2MreWM1YWgwMEt5MjgxTm1vTUtLbzFtZFlUeURDTlFKNEhi?= =?utf-8?B?bDJGU2p0L0N0Nkw2eGppeWM0cjVVZm0xcm9pcmVyMmE5WWNma0ZsbkdlamhI?= =?utf-8?B?NXNkVVRkMmNCenNzRVRlQjc1SlFZcEtwVlpJa3ZORTJQeitHeEpyUzF4RktC?= =?utf-8?Q?ewHAjzIOLuPH3YBaFbcIc0g9f66MmOqBD+L2PRs?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: e3e4ddb9-719b-4edb-c304-08d96725a292 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:35:59.0804 (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: zFwjtVyEbOPxYB2D6GEXYLWQ+4s8B8+m14hMJqCVoLUtwbSyghO0u0IZjAJYqIJywBhvNSO+0U+CvPXwUlTZpQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB2678 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. thanks, -- John Hubbard NVIDIA