From mboxrd@z Thu Jan 1 00:00:00 1970 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7CD91E74AC3 for ; Tue, 3 Dec 2024 16:47:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E877F10EAB5; Tue, 3 Dec 2024 16:47:03 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=amd.com header.i=@amd.com header.b="jgoUjpJs"; dkim-atps=neutral Received: from NAM11-CO1-obe.outbound.protection.outlook.com (mail-co1nam11on2081.outbound.protection.outlook.com [40.107.220.81]) by gabe.freedesktop.org (Postfix) with ESMTPS id 558E110EAB5; Tue, 3 Dec 2024 16:47:03 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Jr12O4H5Etw5cUFqPTe1gMkbAJTS4tjUzrbJeQVdwx9Gp0kOjTJdmdGFB85AF8NISIceOVFyHXY5vD/CUA0yCKf5Je5mZ+zNIQvS3g0zQhrxzZfCRzSi8msj34U1UwO57hVnMadqjN2AQY+EIWSqvh9QiuHingLQMOIuXnMBJXeE9M5e+kZD5W10hS8GieBIFTmJDBY4aqe0E8lacyVom9zqQMqo22WUrmw05g7RCZipYXzYXPEa7J00u552kWY1a74Ap/aeetxtawwSCr8FhXpMzYEUwNccbD1toEQL0hj52Q6y3yGHaEo7XFd91F7O1IdibySsExZO13YJXSiYoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=bRFcNd+KI5OUl9AIsO+aK70HwPLycgCq29J/TewssB0=; b=vI9iV9J48BKqeBy/ABxltTZcXD/HUoVPF5z1iAeewya1qlBPYvQmx+OfY6vJMCVmc/AbFlyw2rUd0UEXienEKpiBVb5MorCwhX1nWW9QXFUr9ewGPczPVlVtp2BZCufwRTwx23voNtZhmeiqVqbKvf7SB/0YXdND9IX01Sb3B1IVvEQvF5W8AHL2ZrGmRaFRoqpUtnjOBlehqGJygM+cZ/H6MiSyZm1frgGsog3kNVMFUhhJLqlXI1eoOaOPjhHZ7LLVfZ7BL+1/JnITEef9UcXDaz6RGR1ER18AELff/PA9JAyWoMzedLMA2lcq2MmsbIDQHVeNP9CcqPCKxxu6UA== 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=bRFcNd+KI5OUl9AIsO+aK70HwPLycgCq29J/TewssB0=; b=jgoUjpJsKXEBx+knk0UW2mAblOZIYYdL7uWb6spbveYR2laBkIsZ6NZER0phY9CncBqUy2+xkL9VcoULs2DWxfBjP5VF2KJ3Yh8+aGT5IVsAKcM1b3bS/EN59640GzJ4pi0RPNPCq8GwQ/URJqyEBZDBk/Cfl4RX3jUK2sq1mmU= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from PH7PR12MB5685.namprd12.prod.outlook.com (2603:10b6:510:13c::22) by IA0PR12MB8713.namprd12.prod.outlook.com (2603:10b6:208:48e::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8207.19; Tue, 3 Dec 2024 16:46:58 +0000 Received: from PH7PR12MB5685.namprd12.prod.outlook.com ([fe80::46fb:96f2:7667:7ca5]) by PH7PR12MB5685.namprd12.prod.outlook.com ([fe80::46fb:96f2:7667:7ca5%5]) with mapi id 15.20.8207.017; Tue, 3 Dec 2024 16:46:57 +0000 Message-ID: Date: Tue, 3 Dec 2024 17:46:52 +0100 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v14 3/8] drm/ttm/pool: Provide a helper to shrink pages To: =?UTF-8?Q?Thomas_Hellstr=C3=B6m?= , intel-xe@lists.freedesktop.org Cc: Somalapuram Amaranath , Matthew Brost , dri-devel@lists.freedesktop.org, Paulo Zanoni , Simona Vetter References: <20241115150120.3280-1-thomas.hellstrom@linux.intel.com> <20241115150120.3280-4-thomas.hellstrom@linux.intel.com> <800ee040-7c2e-47d0-81e6-a352f5f689fb@amd.com> <73588525571a68f5638300ef171591de10ba5e5d.camel@linux.intel.com> <0595e4df-86d4-4082-86ab-b77902d3020b@amd.com> Content-Language: en-US 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: FR3P281CA0166.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a0::9) To PH7PR12MB5685.namprd12.prod.outlook.com (2603:10b6:510:13c::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PH7PR12MB5685:EE_|IA0PR12MB8713:EE_ X-MS-Office365-Filtering-Correlation-Id: 59175d5e-6797-4108-26dd-08dd13ba19e2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014; X-Microsoft-Antispam-Message-Info: =?utf-8?B?aHRGdXpiQ1NwajFnOU5QRDJaVVByaGpBVENBcnpHUWxQa2dSY3pPY01KMDEx?= =?utf-8?B?alNXVzBqa0dBUFNRN3Ny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.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PH7PR12MB5685.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(1800799024)(366016)(376014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?YjFKUFNyMkorT3ZIeVZaZlZORGRtQmxqM1RVdDhMd1IxbWlGcTk1QU1yQStY?= =?utf-8?B?TWI4Y2Zwc0J6ajd4SkJRZWh5NWFCMnNuanVQeUFSTzYvaHU3TzZRZUdKQ21x?= =?utf-8?B?bXlseWlhcngwL3pNNXhUQlFZUWRnTlQrN3JkM1VyS0FFcmNhODUyU1FJUVBH?= =?utf-8?B?cmtubjVhN2R5UTlyL3dldHd1MlluazFOUkE4ejJYdXY1T1d4TllObkVvOHVF?= =?utf-8?B?NzlPcURHYU1xTGU0ZFBUbE5hbldpWTIxWncyb2xCT3ZRZFRVU0crWUp5dlhv?= =?utf-8?B?M1g3bDdNcTRYVkZhdlMwUkJIaHphTTF6YzB5SmNsTU5NV2V1amhpVnBHNjZ3?= =?utf-8?B?NDZFZ1Z2NlhuZ0NwVjRlSWEzNFN3bkpIVk9CV0hrbU00WFpSeGVTdVVpOHBT?= =?utf-8?B?UmFCWm5hSGwxRDd6N0pyaVg1ekR3aGxidE9ITXp5WEhxWHYyQlJpcEZVZXBw?= =?utf-8?B?Nm1XK2VFQ3gvNkNjTzc5eVhrQm4xdkY0K0V3V1NlTG5kSWlCS2g4TnNzME15?= =?utf-8?B?Y3pZZVNQVkF3L2FIYmpKVUI5RVpGL0xuMENFeUsxZ0xIZnk4TXhSeVB3VkFZ?= =?utf-8?B?TmlzZlh0ZTdjUWp2TTlMNzFWWmNsblJhamtHUkRVYVViMnU4TjlNeGhISE9p?= =?utf-8?B?WWdXdjNaeWExT0FDZEl5R3piUncvQjV5T2s0Yk1XdUY1S1cwcXRsRXQxWmxv?= =?utf-8?B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Ky9jZUhUR09M?= =?utf-8?B?RTRXckZxcU55UWw4WlVBYUhlYkRTZE5VV0hjUjFkSER3M0ZSZGkzcVJic2RX?= =?utf-8?B?R3lUbUdOQjFnblhUNW95cVlFMkx4N3ZRNXpjWjNsU0FURFpFMWdMZGROTE8r?= =?utf-8?B?MmJYVnpOaTdxZVM3U1FlWkxPNms0b0ZsaGxmZjlOc0pNQVltYkZ1YjEvUEJn?= =?utf-8?B?MVNTSUkwTlRUQTJtL1lRZmlTYzRlTFZidWV0cWFpcjA1bFUrVUMvTXUyOStG?= =?utf-8?B?WW1XUFYxdE5UM2wxYlNFYWhCWjBjQjB1dnI4b0hkNHEvTEhoWElVekR3MjJ1?= =?utf-8?B?cm5YSXlKUnBoa1RRRk9UbWhDdmt1U2Eya2pqdWF0bzBsTG1iR0JNa1hsdzFI?= =?utf-8?B?SVUzdmtlOHYvUE51ZGFYK3NLM0ZWbG9DOEl0eVM1YTU4M1p6d20wOGdPdlJI?= =?utf-8?B?RW9hR2ZoaHgra1NySVYyZjF1dm5EZnA3M3FxK0Zlaytxa1NPdFpSNDVTWnZU?= =?utf-8?Q?Y5k6pkgl71d/XKXMdBTtzLMIq?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 59175d5e-6797-4108-26dd-08dd13ba19e2 X-MS-Exchange-CrossTenant-AuthSource: PH7PR12MB5685.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Dec 2024 16:46:57.6951 (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: F8tZpbYwY26MXxmU602BfTrvxTih2vCy5sI4WsHgPTVanDyMKLqn/wj3ea0yeooh X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA0PR12MB8713 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Am 03.12.24 um 17:43 schrieb Thomas Hellström: > On Tue, 2024-12-03 at 17:39 +0100, Christian König wrote: >> Am 03.12.24 um 17:31 schrieb Thomas Hellström: >>> On Tue, 2024-12-03 at 17:20 +0100, Christian König wrote: >>>> [SNIP] >>>>>>>>> @@ -453,9 +601,36 @@ int ttm_pool_alloc(struct ttm_pool >>>>>>>>> *pool, >>>>>>>>> struct ttm_tt *tt, >>>>>>>>>       else >>>>>>>>>       gfp_flags |= GFP_HIGHUSER; >>>>>>>>> >>>>>>>>> - for (order = min_t(unsigned int, >>>>>>>>> MAX_PAGE_ORDER, >>>>>>>>> __fls(num_pages)); >>>>>>>>> -      num_pages; >>>>>>>>> -      order = min_t(unsigned int, order, >>>>>>>>> __fls(num_pages))) >>>>>>>>> { >>>>>>>>> + order = min_t(unsigned int, MAX_PAGE_ORDER, >>>>>>>>> __fls(num_pages)); >>>>>>>>> + >>>>>>>>> + if (tt->page_flags & >>>>>>>>> TTM_TT_FLAG_PRIV_BACKED_UP) { >>>>>>>>> + if (!tt->restore) { >>>>>>>>> + gfp_t gfp = GFP_KERNEL | >>>>>>>>> __GFP_NOWARN; >>>>>>>>> + >>>>>>>>> + if (ctx->gfp_retry_mayfail) >>>>>>>>> + gfp |= >>>>>>>>> __GFP_RETRY_MAYFAIL; >>>>>>>>> + >>>>>>>>> + tt->restore = >>>>>>>>> + kvzalloc(struct_size(t >>>>>>>>> t- >>>>>>>>>> restore, >>>>>>>>> old_pages, >>>>>>>>> + >>>>>>>>> (size_t)1 >>>>>>>>> << >>>>>>>>> order), gfp); >>>>>>>>> + if (!tt->restore) >>>>>>>>> + return -ENOMEM; >>>>>>>>> + } else if (ttm_pool_restore_valid(tt- >>>>>>>>>> restore)) { >>>>>>>>> + struct ttm_pool_tt_restore >>>>>>>>> *restore = >>>>>>>>> tt- >>>>>>>>>> restore; >>>>>>>>> + >>>>>>>>> + num_pages -= restore- >>>>>>>>>> alloced_pages; >>>>>>>>> + order = min_t(unsigned int, >>>>>>>>> order, >>>>>>>>> __fls(num_pages)); >>>>>>>>> + pages += restore- >>>>>>>>>> alloced_pages; >>>>>>>>> + r = >>>>>>>>> ttm_pool_restore_tt(restore, >>>>>>>>> tt- >>>>>>>>>> backup, ctx); >>>>>>>>> + if (r) >>>>>>>>> + return r; >>>>>>>>> + caching = restore- >>>>>>>>>> caching_divide; >>>>>>>>> + } >>>>>>>>> + >>>>>>>>> + tt->restore->pool = pool; >>>>>>>>> + } >>>>>>>> Hui? Why is that part of the allocation function now? >>>>>>>> >>>>>>>> At bare minimum I would expect that this is a new >>>>>>>> function. >>>>>>> It's because we now have partially backed up tts, so the >>>>>>> restore is >>>>>>> interleaved on a per-page basis, replacing the backup >>>>>>> handles >>>>>>> with >>>>>>> page-pointers. I'll see if I can separate out at least the >>>>>>> initialization here. >>>>>> Yeah, that kind of makes sense. >>>>>> >>>>>> My expectation was just that we now have explicit >>>>>> ttm_pool_swapout() >>>>>> and >>>>>> ttm_pool_swapin() functions. >>>>> I fully understand, although in the allocation step, that would >>>>> also >>>>> increase the memory pressure since we might momentarily have >>>>> twice >>>>> the >>>>> bo-size allocated, if the shmem object was never swapped out, >>>>> and >>>>> we >>>>> don't want to unnecessarily risc OOM at recover time, although >>>>> that >>>>> should be a recoverable situation now. If the OOM receiver can >>>>> free >>>>> up >>>>> system memory resources they can could potentially restart the >>>>> recover. >>>> What I meant was more that we have ttm_pool_swapout() which does >>>> a >>>> mix >>>> of moving each page to a swap backend and freeing one by one. >>>> >>>> And ttm_pool_swapin() which allocates a bit of memory (usually >>>> one >>>> huge >>>> page) and then copies the content back in from the swap backend. >>>> >>>> Alternatively we could rename ttm_pool_alloc() into something >>>> like >>>> ttm_pool_populate() and ttm_pool_free() into >>>> ttm_pool_unpopulate(), >>>> but >>>> those names are not very descriptive either. >>>> >>>> It's just that we now do a bit more than just alloc and free in >>>> those >>>> functions, so the naming doesn't really match that well any more. >>> So what about ttm_pool_alloc() and ttm_pool_recover/swapin(), both >>> pointing to the same code, but _alloc() asserts that the tt isn't >>> backed up? >>> >>> That would give a clean interface at least. >> More or less ok. I would just put figuring out the gfp flags and the >> stuff inside the for (order... loop into separate functions. And then >> remove the if (tt->page_flags & TTM_TT_FLAG_PRIV_BACKED_UP) from the >> pool. >> >> In other words you trigger the back restore by calling a different >> function than the allocation one. > I'll take a look at this as well. Ah, and BTW: It's perfectly possible that ttm_tt_free() is called because a halve swapped TT is about to be destroyed! If I'm not completely mistaken that is not handled gracefully when we try to always backup from in the ttm_tt_free() function. So we clearly need the separation of move this TT to a backup (and eventually only partially) and freeing it. Christian. > > /Thomas > > >>> For a renaming change that touch all TTM drivers, I'd rather put >>> that >>> as a last patch since getting acks for that from all TTM driver >>> maintainers seems like a hopeless undertaking. >> Yeah the acks are not the problem, merging it through the xe tree >> would be. >> >> Christian. >> >> >>> /Thomas >>> >>> >>> >>> >>>> Christian. >>>> >>>>> /Thomas