From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from r3-18.sinamail.sina.com.cn (r3-18.sinamail.sina.com.cn [202.108.3.18]) (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 CB5C83C4B9A for ; Wed, 1 Jul 2026 23:43:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=202.108.3.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782949440; cv=none; b=i2/MwCwHVRZCwEfAJiyX0vAYDuTnzmAOpdpoEbyFb2KIKomLtQ1G9qXsihUFjDXhiwIr4aU7kGMtHGqKEV8hi1/1qmw7e+HRayqbaUQrXHnmEXFtyIMMCJFuzYbxElnQQaDcAnj2luPBnMDpeITF64UoeC5bD87WD0tMxyyKsXI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782949440; c=relaxed/simple; bh=yCY1ZQ4+Oy4DwpOkJs5s9wVPlWFSgUreezLQhSyNDb4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pW5+PBjb0vYRhpfg1DFVPhORwpmZz7ihvuUUgn6bNnAvcs/dCw9MX4Tamp5eNS2B4twjR2WAicTHR7Skx3ZvTmcPbM1r+te52pUVFF0AJxEdOsQo21CSur2eA2+uZ2BF35NT7AFXf86CdsY2qOqFZtlIiGq4nVYUtXBpSUCtpOI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sina.com; spf=pass smtp.mailfrom=sina.com; dkim=pass (1024-bit key) header.d=sina.com header.i=@sina.com header.b=f3iizZfp; arc=none smtp.client-ip=202.108.3.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sina.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sina.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=sina.com header.i=@sina.com header.b="f3iizZfp" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sina.com; s=201208; t=1782949436; bh=xQ23ltzGIx0al3TzodxktcL0AEOqsC47kRrB7dugiMI=; h=From:Subject:Date:Message-ID; b=f3iizZfpUsF5MVyxlv8RZiX1D5kzXXNbBiPSQWUaO7cDhvuUiZkroBX/RpzjJXLQL ePl1H+oIiyDVcXVbXnenriwHGpcURz4Uic5kHU3A1nIix1l1OeCMXV/Gdo2AmuBhSN 4aQ9FI/pwj60C4PvaCgFxPJ+ubQA5ByJHOROJeP0= X-SMAIL-HELO: localhost.localdomain Received: from unknown (HELO localhost.localdomain)([114.249.62.144]) by sina.com (10.54.253.32) with ESMTP id 6A45A60F00003880; Wed, 2 Jul 2026 07:43:14 +0800 (CST) X-Sender: hdanton@sina.com X-Auth-ID: hdanton@sina.com Authentication-Results: sina.com; spf=none smtp.mailfrom=hdanton@sina.com; dkim=none header.i=none; dmarc=none action=none header.from=hdanton@sina.com X-SMAIL-MID: 6550824456920 X-SMAIL-UIID: DBFA2DA1DDDE481C94AB2F6835CD65D8-20260702-074314-1 From: Hillf Danton To: Ryosuke Yasuoka Cc: Dmitry Osipenko , Dmitry Baryshkov , Javier Martinez Canillas , 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 Message-ID: <20260701234301.361-1-hdanton@sina.com> In-Reply-To: <18be2016e26ade27.a6e9e2496bc1f978.9bc3a62421115997@ryasuoka-thinkpadx1carbongen9.tokyo.csb> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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