Linux Serial subsystem development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Thomas Zimmermann" <tzimmermann@suse.de>
Cc: linux-serial@vger.kernel.org
Subject: Re: [PATCH v2 3/7] fbcon: Implement struct consw.con_unblank
Date: Fri, 16 Oct 2026 10:01:38 +0000	[thread overview]
Message-ID: <sashiko-outbox-174115@kernel.org> (raw)
In-Reply-To: <20261016093357.33294-4-tzimmermann@suse.de>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] fbcon: missing mode restore on VT switch due to par->graphics desync
--

commit c18deeb283bd933a2a74f5f89b8adc5baff05746
Author: Thomas Zimmermann <tzimmermann@suse.de>

fbcon: Implement struct consw.con_unblank

Implement con_unblank from struct consw with the !blank branches from
fbcon_blank(). The new function is called fbcon_unblank(). Remove the
duplicated code from fbcon_blank().

> diff --git a/drivers/video/fbdev/core/fbcon.c b/drivers/video/fbdev/core/fbcon.c
> index caad4e06944ea..6b6f162c90dd3 100644
> --- a/drivers/video/fbdev/core/fbcon.c
> +++ b/drivers/video/fbdev/core/fbcon.c
> @@ -2293,32 +2293,53 @@ static bool fbcon_blank(struct vc_data *vc, enum vesa_blank_mode blank,
[ ... ]
> +static bool fbcon_unblank(struct vc_data *vc)
> +{
> +	struct fb_info *info = fbcon_info_from_console(vc->vc_num);
> +	struct fbcon_par *par = info->fbcon_par;
> +	bool mode_switch = par->graphics && vc->vc_mode == KD_TEXT;

[Severity: High]
Can par->graphics become out of sync and prevent a required mode restore?

If vt_kdsetmode(KD_GRAPHICS) is called on a background console, it returns
early without calling do_blank_screen(), leaving par->graphics as false.

When switching to this VT, if the previous foreground VT was also in
KD_GRAPHICS mode, complete_change_console() in drivers/tty/vt/vt_ioctl.c skips
do_blank_screen() because old_vc_mode matches vc->vc_mode:

	if (old_vc_mode != vc->vc_mode) {
		if (vc->vc_mode == KD_TEXT)
			do_unblank_screen(1);
		else
			do_blank_screen(1);
	}

Because do_blank_screen() is skipped, par->graphics remains false for the new
framebuffer. When the application later exits and calls ioctl(KDSETMODE,
KD_TEXT), fbcon_unblank() is triggered.

Since par->graphics is false, mode_switch evaluates to false, skipping
fb_set_var() with FB_ACTIVATE_KD_TEXT. Without FB_ACTIVATE_KD_TEXT, DRM
helpers (like drm_fb_helper_set_par()) won't force a mode restore before the
DRM master drops its locks, which could leave the display frozen or corrupted.

> +
> +	if (mode_switch) {
> +		struct fb_var_screeninfo var = info->var;
> +
> +		var.activate = FB_ACTIVATE_NOW | FB_ACTIVATE_FORCE | FB_ACTIVATE_KD_TEXT;
> +		fb_set_var(info, &var);
> +		par->graphics = false;
> +		par->var = info->var;
> +	}

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

  reply	other threads:[~2026-10-16 10:01 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-16  9:11 [PATCH v2 0/7] vt: Simplify console-blanking interface Thomas Zimmermann
2026-10-16  9:11 ` [PATCH v2 1/7] vt: Add con_unblank callback to struct consw Thomas Zimmermann
2026-10-16  9:44   ` sashiko-bot
2026-10-16  9:11 ` [PATCH v2 2/7] dummycon: Implement struct consw.con_unblank Thomas Zimmermann
2026-10-16  9:46   ` sashiko-bot
2026-10-16  9:11 ` [PATCH v2 3/7] fbcon: " Thomas Zimmermann
2026-10-16 10:01   ` sashiko-bot [this message]
2026-10-16  9:11 ` [PATCH v2 4/7] newport_con: " Thomas Zimmermann
2026-10-16 10:07   ` sashiko-bot
2026-10-16  9:11 ` [PATCH v2 5/7] sticon: " Thomas Zimmermann
2026-10-16 10:13   ` sashiko-bot
2026-10-16  9:11 ` [PATCH v2 6/7] vgacon: " Thomas Zimmermann
2026-10-16  9:11 ` [PATCH v2 7/7] vt: Remove old-style con_blank Thomas Zimmermann

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=sashiko-outbox-174115@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-serial@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox