From mboxrd@z Thu Jan 1 00:00:00 1970 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 B8A5F606A322 for ; Thu, 3 Dec 2026 01:14:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=L3gzG8Bx Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 23B1D1126F3; Thu, 3 Dec 2026 01:14:08 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) by gabe.freedesktop.org (Postfix) with ESMTPS id 82CDE1126F2; Thu, 3 Dec 2026 01:13:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796260437; x=1827796437; h=date:from:to:cc:subject:message-id:references: content-transfer-encoding:in-reply-to:mime-version; bh=gTADvrTbTQJML8c53vIWsOGzMW1OiChMwoLtjWNxxto=; b=L3gzG8BxN0hUds9uiwGZe2HuWKSoFsg0/J4M/d29I08fiCsqrogRhEo1 K23+Vc+9GKnoQv9gA54qMeHd8aCvsas71z0gbIxNFFHNVHfCe4nCvObFJ zNS65eYe6Nn/1Wv/cQNjHGW0iw7iGLu6JbR+pebgKlgnv35h5fE3Eidq3 aO/PqDr9mwbuLXUl9nRKTIVy0ccqtzclF6o2mg2lX73O8ENcZfXUmHc70 mgVJJFIjHNvEgwPPyuPuwwzZx/j04OmhCbAldcP1v/PnRjp206P5bXP4g N3i3Ovj3WfUvGzicG50t3hfyuyM387NmZ6uTY8y9SB8YDy9RmKxm0CvIT w==; X-CSE-ConnectionGUID: ugt9HzukRP25UG1ERILrvw== X-CSE-MsgGUID: u/EA/06xQ/OEQsYDmHb77Q== X-IronPort-AV: E=McAfee;i="6800,10657,11984"; a="5250014" X-IronPort-AV: E=Sophos;i="6.27,247,1787036400"; d="scan'208";a="5250014" Received: from orviesa006.jf.intel.com ([10.64.159.146]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Dec 2026 17:13:56 -0800 X-CSE-ConnectionGUID: 9aolCX6fRcykATeVmBqWEA== X-CSE-MsgGUID: CP03IHWkQqSan2oWxHKxjA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,247,1787036400"; d="scan'208";a="13607769" Received: from fmsmsx903.amr.corp.intel.com ([10.18.126.92]) by orviesa006.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Dec 2026 17:13:56 -0800 Received: from FMSMSX902.amr.corp.intel.com (10.18.126.91) by fmsmsx903.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Wed, 2 Dec 2026 17:13:55 -0800 Received: from fmsedg902.ED.cps.intel.com (10.1.192.144) by FMSMSX902.amr.corp.intel.com (10.18.126.91) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57 via Frontend Transport; Wed, 2 Dec 2026 17:13:55 -0800 Received: from SA9PR02CU001.outbound.protection.outlook.com (40.93.196.33) by edgegateway.intel.com (192.55.55.82) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.57; Wed, 2 Dec 2026 17:13:54 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=m5dVjcTvSMVwjZFj5JFRt6CbhRwAeXHis88WuJ859F+Y/C/M38WyUtL4nwYp0J6NWKrV4uCU+lzKO1GjxCNSRjZLsM0gSm0RPw0DGaoVeWTGR41lHPSSNGtU34a1Rp7ALWPSxVPtgX+fayAUlfJHEJJALaXleCnWd565sX1h1rGS/nbnKvD7h3AlHDosIF9ydiElkB/xJ2AHb1Z9e5W51dZaw4zfXOgTzsyULEZd9JTrz2N9R3n0ZXnhkwzi5GRC2jZDhEcNh/9JqsuIGQbMJMhcBsHca+RiqBtvrkNVzQe93urKldsK7CgymXm7CWDmFuLEJdU9YmRao9Id3lq7CQ== 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=n8blDjQODF5NVux5AeBOKbfk1jBVZ2S+Zfa1u0FTrKc=; b=HsDqNiJmvfGQJiCYOYoQg1tSjDehCqlltaieWPSdxbvciLnA7vPEWs/axRspvk9l83iNUke7yGQamDv6HuHaKvcMxkwMRIq02rU2pHseLvQ0JPY5vKuU7/hKY940/vShD+FLolqz/H0xBLFhhXyRE9R5+cR0KUpQuO7RmsCfu7xE9FFCP/S6FsOkMiK2xURL81QYsSei6KyZWU26LgWImtC+XYAFUCHKFeZul8WYIeGGpX54vLEovWDVbhfRLre6X7zi4c9nlQxQF+fFZm/J+dkp9onfWxnPPrCPogdVV/vZvE/t+gFuDjrgfI0e//VJyDeDqOAEmWvcGYlshrJCiw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: mx.microsoft.com 1; dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from CO1PR11MB4787.namprd11.prod.outlook.com (2603:10b6:303:95::23) by LV3PR11MB8529.namprd11.prod.outlook.com (2603:10b6:408:1b3::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.688.10; Thu, 3 Dec 2026 01:13:51 +0000 Received: from CO1PR11MB4787.namprd11.prod.outlook.com ([fe80::e7eb:a872:53d1:21fd]) by CO1PR11MB4787.namprd11.prod.outlook.com ([fe80::e7eb:a872:53d1:21fd%4]) with mapi id 15.21.0688.010; Thu, 3 Dec 2026 01:13:51 +0000 Date: Wed, 2 Dec 2026 17:13:48 -0800 From: Matthew Brost To: CC: , Subject: Re: [PATCH v5 27/36] drm/xe/display: Flush cleanup work on unregister Message-ID: References: <20261202233323.3743190-1-matthew.brost@intel.com> <20261202233323.3743190-28-matthew.brost@intel.com> Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-ClientProxiedBy: BY5PR16CA0006.namprd16.prod.outlook.com (2603:10b6:a03:1a0::47) To CO1PR11MB4787.namprd11.prod.outlook.com (2603:10b6:303:95::23) X-Archived-By: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PR11MB4787:EE_|LV3PR11MB8529:EE_ X-MS-Office365-Filtering-Correlation-Id: 386b045e-6c34-452a-7324-08df50dab0f4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|23010399003|366016|376014|1800799024|11063799006|4143699003|261009223027099003|22082099003|18002099003|261022105027099003|10067099003|56012099006|261026121527099003|261102123227099003|261021121427099003|261026140227099003|261028144727099003; X-Microsoft-Antispam-Message-Info: 3n8icXjXmBp8i8iijgUfGIQ3vQ0QDQuABP+dYbmxUAcygxt0+bnx+LLm9/jpHCKo4J3QVRq9YvquLI3JI+qKEXchTh9JWLRBx6fzUamcAjJDQBDO+YSGL6JROvQc/+tDufsdwzWP/9sIxGXgiNmkfe6DrxZDf9oUh+LYFC2PP5W/55Dlc/iyH1VR3YrX+5rPvqzqnbZw1o3FTUglembZ7LxLqcbA0uiG9+tt84VtwKlOxiwe1969fpwEASOgA8sZBl0jFfzLd3o8O+h91xqN/y7q0pyWlmMs+Pkm3EQ8qudbLOfRgb3EndAc93jAHQidtrQuCzWPRhQlufs+N4wV4dteuvgOQ4xdtr+nvGlhTEgcoV74WiE9OsoX31cuCU2qPusV/xSYvwmwho31ApaaUpLCcPmvlbrG83MRZ4p0zjhXb2YZpjeUtXYsSMvlaMmrFcxSsxPn2re43/FWIqhZ5vCVWrA/kaE6EPMCSvpzufOT/d/xH+5Vur9ChuesQzMgeuYuimaj7NYL7gleg+tN8pgQiiyXAEDKlbmVpNde9Fhm7+wXr6khoQRyapRSSi2jY/Esn/VWi1sSelF8OhSGvzNiIihqadd8Uh6oC1J6Tmo= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CO1PR11MB4787.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(23010399003)(366016)(376014)(1800799024)(11063799006)(4143699003)(261009223027099003)(22082099003)(18002099003)(261022105027099003)(10067099003)(56012099006)(261026121527099003)(261102123227099003)(261021121427099003)(261026140227099003)(261028144727099003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?iso-8859-1?Q?ecY9+kWmC+8XJqTvsKQkz8ygxV9ZNyObers0TgqUSxICZMNc0dGnGDMoVo?= =?iso-8859-1?Q?wCjaQchAoleZ5oh88xCtdrwWtaDqrDz+2OcpaIr/KXTLRXEbx0+kjVdGLM?= =?iso-8859-1?Q?IassVRjVGGUJvwen/8N2RJzr4DHaLSF+IiZmTwCvw22xHnyul3Y2XvoI/Q?= =?iso-8859-1?Q?qp8RdhKCDkjZAs2xdTgGcOdnAVegiJ4pa4xHrH5B7BVJkZ0+Bm7Z57YaAb?= =?iso-8859-1?Q?TK6KOGMsFPLLa+1Umttf5lodmRU+i9ANHy2ujR8j+ZetsEZM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Zhhsqbnxf8LHdwnI5C4lF9RqADPj8zntesr0xD/wq/i8hpXJWVlJ2nnhRnGjqIXCVHJQKBRSgfee5qMuAf3Ks4oEJ1AKyMjutg+yg== X-MS-Exchange-CrossTenant-Network-Message-Id: 386b045e-6c34-452a-7324-08df50dab0f4 X-MS-Exchange-CrossTenant-AuthSource: CO1PR11MB4787.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 Dec 2026 01:13:51.3338 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: nCzPgJvyA27t78UpZv3TOCsNi5rJ2nxhVpS41RFCG38MtTZXnHNFXAQjQ84gHD9EWAuWAbqoFRooaRIoB9U9TQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV3PR11MB8529 X-OriginatorOrg: intel.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "dri-devel" X-Spam-Status: No, score=-10.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 autolearn=unavailable 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 On Wed, Dec 02, 2026 at 11:58:54PM +0000, sashiko-bot@kernel.org wrote: > Thank you for your contribution! Sashiko AI review found 1 potential > issue to consider: > - [Medium] drm/xe/display: incomplete cleanup flush in > xe_display_unregister() > -- > I don't know when about display, so I'm going to drop this one live with any preexiting related issues Sashiko flags. Matt > commit 6c15425fef0fac1bcda715813c673a4c85d77163 > Author: Matthew Brost > > drm/xe/display: Flush cleanup work on unregister > > This commit flushes display atomic cleanup work in xe_display_unregister() > so that scanout framebuffers are unpinned before xe_bo_pci_dev_remove_all() > evicts all buffer objects on device removal. > > > diff --git a/drivers/gpu/drm/xe/display/xe_display.c b/drivers/gpu/drm/xe/display/xe_display.c > > index b1a6008bf15c6..68d29d78dc8b2 100644 > > --- a/drivers/gpu/drm/xe/display/xe_display.c > > +++ b/drivers/gpu/drm/xe/display/xe_display.c > > @@ -155,6 +155,14 @@ void xe_display_unregister(struct xe_device *xe) > > > > intel_display_driver_runtime_pm_disable(display); > > intel_display_driver_unregister(display); > > + > > + /* > > + * The shutdown commit unpins the framebuffers from the asynchronous > > + * cleanup work. Flush it so they are unpinned, and thus visible to > > + * the eviction in xe_bo_pci_dev_remove_all(), before the device > > + * is removed. > > + */ > > + intel_display_flush_cleanup_work(display); > > } > > [Severity: Medium] > Can intel_display_flush_cleanup_work() return while an earlier commit on > the same CRTC is still unpinning its old scanout framebuffer? > > intel_display_flush_cleanup_work() only waits on the first (newest) entry > of crtc->base.commit_list: > > drivers/gpu/drm/i915/display/intel_display.c:intel_display_flush_cleanup_work() { > ... > spin_lock(&crtc->base.commit_lock); > commit = list_first_entry_or_null(&crtc->base.commit_list, > struct drm_crtc_commit, commit_entry); > if (commit) > drm_crtc_commit_get(commit); > spin_unlock(&crtc->base.commit_lock); > > if (commit) { > wait_for_completion(&commit->cleanup_done); > drm_crtc_commit_put(commit); > } > ... > } > > When drm_atomic_helper_shutdown() submits the shutdown commit (commit 2), > stall_checks() only waits for cleanup_done of the second previous commit > (i == 1), and drm_atomic_helper_wait_for_dependencies() only waits for > hw_done and flip_done of the immediately preceding commit (commit 1, e.g. > from drm_client_dev_unregister() tearing down fbdev or a prior flip). > drm_atomic_helper_swap_state() prepends commit 2 to the head of > crtc->commit_list ahead of commit 1. > > Because display->wq.cleanup is allocated with WQ_HIGHPRI | WQ_PERCPU and > max_active = 0 (unordered), commit 1 and commit 2 can run > intel_atomic_cleanup_work() concurrently: > > kworker (commit 1) CPU0 (unregister / commit 2) > ------------------ ---------------------------- > intel_atomic_cleanup_work() > intel_atomic_cleanup_planes() > __xe_unpin_fb_vma() > ... > drm_atomic_helper_shutdown() > ... > queue_work(wq.cleanup, > &commit2->cleanup_work) > [commit 2 cleanup_work runs and > signals commit2->cleanup_done] > intel_display_flush_cleanup_work() > wait_for_completion( > &commit2->cleanup_done) > xe_bo_pci_dev_remove_all() > <-- commit 1's old fb BO is still > pinned and missed by eviction > > If commit 2 finishes cleanup_done first while commit 1 is still in > intel_atomic_cleanup_work(), intel_display_flush_cleanup_work() returns > before commit 1 unpins its old scanout BO. That BO stays pinned past > xe_bo_pci_dev_remove_all() and hits the NULL IOMMU group dereference on > final release after PCI device removal. > > Flushing display->wq.cleanup (or waiting for cleanup_done across all > commits on crtc->base.commit_list) would ensure all in-flight plane > cleanups have finished. > > -- > Sashiko AI review · https://sashiko.dev/#/patchset/20261202233323.3743190-1-matthew.brost@intel.com?part=27