From: Hillf Danton <hdanton@sina.com>
To: Ryosuke Yasuoka <ryasuoka@redhat.com>
Cc: Dmitry Osipenko <dmitry.osipenko@collabora.com>,
Dmitry Baryshkov <lumag@kernel.org>,
Javier Martinez Canillas <javierm@redhat.com>,
dri-devel@lists.freedesktop.org, virtualization@lists.linux.dev,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/virtio: defer hotplug event from dequeue worker to avoid deadlock
Date: Thu, 2 Jul 2026 07:43:00 +0800 [thread overview]
Message-ID: <20260701234301.361-1-hdanton@sina.com> (raw)
In-Reply-To: <18be2016e26ade27.a6e9e2496bc1f978.9bc3a62421115997@ryasuoka-thinkpadx1carbongen9.tokyo.csb>
On Wed, 1 Jul 2026 09:23:05 +0000 Ryosuke Yasuoka wrote:
>On 30/06/2026 16:46, Dmitry Osipenko wrote:
>> Could you please move drm_kms_helper_hotplug_event() to virtio_gpu_init(),
>> placing it after wait_event_timeout(display_info_pending)? This will avoid
>> additional work_struct that otherwise needs to be cancelled in
>> virtio_gpu_init() on the timeout.
>
>IIUC, moving the drm_kms_helper_hotplug_event() and _hpd_irq_event()
>into virtio_gpu_init() after wait_event_timeout() would not prevent the
>issue.
>
>Looking at the syzbot call traces[1][2], the deadlock occurs during
>drm_client_setup(), which runs after virtio_gpu_init() has already
>returned. The display_info_cb that triggers the deadlock is called from
>the dequeue worker while drm_client_register() holds clientlist_mutex.
>
>Thread A:
>virtio_gpu_probe()
> -> virtio_gpu_init() // sends GET_DISPLAY_INFO and waits up to 5s
> -> drm_dev_register()
> -> drm_client_setup() // deadlock happens HERE
> -> drm_client_register() // holds clientlist_mutex
> ...
> -> virtio_gpu_queue_fenced_ctrl_buffer()
> -> wait_event() // waits for free space
>
>Thread B:
>virtio_gpu_dequeue_ctrl_func()
> -> reclaim_vbufs() // make free space
I wonder if the deadlock could be cured by alternatively adding a wakeup
before the responce cb, given that free space is available.
> -> resp_cb()
> -> virtio_gpu_cmd_get_display_info_cb
> -> drm_helper_hpd_irq_event()
> -> drm_kms_helper_hotplug_event()
> -> drm_client_dev_hotplug() // need to lock clientlist_mutex
> -> wake_up() // never reached
>
>IIUC the hotplug notification in display_info_cb is needed because it
>notifies DRM after updating by the callback with fresh data from the host.
>
>This work_struct ensures display_info_cb never blocks on
>clientlist_mutex in the dequeue worker, while preserving the hotplug
>notification with fresh data.
>
>[1] https://syzkaller.appspot.com/bug?id=d6dd6f86d3aaf7eebe7406e45c1c6e549453f224
>[2] https://syzkaller.appspot.com/bug?id=908bd910da5dd79b88de4cf7baf376cc873a922e
>
>Best regards,
>Ryosuke
next prev parent reply other threads:[~2026-07-01 23:43 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-30 9:16 [PATCH] drm/virtio: defer hotplug event from dequeue worker to avoid deadlock Ryosuke Yasuoka
2026-06-30 9:36 ` sashiko-bot
2026-06-30 13:46 ` Dmitry Osipenko
2026-07-01 9:23 ` Ryosuke Yasuoka
2026-07-01 23:43 ` Hillf Danton [this message]
2026-07-02 7:12 ` Ryosuke Yasuoka
2026-07-02 8:25 ` Hillf Danton
2026-07-02 11:26 ` Dmitry Osipenko
2026-07-03 5:58 ` Ryosuke Yasuoka
2026-07-07 15:10 ` Dmitry Osipenko
2026-07-09 12:30 ` Ryosuke Yasuoka
2026-07-09 12:55 ` Dmitry Osipenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260701234301.361-1-hdanton@sina.com \
--to=hdanton@sina.com \
--cc=dmitry.osipenko@collabora.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=javierm@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lumag@kernel.org \
--cc=ryasuoka@redhat.com \
--cc=virtualization@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.