Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp12074598rwd; Fri, 23 Jun 2023 00:38:54 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ46ibuaPH02EftE44SYrDec17XVkeRxyZ8Uink8ub9D3KfetxMBBmBY3Ntcpv+RpMOrxFPX X-Received: by 2002:a17:90a:be0b:b0:25e:dd5d:7e4a with SMTP id a11-20020a17090abe0b00b0025edd5d7e4amr10614292pjs.6.1687505933909; Fri, 23 Jun 2023 00:38:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1687505933; cv=pass; d=google.com; s=arc-20160816; b=G6L0j8mANPn4v/3Mbwg8j0932xUhmEG00T+QY24T9Er7zaYriXIFrT3nuj8PoGFSZQ k8oM7yakbt12Zhhc8zaBJvyVnAjGy77CwL3wuI3L7hQqkZ0yM6XJS7kSjdAhGh54y4Q3 Y7pYyl1M15aadkdvw9cvEnNM6ts/7DmnFSqtxOCheLNAbzvwa3K1sg+d2RFKDVeXPsL7 vApb3m+BYJ6wgUKwBxkyteLwbUhG8DtTQYjVXFEJ3hNiFAy3Hfy1MAp6HX3uqGkCzAiT l8bRxea3mQcINlzpbEFRDv9q5I/MIX5vyyuGr2z1YJhwPmgcymydjb5tEluhTIK+Cn9k 0YaA== 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 :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=aqgeyka321mpZtu9ZJCBOB+yJsk2eLJkUAyCTVGJk5I=; b=bE5nGFe+KTESW1xEptRQCbo36ix0RlykkmgqjIeqNWltYazTRRoWvP/rgf3mPZoqWR Co5R32W43yDjpFR4CZI+SHhn4EXzODnALw4zu0AlB1XCMyM3wrf4VDLXN9naPUIX0jXD NzBmHzWOFUYBEew/WdITCr8F7WjICeJ22c05MbYEJD8GkV7t3pFcNgJrOJtewCk18k5i 4K7yLxI25SUbUBN+ymCsczCphgHEVQByK74yBEjQQGBlQBoJpSPiWKUOeFKJLnoa74R4 mR3XWS6ee8kteyZUm1KSGCoPD//suKg1rsmqbBBGP/VSuYc+qa0dCb9KKTng//8aNKlV oVzg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=F8ovIMIV; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z2-20020a637e02000000b0054294720d51si2299768pgc.386.2023.06.23.00.38.41; Fri, 23 Jun 2023 00:38:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=F8ovIMIV; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230117AbjFWHQ0 (ORCPT + 99 others); Fri, 23 Jun 2023 03:16:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229445AbjFWHQY (ORCPT ); Fri, 23 Jun 2023 03:16:24 -0400 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (mail-dm6nam11on2041.outbound.protection.outlook.com [40.107.223.41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44F3F1B4; Fri, 23 Jun 2023 00:16:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GbmPbOWd6poep/xWwo7IQoKtf5r2pq7SrRzOFtHMnc3cyQtvUhviaSa3qWuh7HKfizlo5HK3/VWGsbeTpr1fLDmIbuzF6Cjgjmax+pTj8aur7M7OoVF9KgPTvox1iHF35VOH8bE48Niceae8CRiv3C62Q/8/5HyiyxV/xPqLhY9x5tn3PEuwKTwSWOtp2nndOzXZrw+QQdRBocCebUCCDhW4yHwoQcjXhAnPlYQ10DEFUXL0X4YhmnjIXGeA4Fvz+LFGLH+84BMuparLGLx484D2GX9dOi3g3YKrJ8jT/2aZXQxRrlr9KrWiBp1agVZjNETw1aNgvkTLLK/HAkRCaw== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=aqgeyka321mpZtu9ZJCBOB+yJsk2eLJkUAyCTVGJk5I=; b=kzuO6rmMfBjrNyqZ8i5angWP9rs7AGMZiQTUzOH2iCxVE727s0QeY6fl8JkfAV0mffbfe6yaFos20GiYFUxdBoLMmI7+co4PRnK4dgVi1qXVLtkuP5vgqy3tLHZL4BAFtlfoDTEEsqRz+KWSlnRaWvMyhbHfo8HPFh8yTGvwYavGyzGYsYnfovMwFlGOVNp/6r7ubIqQBKrMBwojPZgIINgVMr8N5zPwiL9FLjmX5z4zRBG3EACxHeIAurx9rzpVsDr9vlIH0gIsFrcYw/5wyE1lBU+wonWTB1tCrCE19u7V/n0B4eZsa3uT7v8CLJzg2OGb/zEw38hi7q6f81tc1w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aqgeyka321mpZtu9ZJCBOB+yJsk2eLJkUAyCTVGJk5I=; b=F8ovIMIVwsuRq8tbw/DxX0oxXirIY+9yIhc4YSzZWb+5BlK61vC9q/KEDf6DztM1w/Lhtj9sCu8T/hqN9ya4pFPedOSFvH6SkQVAetNRFhua9NgxSZ+B7PtQ6H7foEi6M9nwbbUbnECmoTiH27oS906tSFXSYhYlEe1aRlGdA3o= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from BN8PR12MB3587.namprd12.prod.outlook.com (2603:10b6:408:43::13) by DS7PR12MB8347.namprd12.prod.outlook.com (2603:10b6:8:e5::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.23; Fri, 23 Jun 2023 07:16:20 +0000 Received: from BN8PR12MB3587.namprd12.prod.outlook.com ([fe80::384a:95a4:8819:ee84]) by BN8PR12MB3587.namprd12.prod.outlook.com ([fe80::384a:95a4:8819:ee84%7]) with mapi id 15.20.6521.026; Fri, 23 Jun 2023 07:16:20 +0000 Message-ID: <4a52ac7c-19ba-8906-5902-fbf75673bf59@amd.com> Date: Fri, 23 Jun 2023 09:16:14 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH drm-next v5 03/14] drm: manager to keep track of GPUs VA mappings Content-Language: en-US To: Danilo Krummrich , airlied@gmail.com, daniel@ffwll.ch, tzimmermann@suse.de, mripard@kernel.org, corbet@lwn.net, bskeggs@redhat.com, Liam.Howlett@oracle.com, matthew.brost@intel.com, boris.brezillon@collabora.com, alexdeucher@gmail.com, ogabbay@kernel.org, bagasdotme@gmail.com, willy@infradead.org, jason@jlekstrand.net Cc: dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org, linux-doc@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Donald Robson , Dave Airlie References: <20230620004217.4700-1-dakr@redhat.com> <20230620004217.4700-4-dakr@redhat.com> <41aecd10-9956-0752-2838-34c97834f0c8@amd.com> <86ef9898-c4b6-f4c0-7ad3-3ffe5358365a@amd.com> <2f502150-c1f8-615c-66d9-c3fb59b8c409@redhat.com> From: =?UTF-8?Q?Christian_K=c3=b6nig?= In-Reply-To: <2f502150-c1f8-615c-66d9-c3fb59b8c409@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: FR0P281CA0158.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:b3::16) To BN8PR12MB3587.namprd12.prod.outlook.com (2603:10b6:408:43::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8PR12MB3587:EE_|DS7PR12MB8347:EE_ X-MS-Office365-Filtering-Correlation-Id: af6da362-7c2e-45e8-d435-08db73b9be10 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: MI7SX9pkGSAlzN5r3nOjFehdz+9fzBua6UgQK/oJssSPwJ1isJ9mW5ADD78VnYzFwm9HeccJ/1k8Dte/fwOZUZwW2IHxk+5fKhFHo0X5iCNrEI3AL2HIBJ4aG44IB0LZ4CmK8oHPil/exzup1NXp5DU4i4FlXV3/6JM0TULqd8tjbbmya6TiAvYnm0TJRaT6NFLY3TV9043pxsZGn2BXfwdA3Zm9EczNmRAx6iW/2o6A+bxIP6mS6dDFQ3QeSwMkhV+IJZJ0e6q2CYlnnBpieu+hlzrsIBUE9GOM2iRuqRgKXf+h9yrgnofTj0tjFlMOyadY9aaRny8X1IGVRg0v2bCAI2PkkAvF7r8sXMByLWFfHednf7WIuFxYuPevMw3QTdncrHaLyIw3VO0JeztsIyFJZtnCuV7jKMavio8QvrpfkutPyyVv7RqzYem6RG9/J3ux7G/rg3Gy0IuhGNBBLR+g0uc4FcOmzWpoEq3bkIT7th7UL3aXGTzhcGwc85EatCii+AwRmioFybVZgRdefaEwd9nHvevMqW0yRDX3Z9IiY0kDu5cwkkJ9iFJ0P2TJTjofzZPldb9ml8jdpJqnJTIcJkqf+f+lqvOJh4hbq0MXPvt4C+Fsas5Es8TeR0qZ3QwIw0D9PfQ0D1bwJWj3rmpZZwwn23wSW6sJgucxKOU= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR12MB3587.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(376002)(366004)(396003)(136003)(39860400002)(346002)(451199021)(53546011)(38100700002)(921005)(6506007)(83380400001)(66574015)(186003)(6512007)(2616005)(7416002)(41300700001)(8676002)(8936002)(5660300002)(36756003)(6666004)(66946007)(6486002)(478600001)(4326008)(66476007)(66556008)(31696002)(86362001)(316002)(54906003)(2906002)(31686004)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?TUZEeC96L3RQTEVNSkRQZXZJY01IbWtDY0kxbFY5TUNxVVViNDNPQ1R4Wk05?= =?utf-8?B?clFXR2RFb3M3NU50TmV4d2ZNcWYyTnRlV3d6WWs2N0QzWXVIbzhTWi9wajBN?= =?utf-8?B?WTZEV1ZOSmVNRFFWVU9lQXJGMGFSM3A5WkdFcExWek1QbW93M2J2dDhwTVk3?= =?utf-8?B?VTQwV055S2Z1NHMyRWsyaGc2SFovalZjZU5BVGpzQmpSSTI0cVhhTEJMRHpr?= =?utf-8?B?L3ZvN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utf-8?B?ZUUvMVBYZGg3R3Z3L3dZczJNYUIxSEU2RXhTUG5zaWsvNjkrdXVJZkVWTm0x?= =?utf-8?B?RnVTQ1BuS3A5TEZCU1FFbExwWG1PbGo5a2ZvUjFpMlduSGNUd3gycFo0Uk8v?= =?utf-8?Q?lMoZJkt4U3RivcJZJpD05AWJ3Mp3Rw6Lww+qz6/XYxWT?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: af6da362-7c2e-45e8-d435-08db73b9be10 X-MS-Exchange-CrossTenant-AuthSource: BN8PR12MB3587.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jun 2023 07:16:20.2254 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: v2jl5JSjXaTnwP+zAporxzG8yiSJQEoLttJAvPL9IV9e8m5bk5moZesRJM+UHx0e X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR12MB8347 X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am 22.06.23 um 17:07 schrieb Danilo Krummrich: > On 6/22/23 17:04, Danilo Krummrich wrote: >> On 6/22/23 16:42, Christian König wrote: >>> Am 22.06.23 um 16:22 schrieb Danilo Krummrich: >>>> On 6/22/23 15:54, Christian König wrote: >>>>> Am 20.06.23 um 14:23 schrieb Danilo Krummrich: >>>>>> Hi Christian, >>>>>> >>>>>> On 6/20/23 08:45, Christian König wrote: >>>>>>> Hi Danilo, >>>>>>> >>>>>>> sorry for the delayed reply. I've trying to dig myself out of a >>>>>>> hole at the moment. >>>>>> >>>>>> No worries, thank you for taking a look anyway! >>>>>> >>>>>>> >>>>>>> Am 20.06.23 um 02:42 schrieb Danilo Krummrich: >>>>>>>> [SNIP] >>>>>>>> diff --git a/include/drm/drm_gem.h b/include/drm/drm_gem.h >>>>>>>> index bbc721870c13..5ec8148a30ee 100644 >>>>>>>> --- a/include/drm/drm_gem.h >>>>>>>> +++ b/include/drm/drm_gem.h >>>>>>>> @@ -36,6 +36,8 @@ >>>>>>>>   #include >>>>>>>>   #include >>>>>>>> +#include >>>>>>>> +#include >>>>>>>>   #include >>>>>>>> @@ -379,6 +381,18 @@ struct drm_gem_object { >>>>>>>>        */ >>>>>>>>       struct dma_resv _resv; >>>>>>>> +    /** >>>>>>>> +     * @gpuva: >>>>>>>> +     * >>>>>>>> +     * Provides the list of GPU VAs attached to this GEM object. >>>>>>>> +     * >>>>>>>> +     * Drivers should lock list accesses with the GEMs >>>>>>>> &dma_resv lock >>>>>>>> +     * (&drm_gem_object.resv). >>>>>>>> +     */ >>>>>>>> +    struct { >>>>>>>> +        struct list_head list; >>>>>>>> +    } gpuva; >>>>>>>> + >>>>>>>>       /** >>>>>>>>        * @funcs: >>>>>>>>        * >>>>>>> >>>>>>> I'm pretty sure that it's not a good idea to attach this >>>>>>> directly to the GEM object. >>>>>> >>>>>> Why do you think so? IMHO having a common way to connect mappings >>>>>> to their backing buffers is a good thing, since every driver >>>>>> needs this connection anyway. >>>>>> >>>>>> E.g. when a BO gets evicted, drivers can just iterate the list of >>>>>> mappings and, as the circumstances require, invalidate the >>>>>> corresponding mappings or to unmap all existing mappings of a >>>>>> given buffer. >>>>>> >>>>>> What would be the advantage to let every driver implement a >>>>>> driver specific way of keeping this connection? >>>>> >>>>> Flexibility. For example on amdgpu the mappings of a BO are groups >>>>> by VM address spaces. >>>>> >>>>> E.g. the BO points to multiple bo_vm structures which in turn have >>>>> lists of their mappings. >>>> >>>> Isn't this (almost) the same relationship I introduce with the >>>> GPUVA manager? >>>> >>>> If you would switch over to the GPUVA manager right now, it would >>>> be that every GEM has a list of it's mappings (the gpuva list). The >>>> mapping is represented by struct drm_gpuva (of course embedded in >>>> driver specific structure(s)) which has a pointer to the VM address >>>> space it is part of, namely the GPUVA manager instance. And the >>>> GPUVA manager keeps a maple tree of it's mappings as well. >>>> >>>> If you still would like to *directly* (indirectly you already have >>>> that relationship) keep a list of GPUVA managers (VM address >>>> spaces) per GEM, you could still do that in a driver specific way. >>>> >>>> Do I miss something? >>> >>> How do you efficiently find only the mappings of a BO in one VM? >> >> Actually, I think this case should even be more efficient than with a >> BO having a list of GPUVAs (or mappings): > > *than with a BO having a list of VMs: > >> >> Having a list of GPUVAs per GEM, each GPUVA has a pointer to it's VM. >> Hence, you'd only need to iterate the list of mappings for a given BO >> and check the mappings VM pointer. Yeah, and that is extremely time consuming if you have tons of mappings in different VMs. >> >> Having a list of VMs per BO, you'd have to iterate the whole VM to >> find the mappings having a pointer to the given BO, right? No, you don't seem to understand what I'm suggesting. Currently you have a list of mappings attached to the BO, so when you need to make sure that a specific BO is up to date in a specific VM you either need to iterate over the VM or the BO. Neither of that is a good idea. What you need is a representation of the data used for each BO+VM combination. In other words another indirection which allows you to handle all the mappings of a BO inside a VM at once. >> >> I'd think that a single VM potentially has more mapping entries than >> a single BO was mapped in multiple VMs. >> >> Another case to consider is the case I originally had in mind >> choosing this relationship: finding all mappings for a given BO, >> which I guess all drivers need to do in order to invalidate mappings >> on BO eviction. >> >> Having a list of VMs per BO, wouldn't you need to iterate all of the >> VMs entirely? No, see how amdgpu works. Regards, Christian.