From: sashiko-bot@kernel.org
To: "Thomas Zimmermann" <tzimmermann@suse.de>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 07/10] drm/nouveau: Implement vga_switcheroo_client_ops.pre_switch
Date: Tue, 07 Jul 2026 14:18:44 +0000 [thread overview]
Message-ID: <20260707141844.866F91F00A3D@smtp.kernel.org> (raw)
In-Reply-To: <20260707135724.247562-8-tzimmermann@suse.de>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
New issues:
- [High] New AB-BA deadlock introduced between vgasr_mutex and clientlist_mutex.
Pre-existing issues:
- [High] Preexisting AB-BA deadlock between vgasr_mutex and console_lock.
--
--- Patch [7]: [PATCH 07/10] drm/nouveau: Implement vga_switcheroo_client_ops.pre_switch ---
commit a0ca13a7165f71c977582a84acf58b2f2681a805
Author: Thomas Zimmermann <tzimmermann@suse.de>
drm/nouveau: Implement vga_switcheroo_client_ops.pre_switch
This patch implements the vga_switcheroo_client_ops.pre_switch callback in
the nouveau driver. It calls drm_client_dev_acquire_outputs() from the
pre_switch callback to push fbcon updates from vga_switcheroo into DRM's
fbdev emulation.
> diff --git a/drivers/gpu/drm/nouveau/nouveau_vga.c b/drivers/gpu/drm/nouveau/nouveau_vga.c
> index a6c375a241542..2d2d08be8fbe2 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_vga.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_vga.c
> @@ -76,11 +76,20 @@ nouveau_switcheroo_can_switch(struct pci_dev *pdev)
> return atomic_read(&drm->dev->open_count) == 0;
> }
>
> +static void
> +nouveau_switcheroo_pre_switch(struct pci_dev *pdev)
> +{
> + struct nouveau_drm *drm = pci_get_drvdata(pdev);
> +
> + drm_client_dev_acquire_outputs(drm->dev);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[Severity: High]
Does this introduce an AB-BA deadlock between vgasr_mutex and
clientlist_mutex?
When drm_client_dev_hotplug() is called, it acquires dev->clientlist_mutex
and eventually calls register_framebuffer(). This takes the console_lock()
and then calls vga_switcheroo_client_fb_set(), taking vgasr_mutex. This
establishes the lock order:
clientlist_mutex -> console_lock -> vgasr_mutex
However, vga_switcheroo_debugfs_write() acquires vgasr_mutex and calls
vga_switchto_stage2(), which invokes this new pre_switch callback.
Calling drm_client_dev_acquire_outputs() here attempts to acquire
dev->clientlist_mutex, establishing the reverse lock order:
vgasr_mutex -> clientlist_mutex
[Severity: High]
This is a pre-existing issue, but does this path also trigger a deadlock
between vgasr_mutex and console_lock?
When register_framebuffer() is called (e.g., during driver probe or
hotplug), it calls fbcon_fb_registered(), which acquires console_lock()
and then calls vga_switcheroo_client_fb_set(), taking vgasr_mutex.
Conversely, vga_switcheroo_debugfs_write() acquires vgasr_mutex and calls
vga_switchto_stage2(). This invokes pre_switch(), which leads to
drm_client_dev_acquire_outputs() and then fb_switch_outputs(), attempting
to acquire console_lock(). This creates an exact inversion:
vgasr_mutex -> console_lock
> +}
> +
> static const struct vga_switcheroo_client_ops
> nouveau_switcheroo_ops = {
> .set_gpu_state = nouveau_switcheroo_set_state,
> .reprobe = nouveau_switcheroo_reprobe,
> .can_switch = nouveau_switcheroo_can_switch,
> + .pre_switch = nouveau_switcheroo_pre_switch,
> };
>
> void
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260707135724.247562-1-tzimmermann@suse.de?part=7
next prev parent reply other threads:[~2026-07-07 14:18 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-07 13:38 [PATCH 00/10] vga_switcheroo, drm: Push fbcon handling into DRM clients Thomas Zimmermann
2026-07-07 13:38 ` Thomas Zimmermann
2026-07-07 13:38 ` [PATCH 01/10] drm/edid: Include <linux/fb.h> Thomas Zimmermann
2026-07-07 13:38 ` Thomas Zimmermann
2026-07-07 13:38 ` [PATCH 02/10] drm/client: Add acquire_outputs callback; implement for fbdev emulation Thomas Zimmermann
2026-07-07 13:38 ` Thomas Zimmermann
2026-07-07 13:38 ` [PATCH 03/10] vga_switcheroo: Add pre_switch callback to client ops Thomas Zimmermann
2026-07-07 13:38 ` Thomas Zimmermann
2026-07-07 14:12 ` sashiko-bot
2026-07-07 13:38 ` [PATCH 04/10] vga_switcheroo: Add post_switch " Thomas Zimmermann
2026-07-07 13:38 ` Thomas Zimmermann
2026-07-07 13:38 ` [PATCH 05/10] drm/amdgpu: Implement struct vga_switcheroo_client_ops.pre_switch Thomas Zimmermann
2026-07-07 13:38 ` Thomas Zimmermann
2026-07-07 14:22 ` sashiko-bot
2026-07-08 7:38 ` Thomas Zimmermann
2026-07-07 13:38 ` [PATCH 06/10] drm/i915: Implement vga_switcheroo_client_ops.pre_switch Thomas Zimmermann
2026-07-07 13:38 ` Thomas Zimmermann
2026-07-07 14:17 ` sashiko-bot
2026-07-08 7:39 ` Thomas Zimmermann
2026-07-07 13:38 ` [PATCH 07/10] drm/nouveau: " Thomas Zimmermann
2026-07-07 13:38 ` Thomas Zimmermann
2026-07-07 14:18 ` sashiko-bot [this message]
2026-07-08 7:41 ` Thomas Zimmermann
2026-07-07 13:38 ` [PATCH 08/10] drm/nouveau: Implement vga_switcheroo_client_ops.post_switch Thomas Zimmermann
2026-07-07 13:38 ` Thomas Zimmermann
2026-07-07 13:38 ` [PATCH 09/10] drm/radeon: Implement struct vga_switcheroo_client_ops.pre_switch Thomas Zimmermann
2026-07-07 13:38 ` Thomas Zimmermann
2026-07-07 13:38 ` [PATCH 10/10] vga-switcheroo: Remove unused interfaces Thomas Zimmermann
2026-07-07 13:38 ` Thomas Zimmermann
2026-07-07 15:46 ` ✓ i915.CI.BAT: success for vga_switcheroo, drm: Push fbcon handling into DRM clients Patchwork
2026-07-08 8:07 ` ✗ i915.CI.Full: failure " Patchwork
2026-07-08 21:56 ` [PATCH 00/10] " lyude
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=20260707141844.866F91F00A3D@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=tzimmermann@suse.de \
/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.