Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09D21C64EC7 for ; Wed, 22 Feb 2023 15:14:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232329AbjBVPOl (ORCPT ); Wed, 22 Feb 2023 10:14:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232375AbjBVPOj (ORCPT ); Wed, 22 Feb 2023 10:14:39 -0500 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2081.outbound.protection.outlook.com [40.107.220.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7591020D25; Wed, 22 Feb 2023 07:14:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WikdilMnbFC0i+1veefBKThOn0M4vaArzgvgT0r/mEawI2ydYVTzM1cxg97yBk+h46QrHdYZ73RBZfuNuuCfQTvetNyf6SUZe93FxSCHG/IdBWYzeVJScAaxgiT5REzPnB41wS0bLOSAOIN1n6rgcMR2Ry4X5+cVTvNo2fQ86kr/it+6kZib75bGEPhpImlUnnZAm6lOy26in4JzNb9cNo7Zuoq5JhdRm4ziaiLHOmOn49CIxTg8K4KcGQyeCFWTq1BWfJC4ALt68OK9BqnJV6w9sQ+XqkIqOk442EQvyqMkcbIo3N28Ju+jhxjn3a82TRxxVEsMUEWK/AxaeG4lOg== 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=Jvapx6aY8UVoU2bouqBbKh0o9CmfLYVTQ/xgjDEQzjo=; b=D7rATxpPa4pkeVFd16Yg8ooBD68lP7fWBjjI9JDzmWbxwWdjVY0pZlu01PwiFrv1fhAH9YwuViuaSUmEc+OZwh0Ii1EIiPIwfRWX4EkUsNNjo7OhCyXYzodCFeAgrx/oY8kLs009GZDo+DRNT9g863fQb+WHVHiMIP/2gG5FzpcbEQ1MmwGmMGVMa2w7OV/w+uNyagCLdTxksaCaqrJeTmDWtoIjpP3urbodjbXDhbUh8hBVDhmNspO/zWsi6KuTzZcjc6dvBlxIY+HwxyrBT8vWVxolV5RnD4LGfjpe+vWtV629VwGRiB0deauLM9YTKtdKzYOnWa9uReoNhImi3g== 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=Jvapx6aY8UVoU2bouqBbKh0o9CmfLYVTQ/xgjDEQzjo=; b=22Jn9KuV7R8ebNcmDfTpSM55XxmCDc2xJo1nhiqeG+OLEw4h1zO2Cuev9L+8ETX5gosxJlgTOoKBW0XnVz8yPM4I0+4Qtypb9ndMtaubPaPmfrkTH4HOUfwm2MIuUp/T9xTYTch2QlPeOSGBSYzocRG3iiBY5Aq8HnPyv6WltfM= 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 CH0PR12MB5234.namprd12.prod.outlook.com (2603:10b6:610:d1::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6134.19; Wed, 22 Feb 2023 15:14:32 +0000 Received: from BN8PR12MB3587.namprd12.prod.outlook.com ([fe80::2e4f:4041:28be:ba7a]) by BN8PR12MB3587.namprd12.prod.outlook.com ([fe80::2e4f:4041:28be:ba7a%6]) with mapi id 15.20.6134.019; Wed, 22 Feb 2023 15:14:31 +0000 Message-ID: <29ea3705-5634-c204-c1da-d356b6dfbafc@amd.com> Date: Wed, 22 Feb 2023 16:14:25 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: [PATCH drm-next v2 05/16] drm: manager to keep track of GPUs VA mappings Content-Language: en-US To: Danilo Krummrich Cc: 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, linux-doc@vger.kernel.org, nouveau@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-mm@kvack.org, Dave Airlie References: <20230217134422.14116-1-dakr@redhat.com> <20230217134422.14116-6-dakr@redhat.com> <70ba382f-1559-289a-4922-ca9c371aaf59@amd.com> From: =?UTF-8?Q?Christian_K=c3=b6nig?= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: FR0P281CA0008.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:15::13) To BN8PR12MB3587.namprd12.prod.outlook.com (2603:10b6:408:43::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8PR12MB3587:EE_|CH0PR12MB5234:EE_ X-MS-Office365-Filtering-Correlation-Id: 5d4f2792-b799-4fa6-f3c0-08db14e77fa5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /PDRqFgsSaOP77DaCNTPuforgsZt+IcXNoTeNr5JxDsb48bT9nEAy4MYeLm42PFGxqC3gHJKgTWWIK+HY2C+2XrgUwdozEP+YbDE8/Uku+KQAShfjKfaln102sIO82JQAwKRRbpcOtcPQzxI+naVDVmXP0VdGJC5NYFrPnHRFZlch3DkaGsdfvfzmlJ73xfWHVUmazduAsCXeXzVpMIUnlpu9XJAufc7YkRVzg86/yTtg2xTbgADOYcsCyyeXxz1uflFv4uVpSTG+hCxirGyb7Hzur17j6+ig3gDJO1TTFLv4zqjWet9CcOrKUAaA2a6ZpbPpruVObj5QyII2/xNY2HrtsF2aE/oynyiJ0rBqrKtWYKSHW9NOnvYrsUalFrvHqaVTHhFM7c0g9hrtopYlc/eU6IcB0qQe+NUMQ8HDrOqAIyimkkZAPFKjOM6nUw8jfatgFZkKbUy4559c7Lg7R4AAnb3lgWQTsCfbPo3IECrI3ua9DBtBMr6F3NPjjfGzyFnJf+Z8mPNYHTrMXUsxjvHaMj+CSXz+S3uYBCDY3D4wPbqqlRDp41BeklkM8rUgvzWOZVydQ73tZxZJE2p2Splfgj/784heUnp4kiKB1znT+dyzM0tvYG1QwXLaDC/b1JBpzl/FvEhYcDdA83Z/36wKB3jmjnSXX4e25gqi00k/htvGDsTOAUCvepx6B9KyjdtPqCtQG9FGQVj2Eij8iSbPEVqVTA8j/wsD0nSXAU= 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:(13230025)(4636009)(136003)(376002)(39860400002)(396003)(346002)(366004)(451199018)(31696002)(86362001)(36756003)(6512007)(66476007)(66946007)(53546011)(6916009)(4326008)(8936002)(66556008)(186003)(41300700001)(2616005)(316002)(38100700002)(6666004)(6506007)(6486002)(478600001)(2906002)(8676002)(66574015)(83380400001)(7416002)(5660300002)(31686004)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-A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jlsQnln?= =?utf-8?B?UzNPTHo4N0o3L0R1SW5QWEkwMGdNZlVMeHFGaTlQa0I2dGxiMVZBVlhtT3N1?= =?utf-8?B?ajRteC9tV21wK1hndzBOcTF3NjZaMDJRemludURNMHoxd3pNVEJ5OU8wbEov?= =?utf-8?B?QlZTVXhKVWlyS2VBS3Y4aDZMdlpEd3QrZThnajNyS3FZSDgzcWI4OXg1L01u?= =?utf-8?B?bjNGYm55T1pBKzk4S1hRK0ludWgrZzNDa2luRndOa1pGSlBTRndoa3N0MVIv?= =?utf-8?B?YmVqWDVaMGFBSDQ4NE1CL0tLdnBBa0RGZ0g4dy9vVDM0bFk4K095NDRXMS9s?= =?utf-8?B?bXFPTXlET3N0Wnk5aGVTay9GOE4vN2dHSHBETHJHM3RXQy9NVGZPelgyelBU?= =?utf-8?B?NllDdjNIMTZjdEErOU9KYkVDSlI5bFhtSUtkSDh0TCtzYnA0emdxbnU0SDh3?= =?utf-8?Q?gMQbxXmrtwGLRmKz7P87SEgTr489F7dLMirW2Eqerpmt?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5d4f2792-b799-4fa6-f3c0-08db14e77fa5 X-MS-Exchange-CrossTenant-AuthSource: BN8PR12MB3587.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Feb 2023 15:14:31.6671 (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: 345VGiA10iftcGENcMj4XLr/sZVpsA815b/MkB9eRSUSnimiHMXwZSw9t3cVLEi4 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB5234 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am 22.02.23 um 16:07 schrieb Danilo Krummrich: > On 2/22/23 11:25, Christian König wrote: >> Am 17.02.23 um 14:44 schrieb Danilo Krummrich: > > > >>> +/** >>> + * DOC: Overview >>> + * >>> + * The DRM GPU VA Manager, represented by struct drm_gpuva_manager >>> keeps track >>> + * of a GPU's virtual address (VA) space and manages the >>> corresponding virtual >>> + * mappings represented by &drm_gpuva objects. It also keeps track >>> of the >>> + * mapping's backing &drm_gem_object buffers. >>> + * >>> + * &drm_gem_object buffers maintain a list (and a corresponding >>> list lock) of >>> + * &drm_gpuva objects representing all existent GPU VA mappings >>> using this >>> + * &drm_gem_object as backing buffer. >>> + * >>> + * If the &DRM_GPUVA_MANAGER_REGIONS feature is enabled, a GPU VA >>> mapping can >>> + * only be created within a previously allocated &drm_gpuva_region, >>> which >>> + * represents a reserved portion of the GPU VA space. GPU VA >>> mappings are not >>> + * allowed to span over a &drm_gpuva_region's boundary. >>> + * >>> + * GPU VA regions can also be flagged as sparse, which allows >>> drivers to create >>> + * sparse mappings for a whole GPU VA region in order to support >>> Vulkan >>> + * 'Sparse Resources'. >> >> Well since we have now found that there is absolutely no technical >> reason for having those regions could we please drop them? > > I disagree this was the outcome of our previous discussion. > > In nouveau I still need them to track the separate sparse page tables > and, as you confirmed previously, Nvidia cards are not the only cards > supporting this feature. > > The second reason is that with regions we can avoid merging between > buffers, which saves some effort. However, I agree that this argument > by itself probably doesn't hold too much, since you've pointed out in > a previous mail that: > > > 1) If we merge and decide to only do that inside certain boundaries > then those boundaries needs to be provided and checked against. This > burns quite some CPU cycles > > 2) If we just merge what we can we might have extra page table updates > which cost time and could result in undesired side effects. > > 3) If we don't merge at all we have additional housekeeping for the > mappings and maybe hw restrictions. > > > However, if a driver uses regions to track its separate sparse page > tables anyway it gets 1) for free, which is a nice synergy. > > I totally agree that regions aren't for everyone though. Hence, I made > them an optional feature and by default regions are disabled. In order > to use them drm_gpuva_manager_init() must be called with the > DRM_GPUVA_MANAGER_REGIONS feature flag. > > I really would not want to open code regions or have two GPUVA manager > instances in nouveau to track sparse page tables. That would be really > messy, hence I hope we can agree on this to be an optional feature. I absolutely don't think that this is a good idea then. This separate handling of sparse page tables is completely Nouveau specific. Even when it's optional feature mixing this into the common handling is exactly what I pointed out as not properly separating between hardware specific and hardware agnostic functionality. This is exactly the problem we ran into with TTM as well and I've spend a massive amount of time to clean that up again. Regards, Christian. > >> >> I don't really see a need for them any more. >> >> Regards, >> Christian. >> >