From owner-svn-src-all@freebsd.org Thu Mar 24 15:46:59 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 17078ADC677 for ; Thu, 24 Mar 2016 15:46:59 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from erouter6.ore.mailhop.org (erouter6.ore.mailhop.org [54.187.213.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E0FA116D2 for ; Thu, 24 Mar 2016 15:46:58 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: 95dd158d-f1d7-11e5-827e-7d17a39bef25 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 73.34.117.227 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [73.34.117.227]) by outbound3.ore.mailhop.org (Halon Mail Gateway) with ESMTPSA; Thu, 24 Mar 2016 15:46:33 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.14.9) with ESMTP id u2OFkofq016707; Thu, 24 Mar 2016 09:46:50 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <1458834410.1091.54.camel@freebsd.org> Subject: Re: svn commit: r297190 - head/sys/kern From: Ian Lepore To: Edward Tomasz =?iso-8859-2?Q?Napiera=B3a?= , Alexander Motin Cc: =?ISO-8859-1?Q?Jean-S=E9bastien_P=E9dron?= , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Thu, 24 Mar 2016 09:46:50 -0600 In-Reply-To: <20160324150151.GA1277@brick.home> References: <201603221346.u2MDk1XH029623@repo.freebsd.org> <1458662141.1091.16.camel@freebsd.org> <56F29654.8030806@dumbbell.fr> <20160323174537.GA1826@brick.home> <56F3B441.6030602@dumbbell.fr> <20160324134222.GA1442@brick.home> <56F3F52F.9040705@gmail.com> <20160324150151.GA1277@brick.home> Content-Type: text/plain; charset="iso-8859-2" X-Mailer: Evolution 3.16.5 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Mar 2016 15:46:59 -0000 On Thu, 2016-03-24 at 16:01 +0100, Edward Tomasz Napiera³a wrote: > On 0324T1609, Alexander Motin wrote: > > On 24.03.16 15:42, Edward Tomasz Napiera³a wrote: > > > On 0324T1032, Jean-Sébastien Pédron wrote: > > > > On 23/03/2016 18:45, Edward Tomasz Napierala wrote: > > > > > > So maybe callouts are disabled in this situation. If there > > > > > > is a way to > > > > > > detect that, then vt(4) can go back to a "synchronous mode" > > > > > > where it > > > > > > refreshes the screen after each typed character, like it > > > > > > does when ddb > > > > > > is active. > > > > > > > > > > Looks like that's the case: for some reason the callouts > > > > > don't work. > > > > > This trivial hack is a (mostly) working workaround: > > > > > > > > > > Index: svn/head/sys/kern/kern_cons.c > > > > > ============================================================= > > > > > ====== > > > > > --- svn/head/sys/kern/kern_cons.c (revision 297210) > > > > > +++ svn/head/sys/kern/kern_cons.c (working copy) > > > > > @@ -430,6 +430,7 @@ cngets(char *cp, size_t size, int > > > > > visible) > > > > > lp = cp; > > > > > end = cp + size - 1; > > > > > for (;;) { > > > > > + pause("meh", 1); > > > > > > > > Could you please explain how this works to me? Does calling > > > > pause() here > > > > give a chance to interrupt handlers or other threads of > > > > running? > > > > > > It looks like it allows the callout to run. I've did an > > > experiment > > > and added a simple callout that printed something each second; > > > during > > > the root mount prompt it doesn't get run unless you type '.', > > > which > > > calls pause(9). > > > > Kernel threads run with absolute priorities, so if somehow this > > threads > > happen to have higher or equal priority then callout thread, or the > > kernel is built without PREEMPTION, then the last may never be > > executed > > until this thread get to sleep or at least call sched_yield(). > > The callout's td_priority seems to be 40; the thread running the > prompt > is 84, so it's lower. > > I've just noticed another curious thing, though: when you press > ScrLk, > the screen gets immediately refreshed; also, pressing arrows works > just > the way it should. In other words, the refresh is broken except for > the ScrlLk mode, where it works as it should. Since cngets() is used only by the mountroot prompt and the geli pw entry, pausing/yielding within the input loop seems like a good idea. It would allow for things like plugging in a usb device and having it actually appear without having to enter a '.' several times. It would be nice if the pause were done with pause_sbt() and a shorter timeout, maybe a millisecond or even 100uS. Otherwise things like pasting text at that prompt in a serial console is likely to drop chars. Hmmm... speaking of the geli pw prompt... what's the locking situation there? Will there be any problems calling pause() from that context? -- Ian