Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1AB78606A31A for ; Tue, 1 Dec 2026 05:32:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key, unprotected) header.d=amd.com header.i=@amd.com header.a=rsa-sha256 header.s=selector1 header.b=mfYPI0Tp Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A8EE910E1AB; Tue, 1 Dec 2026 05:32:16 +0000 (UTC) Received: from SN4PR2101CU001.outbound.protection.outlook.com (mail-southcentralusazon11012063.outbound.protection.outlook.com [40.93.195.63]) by gabe.freedesktop.org (Postfix) with ESMTPS id F1A0E89048 for ; Tue, 1 Dec 2026 05:32:09 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=LM4m6jKXc0fauLLFqkXb5hENLjdxf/dcXGELPkHQljDpvLpzQFbQgz7RyWForpCl6KXo/MI+DcMdJqVWvjFzS2l+UhRbWUJFdpVZcc1uHx6lqyELOAs9jFngdVa9xLP4shy7LhyBTtvQyHDRYRIGbWlSoEvFTlhGLGB6OU7XwY48P/JXleof8n9ZrEUWuReZYDIG3A6mVXPdWvKBeJncmjKGojnpDaOiRoqofYc4PT7Un6j8EKL5w82NqbwQ+rua/yWQULOsbAWlwo8NEgjQzxJ/wJQ9M/JPOPbK1oK4IOtkQ4Dv7YGjwDB0Gx1lqwwOL6ilvz1pFH+eOy+w2x4r1g== 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=+VJDkjqV9gOUqv7rUXWwzqx5+mmesCjz8snLQvQ4/QY=; b=jwrJT3q9ibpB+gkTJxn0SbBGCsB64jnnd+63lwNAvvHPElOGZCYVYEz/YDcdwDqriMa4+Qsz3uclZQhVPGPKfh2wSxqPpaiba8RzmgIF563XAMxHmhAEd9Y6R3zDSny1ea6OmfTDlhWriWpMF9fbrMFtzX1BrcjYOazSpB2ZwmIT5n43wVAWbsq86iIUGlZqgIhahGg7AcQmISogqkEpSE4AHJ6yyt0H2je04QDGR60VwRZwCKCjR8aD99veP75kGKH5vP57axNY06FUl5mQcCT8jfM+iJ5SYeEQcqnO/Ca/LuHcKhCDNT9IFz71psxfoLLg1S/xZdG+jLUMyY80RA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=lists.freedesktop.org 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=+VJDkjqV9gOUqv7rUXWwzqx5+mmesCjz8snLQvQ4/QY=; b=mfYPI0TpiuJLcGSkplZX+qCQ3BInOm0xA5bzd4v86pO/Ab9155h9XDoDKSFLtJdW/sePNzKnQFf+UyXEpaNe05Be+5Fkpn6jp6xxZxJ5E0LKh0h4PvKvdl9xmZLWJbSfjriWdbk+uP74k4qRVqM84cz3GoQEE8CdGtpEQq+0zz8= Received: from PH8P221CA0042.NAMP221.PROD.OUTLOOK.COM (2603:10b6:510:346::15) by SA1PR12MB7152.namprd12.prod.outlook.com (2603:10b6:806:2b2::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.662.13; Tue, 1 Dec 2026 05:32:04 +0000 Received: from SJ5PEPF000001EB.namprd05.prod.outlook.com (2603:10b6:510:346:cafe::7a) by PH8P221CA0042.outlook.office365.com (2603:10b6:510:346::15) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.688.10 via Frontend Transport; Tue, 1 Dec 2026 05:32:01 +0000 X-MS-Exchange-Authentication-Results: mx.microsoft.com 1; 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 SJ5PEPF000001EB.mail.protection.outlook.com (10.167.242.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.5 via Frontend Transport; Tue, 1 Dec 2026 05:32:01 +0000 Received: from satlexmb08.amd.com (10.181.42.217) 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.57; Mon, 30 Nov 2026 23:32:01 -0600 Received: from JesseDEV.amd.com (10.180.168.240) by satlexmb08.amd.com (10.181.42.217) with Microsoft SMTP Server id 15.2.2562.57 via Frontend Transport; Mon, 30 Nov 2026 23:31:59 -0600 From: Jesse Zhang To: CC: , Christian Koenig , Jesse Zhang Subject: [PATCH v2 00/11] drm/amdgpu: WAIT_EVENT notifications and lifetime updates Date: Tue, 1 Dec 2026 13:30:43 +0800 Message-ID: <20261201053159.2550315-1-Jesse.Zhang@amd.com> X-Mailer: git-send-email 2.50.1 X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ5PEPF000001EB:EE_|SA1PR12MB7152:EE_ X-MS-Office365-Filtering-Correlation-Id: 6e27c44c-82dd-4d0b-f812-08df4f6c6d15 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|23010399003|1800799024|376014|36860700016|18002099003|13003099007|10067099003|11063799006|56012099006|261102123227099003|261028144727099003|261021123027099003|261026121527099003|261022105027099003|261021121427099003|261026140227099003|261022075727099003|261009223027099003; X-Microsoft-Antispam-Message-Info: oW+gKQdn65qm9v/IiqSehlOUoDfRqhN6yPXxK+nSXfBV2pCkVAafX5tC3joYPsTv3TqmBQaiJf+P/UPB0IXk+WBdXdTu896a37wykDImX265Vgvv0qLMSqN0AtEGDE2/6EJsODSY9ESFHDLVBmUktTDwt/TcR68Mfi38uAeFb0YZJYJnd3Qtc2eui1Zzx8ssNckZHRWPSTyGmEGZAMF3DFtM7C7yuV5ZWucHS5h2o42hd0pgREY+SDZQzYZ3DwgXIiUSBpG8FODxVphl/zOZLvITbJZhvnz/D1Wjb+ccMxR5f+I51twBaRcWk5h9Iv+68rhLPvjftst8eFfIv/XGHartF5q0pjzc2rtC4CYTIi5VO5d9VPUyZWka9xwGOYkP8lKMtI3bWhp1tQs/aH+Qe7pZgqkUKotXNuXWCNFB0ora8+n+bWRWt4xA+NKe4UBqbRHDWQJyD8zabDjFcMLZSNudlHm5pd/LdgZO3N3vgzTMkjCQTNh7jQlZhYUxJ8OmhnyyMHzLtiB373YwnnHuTSgj/1z8v7wCW108AQnmB8/yC8CaxHY0qT7H9rowa01HjHfDan6l4X0S0KEGdJRHnkmS5aZ8V1OMEhEoW/6XzoFQqU20t4C4GkIKS8FkG0UtJKSJxQ5Z0QuGer1Djpy5ZA== 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)(82310400026)(23010399003)(1800799024)(376014)(36860700016)(18002099003)(13003099007)(10067099003)(11063799006)(56012099006)(261102123227099003)(261028144727099003)(261021123027099003)(261026121527099003)(261022105027099003)(261021121427099003)(261026140227099003)(261022075727099003)(261009223027099003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: I7QQGB67XHmty3EjZS4ktTV79JxwvYxaz4onrLPBFxDfpGejmSrv8IORr8V7UBUx+ulgk8r8Ha0xen6ZQh35AI6k19IfwrpxBKiTu/s2/Bx+mIEPGGrDQc0cHLflGtxKCsbjlTsPtYC6kFEraJtaj6o66FZ8t17JH8Efxe4wm2BCuXhi8szlZksRHxg2EL2S4wBwTvqLs1koojIiHVrOZrJxdBxdeQDijIpQYUYAYG5cAW4AHf2UM78xO8ZYlkIp46Aos39DonZACyqG7iRwbHO/64/JB6o5nEwjj8QGFcS7Ud36wnIdVSZwWcn3R/DNiSbrMzh0r0r7Vqk9d5NHptrLT4Y3sev949BT9Md8v4ttUyt9ZkLjYf+RoiljYabgE+gOqMb9W6d9t2VMrUmhpZGS3RYGDh/iz5Kxf2uDtFfMVNsp4Lhv9p1l5uNY0/es X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Dec 2026 05:32:01.4121 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6e27c44c-82dd-4d0b-f812-08df4f6c6d15 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: SJ5PEPF000001EB.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR12MB7152 X-BeenThere: amd-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion list for AMD gfx List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "amd-gfx" X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 AMDGPU currently provides EVENTFD notifications and WAIT_EVENT metadata retrieval for render-node clients. Previous work introduced the EVENTFD infrastructure, EVENTFD event producers, and WAIT_EVENT metadata retrieval support. References ========== EVENTFD infrastructure: https://patchwork.freedesktop.org/series/164618/ GPU event producers for EVENTFD notifications: https://patchwork.freedesktop.org/series/170501/ WAIT_EVENT metadata retrieval and consumption: https://patchwork.freedesktop.org/series/164813/ Queue-scoped USERQ_EOP and QUEUE_RESET WAIT_EVENT notifications are already integrated into the WAIT_EVENT framework. This series extends WAIT_EVENT support for additional event types and addresses several lifetime, teardown, and robustness issues discovered during development and testing. What this series adds ===================== This series adds: - Documentation for the EVENTFD and WAIT_EVENT interfaces. - GPU_RESET WAIT_EVENT notifications. - MEMORY_EXCEPTION EVENTFD notifications. - MEMORY_EXCEPTION WAIT_EVENT notifications, with the faulting address and the fault status in the record. - Support for process-scoped WAIT_EVENT records. What this series fixes ====================== This series also improves behavior during queue teardown, device unplug, PASID ownership cleanup, and DRM file shutdown. Specifically it: - Stops new notifications once queue cleanup begins. - Cancels WAIT_EVENT waits when a queue is removed. - Prevents PASID lookups from reaching event managers being destroyed. - Wakes blocked WAIT_EVENT callers during device unplug. - Ensures USERQ destructors complete before manager teardown. - Prevents unbounded WAIT_EVENT record growth and reports event loss. Records are bounded per event type and a loss is reported for the source of the dropped event, so the events of one type which nobody consumes cannot cost a DRM file the events of another type. Patch overview ============== 01. drm/amdgpu: Document render-node EVENTFD subscriptions Document EVENTFD subscriptions, event types, usage model, lifetime handling, and userspace examples. 02. drm/amdgpu: Stop queue notifications before event cleanup Prevent producers from creating new notifications after queue cleanup begins. 03. drm/amdgpu: Cancel WAIT_EVENT waits when a queue is removed Wake queue waiters and return -ENOENT when the target queue disappears. 04. drm/amdgpu: Support process-scoped WAIT_EVENT records Allow WAIT_EVENT records that are not associated with a USERQ. 05. drm/amdgpu: Record GPU_RESET WAIT_EVENT notifications Add WAIT_EVENT metadata delivery for GPU reset events. 06. drm/amdgpu: Signal MEMORY_EXCEPTION EVENTFD notifications Add EVENTFD notification delivery for memory exception events. 07. drm/amdgpu: Record MEMORY_EXCEPTION WAIT_EVENT notifications Add WAIT_EVENT metadata delivery for memory exception events, including the faulting address and the fault status. 08. drm/amdgpu: Clear PASID ownership before event manager teardown Prevent new PASID-based event lookups from reaching a closing file. 09. drm/amdgpu: Wake WAIT_EVENT callers on device unplug Wake blocked waiters and return -ENODEV after unplug. 10. drm/amdgpu: Wait for USERQ destructors on close Ensure queue destruction completes before manager teardown. 11. drm/amdgpu: Bound WAIT_EVENT records and report event loss Bound pending records per event type and report metadata loss per event source when records cannot be stored. Changes in v2 ============= - Patch 07: report the faulting address and the fault status in the MEMORY_EXCEPTION record; they were always returned as 0. (Jesse) - Patch 11: bound the pending records per event type and report a loss per event source (the queue for a queue-scoped event, the DRM file for a device-scoped one) instead of per DRM file, so unconsumed USERQ_EOP records no longer drop the records of other event types. The queues of a DRM file still share the limit of a queue-scoped event type. (Jesse) - No changes in the other patches. Testing ======= IGT amd_eventfd_wait_event on Navi48 (GFX 12.0) with compute, GFX and SDMA user queues: event producers (USERQ_EOP, QUEUE_RESET, GPU_RESET, MEMORY_EXCEPTION), sequence numbers, record limit and loss reporting, queue and DRM file teardown with subscriptions, pending records and blocked waiters, and stress runs up to 100000 events. Base ==== This series is based on: amd-unified-interface Thanks, Srinivasan Shanmugam (11): drm/amdgpu: Document render-node EVENTFD subscriptions drm/amdgpu: Stop queue notifications before event cleanup drm/amdgpu: Cancel WAIT_EVENT waits when a queue is removed drm/amdgpu: Support process-scoped WAIT_EVENT records drm/amdgpu: Record GPU_RESET WAIT_EVENT notifications drm/amdgpu: Signal MEMORY_EXCEPTION EVENTFD notifications drm/amdgpu: Record MEMORY_EXCEPTION WAIT_EVENT notifications drm/amdgpu: Clear PASID ownership before event manager teardown drm/amdgpu: Wake WAIT_EVENT callers on device unplug drm/amdgpu: Wait for USERQ destructors on close drm/amdgpu: Bound WAIT_EVENT records and report event loss Documentation/gpu/amdgpu/eventfd.rst | 134 ++++++++++++ Documentation/gpu/amdgpu/index.rst | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 15 +- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 + drivers/gpu/drm/amd/amdgpu/amdgpu_eventfd.c | 12 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ids.c | 8 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ids.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c | 3 + drivers/gpu/drm/amd/amdgpu/amdgpu_userq.c | 67 +++++- drivers/gpu/drm/amd/amdgpu/amdgpu_userq.h | 21 +- .../drm/amd/amdgpu/amdgpu_userq_internal.h | 2 + drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 6 + .../gpu/drm/amd/amdgpu/amdgpu_wait_event.c | 207 +++++++++++++++--- .../gpu/drm/amd/amdgpu/amdgpu_wait_event.h | 20 +- include/uapi/drm/amdgpu_drm.h | 48 +++- 15 files changed, 474 insertions(+), 73 deletions(-) create mode 100644 Documentation/gpu/amdgpu/eventfd.rst -- 2.50.1