[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <nycvar.YSQ.7.76.2001281121340.1655@knanqh.ubzr>
Date: Tue, 28 Jan 2020 11:23:32 -0500 (EST)
From: Nicolas Pitre <nico@...xnic.net>
To: Lukas Wunner <lukas@...ner.de>
cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Jiri Slaby <jslaby@...e.com>,
Mikulas Patocka <mpatocka@...hat.com>,
Matthew Whitehead <tedheadster@...il.com>,
Daniel Vetter <daniel.vetter@...ll.ch>,
Arvind Sankar <nivedita@...m.mit.edu>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] vt: Fix non-blinking cursor regression
On Tue, 28 Jan 2020, Lukas Wunner wrote:
> On Sun, Jan 26, 2020 at 12:32:10PM -0500, Nicolas Pitre wrote:
> > On Sun, 26 Jan 2020, Lukas Wunner wrote:
> > > On Wed, Jan 22, 2020 at 11:40:38AM -0500, Nicolas Pitre wrote:
> > > > On Wed, 22 Jan 2020, Lukas Wunner wrote:
> > > > > Since commit a6dbe4427559 ("vt: perform safe console erase in the right
> > > > > order"), when userspace clears both the scrollback buffer and the screen
> > > > > by writing "\e[3J" to an fbdev virtual console, the cursor stops blinking
> > > > > if that virtual console is not in the foreground. I'm witnessing this
> > > > > on every boot of Raspbian since updating to v4.19.37+ because agetty
> > > > > writes the sequence to /dev/tty6 while the console is still switched to
> > > > > /dev/tty1. Switching consoles once makes the cursor blink again.
> > > > >
> > > > > The commit added an invocation of ->con_switch() to flush_scrollback().
> > > > > Normally this is only invoked from switch_screen() to switch consoles.
> > > > > switch_screen() updates *vc->vc_display_fg to the new console and
> > > > > fbcon_switch() updates ops->currcon. Because the commit only invokes
> > > > > fbcon_switch() but doesn't update *vc->vc_display_fg, it performs an
> > > > > incomplete console switch.
> > > > >
> > > > > When fb_flashcursor() subsequently blinks the cursor, it retrieves the
> > > > > foreground console from ops->currcon. Because *vc->vc_display_fg wasn't
> > > > > updated, con_is_visible() incorrectly returns false and as a result,
> > > > > fb_flashcursor() bails out without blinking the cursor.
> > > > >
> > > > > The invocation of ->con_switch() appears to have been erroneous. After
> > > > > all, why should a console switch be performed when clearing the screen?
> > > > > The commit message doesn't provide a rationale either. So delete it.
> > > >
> > > > The problem here is that only vgacon provides a con_flush_scrollback
> > > > method. When not provided, the only way to flush the scrollback buffer
> > > > is to invoke the switch method. If you remove it the scrollback buffer
> > > > of the foreground console won't be flushed in the fb case and possibly
> > > > others.
> [...]
> > Still, I'd prefer to get back to the same functional state from before
> > commit a6dbe44275 with the switch method first. Can you confirm that the
> > patch I propose does fix it for you?
>
> Yes, your patch is
>
> Reported-and-tested-by: Lukas Wunner <lukas@...ner.de>
OK, thanks.
> I'm withdrawing my own patch because further testing has shown that while it
> fixes the non-blinking cursor issue, it doesn't flush scrollback if "\e[3J"
> is written to the foreground console.
>
> Would you prefer me to submit your patch with your Signed-off-by or rather
> submit it yourself with my Tested-by? If the latter, please include a code
> comment explaining that ->con_switch() has the side effect of flushing
> scrollback. That seems quite non-obvious to me.
I'll submit it with a comment stating the non-obvious.
Nicolas
Powered by blists - more mailing lists