From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9D93D2BE65B for ; Fri, 23 Jan 2026 16:33:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769186021; cv=none; b=CBFUYCwPTELUJ5jx1Fbin6zxIr2C2qL5GoyfVW6SBuut4USy2xbUxGormgwiKwcpMSg1RHCMyQmu7JJ4u+0qtboOIC+/Meg//MfXCA2Xvy/aRGMy0iHoAgFkIwi5t2kQbrI7WNdT9EqNVsSZlWjm5XE570WNugPACq4fkP/s0CY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769186021; c=relaxed/simple; bh=u7HdulTtxR3mc+kH/XbBXwmXNktSOLMZq3mIEDBJD7U=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=DjiAsuZjLkXZ082oY5c2V3M7tMOGVdjWKCgqPmbkqTv/molCq9laBKPJd9gsHilCRDw9flcsKjBfCOyHjLmdVlzx3MIwy9vfMEgGksaXswJ6PAGT7Kn8hAiUyLdKrcTubAlgRTpQyUdz+IXkSZ9q0YbdT2PFqHFjMHWfDZnLvBg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=iYVTjhRA; arc=none smtp.client-ip=209.85.128.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="iYVTjhRA" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-4801bc328easo27583625e9.3 for ; Fri, 23 Jan 2026 08:33:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1769186018; x=1769790818; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=rb7u39V+EWrAiLj+yjS6kM65VvsRc96IK2z8zgH3Va8=; b=iYVTjhRA1RTJzPEdwKRPEuaZnvjReLOYoILKEk+akPNuL1N9/ZaLXnQJsDkn5rxLbD YUPh6rZXi2BjuusHs8vK0R8kXh6hbAPzqwTDu78sdZblSj1SpGn0/KxMl9LPCZIgDTKC 0/yuDCfkL9GJYu1ZEBybgulCjABViaDBOKuWBi+o27g7gJgB+LrdNWZQNMpPMM3E3yYn ivnj3/SDMIVz2SR3H3pHi62AhasavBqkLtvNm9k1fydNzA4Z3D5HrGI0zfHNYxrxqQi3 HGNJJ69wbKt00cn4JbPvGiUhf9aUi7znTqrGKIZrZ1aNUnD9iuWdDzBKZ/Lze/7TH4sL EQRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769186018; x=1769790818; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=rb7u39V+EWrAiLj+yjS6kM65VvsRc96IK2z8zgH3Va8=; b=CQVsSsCv+f8hHseYkSuC26I97itcMlJuR7nbnPniLKz9QZSHR9MZhV730i5Qlm1qmS 8Uu/PtwUFwN9398icRE1WRhkOsJ2wdjkvvVvyhjUzKNszlizW2CNOL1Km6IgE9KoaOh6 0ROH+hB0rDjgcaBegauCpg7ZafayKd/vA4Ktjfo3dddMhBsNVUS8wgqiwr4svvDEQdoD 58ZtG0x9Mr5GaeRehWswpMs5CRaxceqDwihZOcc0N0cVWIlGKwvv/QxFhMFwQq5124ZB xsFN6OpRGQXlDHtmL562w0Mweee/qxvzJt1/VXp5IZEVceBWpSiupLXhkaen4NGwPBNd pYEw== X-Forwarded-Encrypted: i=1; AJvYcCW8NFT/qyrMwiULTjw46ZvMUFuvxeX1/7Xov/uiIwAfJd2RQqzYZ6TdDSaRWGN3i6ZfcCggAPIeAJx7aok=@vger.kernel.org X-Gm-Message-State: AOJu0Yw7jCdblZk8t+QyfE4SWC9o0PLuJvRqZ/JTIml7NqrTb1/u0ftn Uzm5/TzxwT9Sb10e9Z7qULZg/CkPsg117VRk+wK9q2B4TpDoUdPezbsqaxBqvHtT X-Gm-Gg: AZuq6aJ2F3WOhS/0Xo0/QG8KUsDyF1tMgK//cfmuCy0BMWQ1v0kZWYgMZ8UrHtYPf8R 3v9nNUIp1GKDhHkgHp8KCY2h+trGcmOTRI4if5aoZGnyppltst3zb103deQSvZm2fVG+jnT1HZ9 zDIEdiG5TE86Ymy/NsKv5blPYUa5/hDW3m7YnqczDsif7wjQo1ha9uX0pmLiH9Wm3nNJf47hRSn MW9fpZMl3QcFsYLWLH2TWiIoyD56Ggrc0aB+3XVP6sWzQmG8CU4X/veufGDpcLpg9b1o8QBQmSP rKuB+OHzoTwQ/wNSVaZgE2yuHCTyLdyEsoYVod/PHYp0ltHRLHqYAk16rnBZJJkSKS+tHwgwIGM LZEfh1BnzmSu10GojKByye0/bVXeinaKl05HXLz3GtstdTSe1AGyVtQaQ0OuRQtf1iOK/BbgPND 8jBsurP4Bi3lTqywFVu8rL+kNhKYWC0GeH26EyAHpX+b8OiM/n7mzWVfh4rA== X-Received: by 2002:a05:600c:1c1f:b0:47e:e5c5:f3a3 with SMTP id 5b1f17b1804b1-4804c9b24e5mr58013925e9.24.1769179492597; Fri, 23 Jan 2026 06:44:52 -0800 (PST) Received: from timur-hyperion.localnet (54001FF2.dsl.pool.telekom.hu. [84.0.31.242]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4804dbb6939sm23700435e9.5.2026.01.23.06.44.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jan 2026 06:44:52 -0800 (PST) From: Timur =?UTF-8?B?S3Jpc3TDs2Y=?= To: Hamza Mahfooz , dri-devel@lists.freedesktop.org, Christian =?UTF-8?B?S8O2bmln?= Cc: Alex Deucher , David Airlie , Simona Vetter , Harry Wentland , Leo Li , Rodrigo Siqueira , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Sunil Khatri , Ce Sun , Lijo Lazar , Kenneth Feng , Ivan Lipski , Alex Hung , Tom Chung , Melissa Wen , Michel =?UTF-8?B?RMOkbnplcg==?= , Fangzhi Zuo , amd-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, Harry Wentland , Mario Limonciello Subject: Re: [PATCH 1/2] drm: introduce page_flip_timeout() Date: Fri, 23 Jan 2026 15:44:50 +0100 Message-ID: <2349754.vFx2qVVIhK@timur-hyperion> In-Reply-To: <2de6d428-b997-4ba8-8766-a211e5612e72@amd.com> References: <20260123000537.2450496-1-someguy@effective-light.com> <2de6d428-b997-4ba8-8766-a211e5612e72@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" On Friday, January 23, 2026 2:52:44=E2=80=AFPM Central European Standard Ti= me=20 Christian K=C3=B6nig wrote: > On 1/23/26 01:05, Hamza Mahfooz wrote: > > There should be a mechanism for drivers to respond to flip_done > > time outs. >=20 I am adding Harry and Mario to this email as they are more familiar with th= is. > I can only see two reasons why you could run into a timeout: >=20 > 1. A dma_fence never signals. > How that should be handled is already well documented and doesn't=20 require > any of this. Page flip timeouts have nothing to do with fence timeouts. A page flip timeout can occur even when all fences of all job submissions=20 complete correctly and on time. >=20 > 2. A coding error in the vblank or page flip handler leading to waiting > forever. In that case calling back into the driver doesn't help either. At the moment, a page flip timeout will leave the whole system in a hung st= ate=20 and the driver does not even attempt to recover it in any way, it just stop= s=20 doing anything, which is unacceptable and I'm pretty surprised that it was= =20 left like that for so long. Note that we have approximately a hundred bug reports open on the drm/amd b= ug=20 tracker about "random" page flip timeouts. It affects a lot of users. >=20 > So as far as I can see the whole approach doesn't make any sense at all. Actually this approach was proposed as a solution at XDC 2025 in Harry's=20 presentation, "DRM calls driver callback to attempt recovery", see page 9 i= n=20 this slide deck: https://indico.freedesktop.org/event/10/contributions/431/attachments/ 267/355/2025%20XDC%20Hackfest%20Update%20v1.2.pdf If you disagree with Harry, please make a counter-proposal. Thanks, Timur >=20 > > Since, as it stands it is possible for the display > > to stall indefinitely, necessitating a hard reset. So, introduce > > a new crtc callback that is called by > > drm_atomic_helper_wait_for_flip_done() to give drivers a shot > > at recovering from page flip timeouts. > >=20 > > Signed-off-by: Hamza Mahfooz > > --- > >=20 > > drivers/gpu/drm/drm_atomic_helper.c | 6 +++++- > > include/drm/drm_crtc.h | 9 +++++++++ > > 2 files changed, 14 insertions(+), 1 deletion(-) > >=20 > > diff --git a/drivers/gpu/drm/drm_atomic_helper.c > > b/drivers/gpu/drm/drm_atomic_helper.c index 5840e9cc6f66..3a144c324b19 > > 100644 > > --- a/drivers/gpu/drm/drm_atomic_helper.c > > +++ b/drivers/gpu/drm/drm_atomic_helper.c > > @@ -1881,9 +1881,13 @@ void drm_atomic_helper_wait_for_flip_done(struct > > drm_device *dev,>=20 > > continue; > > =09 > > ret =3D wait_for_completion_timeout(&commit->flip_done, 10=20 * HZ); > >=20 > > - if (ret =3D=3D 0) > > + if (!ret) { > >=20 > > drm_err(dev, "[CRTC:%d:%s] flip_done timed=20 out\n", > > =09 > > crtc->base.id, crtc->name); > >=20 > > + > > + if (crtc->funcs->page_flip_timeout) > > + crtc->funcs- >page_flip_timeout(crtc); > > + } > >=20 > > } > > =09 > > if (state->fake_commit) > >=20 > > diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h > > index 66278ffeebd6..45dc5a76e915 100644 > > --- a/include/drm/drm_crtc.h > > +++ b/include/drm/drm_crtc.h > > @@ -609,6 +609,15 @@ struct drm_crtc_funcs { > >=20 > > uint32_t flags, uint32_t target, > > struct drm_modeset_acquire_ctx=20 *ctx); > >=20 > > + /** > > + * @page_flip_timeout: > > + * > > + * This optional hook is called if &drm_crtc_commit.flip_done times=20 out, > > + * and can be used by drivers to attempt to recover from a page=20 flip > > + * timeout. > > + */ > > + void (*page_flip_timeout)(struct drm_crtc *crtc); > > + > >=20 > > /** > > =09 > > * @set_property: > > *