Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp589974ybl; Tue, 28 Jan 2020 08:25:41 -0800 (PST) X-Google-Smtp-Source: APXvYqxGV2TdJIcNhB7lBCmkMyGIqQ9/+GCcFRptGuUYdIHNoKuR2Llr+g1A1AuRUMujCaEROn7I X-Received: by 2002:aca:48d6:: with SMTP id v205mr3303283oia.10.1580228741089; Tue, 28 Jan 2020 08:25:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580228741; cv=none; d=google.com; s=arc-20160816; b=g5gFtyTF2W4q0L/nte/fsY4hd0llbh+JqBkJ4p1peZ9JNDR9s8+dywp18VJN577TKf SLNsq1lfAFbVgPmTnr3sVR9u6eJ79vGkFPfetOrmJHn1JbqQchvoeTO/TSCwxUvYDgcB nMdJmANMNhyLI7KsmcQWhDMm+/6nVyn/vkQJiXSoC4/8Wfbzx+Vmctayg7P+w08HOz54 2V7yCwkv319aW0fQWSUFiiYIwYGn+Ck6FIUfUE21oJJJfrb8gCrvb4nfiampRv+D/zna hPKlRYHrW6VoV6WKFvz/lVOsZUIaBY2y7cqxKSkhNt8jjQR6xxUuaZFwxGKwlke1wAUG AbZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature :dkim-signature; bh=rAg1/Jma7+qZOu0PfqxXfq2oXHCt06u6fF9eyryup58=; b=OWSf89v/llX2yfkU4EpBW9yb/x1PPascu+lMWtMl7a22vSzLTb9OdwVRKzuKUAqIfP +Ym20k2l7IeK9GnWEaxx24G18nuMcZvUQICkX1b4FYc11rtuU2/iCaBBQMPVlTuzsNld d3iBbnH/8qCXTpMZTXEbstRmThSw82uv+RxK9W0BV6QjUY6xE3IJADKl2kkBEH/5OVPl a+EWV7L26eFkXgWE6o9gPwFtt1dxSfJ646+KxsI1Ha8dtWuekCTwPkfVbjCIoV4F/CdS TPt0Iti0lcvqhMQQ+aWqmBrJsFFcj/P8vGvoXeQpJuOOwel1OIPqucAdr+SIYl4ZkUJ/ vEaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@pobox.com header.s=sasl header.b="yMPLzY/o"; dkim=temperror (no key for signature) header.i=@fluxnic.net header.s=2016-12.pbsmtp header.b="sLBSB/X5"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 16si7314718oth.99.2020.01.28.08.25.28; Tue, 28 Jan 2020 08:25:41 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@pobox.com header.s=sasl header.b="yMPLzY/o"; dkim=temperror (no key for signature) header.i=@fluxnic.net header.s=2016-12.pbsmtp header.b="sLBSB/X5"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726318AbgA1QXo (ORCPT + 99 others); Tue, 28 Jan 2020 11:23:44 -0500 Received: from pb-smtp21.pobox.com ([173.228.157.53]:50655 "EHLO pb-smtp21.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725974AbgA1QXn (ORCPT ); Tue, 28 Jan 2020 11:23:43 -0500 Received: from pb-smtp21.pobox.com (unknown [127.0.0.1]) by pb-smtp21.pobox.com (Postfix) with ESMTP id 93C92BDBCB; Tue, 28 Jan 2020 11:23:37 -0500 (EST) (envelope-from nico@fluxnic.net) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=date:from:to :cc:subject:in-reply-to:message-id:references:mime-version :content-type; s=sasl; bh=jYpALN1fbxMFSVVBUXE7zg9UxeE=; b=yMPLzY /oEE7pHkRhjtDKzYsKfgr6OB8Ve0ryTdCW67B9Ykhu5gOrTWF5hoN+XLvdLmlNN1 ijt8AMi/QxwlMLjff8CURMK/UDBlsAhlMvzuAC64GCCLlPjXYTu0hisGNT7viU7o GhpOXjdyxdzyAos0sDbbHNMuJK3qSEMaBu6pg= Received: from pb-smtp21.sea.icgroup.com (unknown [127.0.0.1]) by pb-smtp21.pobox.com (Postfix) with ESMTP id 88261BDBCA; Tue, 28 Jan 2020 11:23:37 -0500 (EST) (envelope-from nico@fluxnic.net) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=fluxnic.net; h=date:from:to:cc:subject:in-reply-to:message-id:references:mime-version:content-type; s=2016-12.pbsmtp; bh=1LSD1SXyHfZByrcKZiHw6WOuFn+XRuVq7AgxFxAf94Y=; b=sLBSB/X56XRODwmvf4UnhZTlcIQSH43t+irzIPlKOxjm0DKulSd8hl4vCdQ1dKIgaTLbp1znFBmLV+xirJyvIb6qbDGKtcn3gJTylkmwjoRjuy97rlCTNf6QMQIR8xtpdYR4QgoWvobzKzM87wARIZM6naUno/JYtDb+QmjOJJI= Received: from yoda.home (unknown [24.203.50.76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp21.pobox.com (Postfix) with ESMTPSA id 5DC82BDBC8; Tue, 28 Jan 2020 11:23:34 -0500 (EST) (envelope-from nico@fluxnic.net) Received: from xanadu.home (xanadu.home [192.168.2.2]) by yoda.home (Postfix) with ESMTPSA id 5A1A22DA00E3; Tue, 28 Jan 2020 11:23:32 -0500 (EST) Date: Tue, 28 Jan 2020 11:23:32 -0500 (EST) From: Nicolas Pitre To: Lukas Wunner cc: Greg Kroah-Hartman , Jiri Slaby , Mikulas Patocka , Matthew Whitehead , Daniel Vetter , Arvind Sankar , linux-kernel@vger.kernel.org Subject: Re: [PATCH] vt: Fix non-blinking cursor regression In-Reply-To: <20200128111107.ppqeebsctffmk7n6@wunner.de> Message-ID: References: <575cb82102aa59a7a8e34248821b78e1dd844777.1579701673.git.lukas@wunner.de> <20200126124834.ea7uxyprz2uaek5x@wunner.de> <20200128111107.ppqeebsctffmk7n6@wunner.de> User-Agent: Alpine 2.21 (LFD 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Pobox-Relay-ID: 87C1ABFC-41EA-11EA-A842-8D86F504CC47-78420484!pb-smtp21.pobox.com Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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