Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp285915ybl; Tue, 28 Jan 2020 03:13:25 -0800 (PST) X-Google-Smtp-Source: APXvYqxbEYppa8e3UE9+a7uAUiSaMXRWstJAKCwySCXejZiswKz67nS6d0N5/1qpPvlsZvFTrwNV X-Received: by 2002:a9d:1706:: with SMTP id i6mr6783127ota.151.1580210005750; Tue, 28 Jan 2020 03:13:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580210005; cv=none; d=google.com; s=arc-20160816; b=aG2dINdlc+uu91nZc1AaXK9V3wDMVXT4AlX74Lx/hI9KN7zbwDMS7OHZbbxcwiSVDq xvdkvw4nzmjhyg5RuzTFsP379kMCDyQYbJ2PL2c+Ph4sJylBiGgTXk6qeZV9aJnIXO1z iBwqjZc3fjPClio+bDx3cLgGgK2kYKkhbrxzp0BQaQD7vfXmeH+bUvEDVimAjIMNlfKh cCO0VDarsv5sgoYCUojbI1fV5xZ/8/HzS/l5x2qX8dY7Dpq34aJHKWi99RHzPCQ912Dk tvHy3cvILoWUjRt7b7kk1+mrmNqo2+I9iUgeNj0JngNvk1iS2gg9wlQ9McBxpO4x9DYR t5Mw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=Ic7Ul8ktU3KFUWie+21kVqnX/lHAbZl+hr6XdYgOIlw=; b=E9joQUc0veBA7xsEeTOOPcRp1VtP7ecclwXuOXyHRjOQAqtKiMvJe6MIAiEYQHZV9C bj4nTIbq28EEg7ujud8lGnbt3RtKgettxZAF3D0POq5siWCxhxpfrMPjyy/mlIFeDVYT 9sklJ70CcN3+cFGDGLsKhhGb025ycjzV1hji6Wn8j3ISq6iQIXsWuOaSI8dFf2qcj4uA T4CeKXAC7Kmfy5ohZRF44dlaa/kYUshp3U5MvwJTmgZHdVYdFT35w/lWd1votz4Eq8og BjM5l/mAFgzYQ2N8oNxhfCwEt3WEiamVSi7ViNLZUkqpDvBryQiL/FNFFAovuPd7XYcL XxDQ== ARC-Authentication-Results: i=1; mx.google.com; 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 f81si5089869oig.110.2020.01.28.03.13.11; Tue, 28 Jan 2020 03:13:25 -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; 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 S1726264AbgA1LLL (ORCPT + 99 others); Tue, 28 Jan 2020 06:11:11 -0500 Received: from bmailout2.hostsharing.net ([83.223.78.240]:52717 "EHLO bmailout2.hostsharing.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725901AbgA1LLK (ORCPT ); Tue, 28 Jan 2020 06:11:10 -0500 Received: from h08.hostsharing.net (h08.hostsharing.net [IPv6:2a01:37:1000::53df:5f1c:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.hostsharing.net", Issuer "COMODO RSA Domain Validation Secure Server CA" (not verified)) by bmailout2.hostsharing.net (Postfix) with ESMTPS id E34B32800935A; Tue, 28 Jan 2020 12:11:07 +0100 (CET) Received: by h08.hostsharing.net (Postfix, from userid 100393) id B35AE1EB443; Tue, 28 Jan 2020 12:11:07 +0100 (CET) Date: Tue, 28 Jan 2020 12:11:07 +0100 From: Lukas Wunner To: Nicolas Pitre 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 Message-ID: <20200128111107.ppqeebsctffmk7n6@wunner.de> References: <575cb82102aa59a7a8e34248821b78e1dd844777.1579701673.git.lukas@wunner.de> <20200126124834.ea7uxyprz2uaek5x@wunner.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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. > > A dumb question perhaps, but why is it necessary to hide the cursor? > > Many console implements the cursor by changing the background color of > the cursor position. If the switch occurs while the cursor is in its > visible period, the rest of the code will assume that the cursor is the > actual background color, effectively leaving the drawn cursor there > after it moved. I see, thanks for the explanation. Lukas