All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Thomas Zimmermann" <tzimmermann@suse.de>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH 03/10] vga_switcheroo: Add pre_switch callback to client ops
Date: Tue, 07 Jul 2026 14:12:47 +0000	[thread overview]
Message-ID: <20260707141247.8C3351F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260707135724.247562-4-tzimmermann@suse.de>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:

New issues:
- [Low] Duplicate and conflicting kernel-doc entry for `@gpu_bound` instead of `@pre_switch`.

Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but if the hardware mux switch fails, the active client is permanently marked as inactive, breaking the vga_switcheroo state machine.
--

--- Patch [3]: [PATCH 03/10] vga_switcheroo: Add pre_switch callback to client ops ---
commit 5537cd5fab2c2375821fd4433e71171511ada8ff
Author: Thomas Zimmermann <tzimmermann@suse.de>

vga_switcheroo: Add pre_switch callback to client ops

This commit adds a pre_switch callback to vga_switcheroo_client_ops to
inform clients about upcoming output switches, replacing the hard-coded
fb_switch_outputs() call.

> diff --git a/drivers/gpu/vga/vga_switcheroo.c b/drivers/gpu/vga/vga_switcheroo.c
> index 22cf52b78b755..bdf1e56ae8910 100644
> --- a/drivers/gpu/vga/vga_switcheroo.c
> +++ b/drivers/gpu/vga/vga_switcheroo.c
> @@ -733,8 +733,10 @@ static int vga_switchto_stage2(struct vga_switcheroo_client *new_client)
>  	if (!active->driver_power_control)
>  		set_audio_state(active->id, VGA_SWITCHEROO_OFF);
>  
> +	if (new_client->ops->pre_switch)
> +		new_client->ops->pre_switch(new_client->pdev);
>  #if defined(CONFIG_FB)
> -	if (new_client->fb_info)
> +	else if (new_client->fb_info)
>  		fb_switch_outputs(new_client->fb_info);
>  #endif
>  

[Severity: High]
This is a pre-existing issue, but does vga_switchto_stage2() leave the
state machine corrupted if the hardware mux switch fails?

Earlier in vga_switchto_stage2(), the active client is marked as inactive:

	active->active = false;

If the handler's switchto() callback fails shortly after this patch's
hunk:

	ret = vgasr_priv.handler->switchto(new_client->id);
	mutex_unlock(&vgasr_priv.mux_hw_lock);
	if (ret)
		return ret;

Will returning early here leave the original active client permanently
marked as inactive? Since find_active_client() relies on this flag, it
appears subsequent switch commands would silently abort because they
can no longer find an active client. Should the active flag be restored
in this error path?

> diff --git a/include/linux/vga_switcheroo.h b/include/linux/vga_switcheroo.h
> index 7e6ac0114d556..d2ce30d8b6f78 100644
> --- a/include/linux/vga_switcheroo.h
> +++ b/include/linux/vga_switcheroo.h
> @@ -127,23 +127,29 @@ struct vga_switcheroo_handler {
>   * @set_gpu_state: do the equivalent of suspend/resume for the card.
>   * 	Mandatory. This should not cut power to the discrete GPU,
>   * 	which is the job of the handler
> + * @gpu_bound: Optional. Called before switching the outputs to the device.

[Severity: Low]
This isn't a bug, but should this be named @pre_switch instead of
@gpu_bound? 

It looks like @gpu_bound is already defined further down in this struct's
documentation, and this new description matches the purpose of the new
pre_switch callback.

>   * @reprobe: poll outputs.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260707135724.247562-1-tzimmermann@suse.de?part=3

  reply	other threads:[~2026-07-07 14:12 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 [this message]
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
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=20260707141247.8C3351F00A3A@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.