From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from CH5PR02CU005.outbound.protection.outlook.com (mail-northcentralusazon11012029.outbound.protection.outlook.com [40.107.200.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 79E8E78F29 for ; Fri, 10 Apr 2026 14:45:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.200.29 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775832334; cv=fail; b=iSf/qa1C46JqYvEMr9ScywPYp0jDHsKoYyseH/NJKQpuDvIDBjyW/oVu4GENQeW6RqsD/YaQvD87UNu1TlgP5U/oloqEtNm1g3PTpz5UJM7Lyp/kjg0YP2lPQz5SD2gPjq7BlgBJq+DqTbfsp64hu0GwOaFAl27lv6Dk0NaGhGY= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775832334; c=relaxed/simple; bh=fg/IktAzp0/fOS7c29WKE7FefiDh42sVnq4Yq0WsvOU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ZOT7/vbiWvKbdZvhLiZq19Y622N8uIvj5VG2W92zt64YJmIVfPqEpRVrMtaYnRT8B+V1j1QH/BOoWIZXGOGuGP/dtnivfrgIwdHE17gkw6KHYYpOutM3GalCR+H8nA+VeNl8k+DM6VJfDELcuJoDhuRh9XJ/zNb0PM47ZS8zWkE= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=FyvMFLqB; arc=fail smtp.client-ip=40.107.200.29 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="FyvMFLqB" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Tusewwf2uFz62wdePHKIFoVVdz36AJG10ofqhPfCnrlFtk+xxZVNEqCmn7dU0ndk3i+Sa29Pgh2bjKxYur5sT4dhrZXj2GiJxJPeVPmpi/W52jMar8s6G+4UDRSAFgudMal6OmAaif5oPq7/+C7t0R2SQ3nlXk05jdau9Ri9V+zmcy1qC+zjvOCjMqFleTg38EA5dG4aKDPPBn8Dequ1jkhTm623aO19Yw2fNot+od8FSXJmcXkS18Ea06Y6WRTqcTwR1k3GXBQ6vpIJYQTDpC6yOmZKeMEkoyIpcf4Ih4fKVfHcG3Bj/frPifnmKWoGcCJzqMj33am23u6GiiXqzg== 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=H7LPqV7YViOKZ/VA210/KFlDSXyMlkLUg6Rg5mJMgSs=; b=LoYONr55G6OdYaMqJMqKkWucgNpcQJjS9C6IkvZKZvlMDu7OgXsDFts8gnYp1fJOhHE6xdtq0QFrmJjBFjUy/tJXfe0A4vG2t70n0XQ+5xPu1outNkIZ+UoBXVsNEcyXQ+0ba9yleNxKKYgWjL0IR1Hxet5YiPzFvK9otDMFHz6PtJj8f4YTdWOhPHulUBWb80VO0iTRAcix5DNIYwVcaAzrOvAbB1kP3Wflf5t5UZ/au3AHCoS1x6H+/hCcBK5xVJ+udRgP1UVD/5jIcCz4Y8P8ow5kABBh4AsG3XjKA6EQeILyjPLazvD7ujQ7Tnq0HVPTulrtwUgJ48z1y3LULg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.linux.dev smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) 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=H7LPqV7YViOKZ/VA210/KFlDSXyMlkLUg6Rg5mJMgSs=; b=FyvMFLqBablcDuA8PnCCneRXc8tJNgja3npWkwwUM7Pd/fonhXfHm3+74zDjT1KojaB4kw3f/MZzuzYGPoxjau9kwsDR/sTxn333hgPToi7DQCCraAwZJhTcG8cZBHJ53exc/+prhPXroDhDG2rZE7rVr9nQNsOrm+f24xMuD38= Received: from BN0PR04CA0031.namprd04.prod.outlook.com (2603:10b6:408:e8::6) by SJ2PR12MB7821.namprd12.prod.outlook.com (2603:10b6:a03:4d2::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9791.32; Fri, 10 Apr 2026 14:45:27 +0000 Received: from BN2PEPF00004FBD.namprd04.prod.outlook.com (2603:10b6:408:e8:cafe::2f) by BN0PR04CA0031.outlook.office365.com (2603:10b6:408:e8::6) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.20.9769.43 via Frontend Transport; Fri, 10 Apr 2026 14:45:27 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C Received: from satlexmb07.amd.com (165.204.84.17) by BN2PEPF00004FBD.mail.protection.outlook.com (10.167.243.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9769.17 via Frontend Transport; Fri, 10 Apr 2026 14:45:27 +0000 Received: from fdavid-dev.amd.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.17; Fri, 10 Apr 2026 09:45:26 -0500 From: David Francis To: CC: , David Francis Subject: [PATCH 3/3] plugins/amdgpu: Make next_fd without kfd Date: Fri, 10 Apr 2026 10:45:09 -0400 Message-ID: <20260410144509.738903-4-David.Francis@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260410144509.738903-1-David.Francis@amd.com> References: <20260410144509.738903-1-David.Francis@amd.com> Precedence: bulk X-Mailing-List: criu@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: satlexmb07.amd.com (10.181.42.216) To satlexmb07.amd.com (10.181.42.216) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN2PEPF00004FBD:EE_|SJ2PR12MB7821:EE_ X-MS-Office365-Filtering-Correlation-Id: 840a9961-62ae-4aad-518f-08de970fce27 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|82310400026|376014|36860700016|22082099003|18002099003|56012099003; X-Microsoft-Antispam-Message-Info: +DmCmETVUcllxiXCUGzO+myIe1r2ll3J0zMQft9P4ss0g0QWux2MT03PF9PjU5tZKkjFo4dR1LHufs8RzRh52otuSw1dbcYPu0g/97XX54TnX4Kubfxgto3p4SeUU0NAG9Ypg6ayDAdIGIjGOVnSrCiV/FFnVXtR2XN3GrNlAHAYlmNhM5oL860wo917cBoEtxr3rcUY9PaF8PQXQ0m/HtSiSTluoownQ0T2aizRZwrcC0ibWQa2L7vc2gk/AqDKRe9/2//jMGMm1jfdoMJR0qGnIAIKhIHEgR5Onh2Wc7vmNeyZ26Vw9YJRBWavnlzdZGY5LbmfZLuWZ9J5352ZZKUFhA321R91rv5LezVb/1rGd1pYfJ4UgKa2uJOToa/P0CBmdWVKKUqA4mj8qyDkasyHmHTMeXFcTcdAje6uS7rtX/xxtS9X1CdK0aINvggWWv/S0bCJmQJDMGcfvahJf7SMp5seYnJkP4IY4Yp3R548AuUizxuOluJW+5Na7EluO7kkFRnq5sfSUlKBIti87aQvErLXxQk8Rly0lj59RGo6IC/GZcqfG7jwRj3y6ASO973KsM6hZ/0b89uS3GJSTvW098sdzQxs5zkw8kTw+LBXE1CzLxcJ0QxrbzfZbtkpeIqrezlkqSyB2chGKzvnY0UGbXLlEfB8goFV7VsEhayZp8z3IROjyq1RY/uQeKCNMYBa9fzePSPGAK/ep/5l4ElYOC32XYqX+Z5yWug2MhjmSMeFmNXp9/vt16EkRu83oLBbQBWMTMV2FxmKcUO+gQ== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(82310400026)(376014)(36860700016)(22082099003)(18002099003)(56012099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 4XO7ZZ+FX6eTF3+rHYAG+bD4DufPGcJgVpCTAAhVvVg7UTDJCa6wsStUZFj/EgQyrpbeFSaYdb9reFmAOzVO67qwYXAo+14rmYsGdVzBKelbv+cQocGDVOjd+csw+uZk/+osQSsKowjcacUEqDc7AyYBpQJ2Gcq21T74FMxgLZYuH3ztIQXoJDjeAT0/7MQQPeXUVCgXAysxEOdXm6JxC45Qx/DV88WPPhWXt/hx28QRkHFvtqB0SGheHYvzt0XhmROA8dS808xSDC6Ky5mztfkpwZRI6TejG0CGFAg6K5ZZukoM2eIyl/j60vMm2o9AW3Oy9O7G7/gnBPCNfIl0hWRwuZzhZCzotN1fNmWlzLIJMJ9JFUFLAdAd71KAhAHlrMnPZT96ChmoR+LyQMWNRb6p1rvh17Y6yvU848yPDPOkP5Opmmn1srAtPoSNkZ3y X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Apr 2026 14:45:27.1748 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 840a9961-62ae-4aad-518f-08de970fce27 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN2PEPF00004FBD.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB7821 The amdgpu plugin needs to know what high fds are safe to use to store drm fds during the restore process. This is kept in next_fd, which is set as part of kfd restore. If there's no kfd restore, set next_fd anyways. Use the current pid as the pid to check; by this point in the restore the pid has been changed to the correct value. Signed-off-by: David Francis --- plugins/amdgpu/amdgpu_plugin.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/plugins/amdgpu/amdgpu_plugin.c b/plugins/amdgpu/amdgpu_plugin.c index 1e9785440..5dcf80363 100644 --- a/plugins/amdgpu/amdgpu_plugin.c +++ b/plugins/amdgpu/amdgpu_plugin.c @@ -1926,6 +1926,17 @@ int amdgpu_plugin_restore_file(int id, bool *retry_needed) pr_info("render node gpu_id = 0x%04x\n", rd->gpu_id); + if (fd_next == -1) { + current_pid = getpid(); + fd_next = find_unused_fd_pid(getpid()); + if (fd_next <= 0) { + pr_err("Failed to find unused fd (fd:%d)\n", fd_next); + ret = -EINVAL; + goto exit; + } + pr_info("High fd for pid %d set to %d\n", current_pid, fd_next); + } + if (list_empty(&restore_maps.cpu_maps) && list_empty(&restore_maps.gpu_maps)) { AmdgpuDevinfo *ad; -- 2.34.1