From: Thomas Zimmermann <tzimmermann@suse.de>
To: sashiko-reviews@lists.linux.dev
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 06/10] drm/i915: Implement vga_switcheroo_client_ops.pre_switch
Date: Wed, 8 Jul 2026 09:39:15 +0200 [thread overview]
Message-ID: <3e174563-e2c3-4fca-8a7c-3adf548e01f6@suse.de> (raw)
In-Reply-To: <20260707141722.A6A0F1F00A3E@smtp.kernel.org>
Am 07.07.26 um 16:17 schrieb sashiko-bot@kernel.org:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [High] AB-BA deadlock between `vgasr_mutex` and `dev->clientlist_mutex` during VGA switcheroo and DRM client hotplug/registration.
> --
>
> --- Patch [6]: [PATCH 06/10] drm/i915: Implement vga_switcheroo_client_ops.pre_switch ---
> commit ca43d8e034e1ee27918b22e1b7a19b8f6a5b4a67
> Author: Thomas Zimmermann <tzimmermann@suse.de>
>
> drm/i915: Implement vga_switcheroo_client_ops.pre_switch
>
> This commit implements the pre_switch callback for vga_switcheroo in the
> i915 driver. It calls drm_client_dev_acquire_outputs() to push fbcon
> updates from vga_switcheroo into DRM's fbdev emulation.
>
>> diff --git a/drivers/gpu/drm/i915/i915_switcheroo.c b/drivers/gpu/drm/i915/i915_switcheroo.c
>> index 7e0791024282e..6b306ece0556a 100644
>> --- a/drivers/gpu/drm/i915/i915_switcheroo.c
>> +++ b/drivers/gpu/drm/i915/i915_switcheroo.c
> [ ... ]
>> @@ -58,10 +59,19 @@ static bool i915_switcheroo_can_switch(struct pci_dev *pdev)
>> atomic_read(&i915->drm.open_count) == 0;
>> }
>>
>> +static void i915_switcheroo_pre_switch(struct pci_dev *pdev)
>> +{
>> + struct drm_i915_private *i915 = pdev_to_i915(pdev);
>> +
>> + if (i915 && intel_display_device_present(i915->display))
>> + drm_client_dev_acquire_outputs(&i915->drm);
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> [Severity: High]
> Does this code introduce an AB-BA deadlock between vgasr_mutex and
> dev->clientlist_mutex?
>
> A GPU switch triggered via userspace will acquire vgasr_mutex and eventually
> call this pre_switch callback:
>
> vga_switcheroo_debugfs_write() [acquires vgasr_mutex]
> vga_switchto_stage2()
> i915_switcheroo_pre_switch()
> drm_client_dev_acquire_outputs() [acquires dev->clientlist_mutex]
>
> However, a DRM client hotplug event can acquire these locks in the reverse
> order:
>
> drm_client_dev_hotplug() [acquires dev->clientlist_mutex]
> drm_fbdev_client_hotplug()
> register_framebuffer()
> fbcon_fb_registered()
> do_fb_registered()
> vga_switcheroo_client_fb_set() [acquires vgasr_mutex]
>
> Could this lead to a system hang when a GPU switch races with a display
> hotplug event?
Patch 10 removes calls to vga_switcheroo_client_fb_set() entirely. I
could try to reorganize the series to avoid the vulnerable intermediate
states.
>
>> +}
>> +
>> static const struct vga_switcheroo_client_ops i915_switcheroo_ops = {
>> .set_gpu_state = i915_switcheroo_set_state,
>> .reprobe = NULL,
--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Jochen Jaser, Andrew McDonald, (HRB 36809, AG Nürnberg)
next prev parent reply other threads:[~2026-07-08 7:39 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 [this message]
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
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=3e174563-e2c3-4fca-8a7c-3adf548e01f6@suse.de \
--to=tzimmermann@suse.de \
--cc=dri-devel@lists.freedesktop.org \
--cc=sashiko-reviews@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.