From owner-svn-src-all@freebsd.org Tue Sep 3 14:06:19 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0A878DC1C5; Tue, 3 Sep 2019 14:06:01 +0000 (UTC) (envelope-from yuripv@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46N7yw1cx1z4P5J; Tue, 3 Sep 2019 14:06:00 +0000 (UTC) (envelope-from yuripv@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1452) id 145B019F71; Tue, 3 Sep 2019 14:05:54 +0000 (UTC) X-Original-To: yuripv@localmail.freebsd.org Delivered-To: yuripv@localmail.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "mx1.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by freefall.freebsd.org (Postfix) with ESMTPS id 8B7298DB7; Mon, 1 Apr 2019 09:02:56 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3B0698CED9; Mon, 1 Apr 2019 09:02:56 +0000 (UTC) (envelope-from owner-src-committers@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 538) id 155B58DB5; Mon, 1 Apr 2019 09:02:56 +0000 (UTC) Delivered-To: src-committers@localmail.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [96.47.72.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (Client CN "mx1.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by freefall.freebsd.org (Postfix) with ESMTPS id 77E828DB1 for ; Mon, 1 Apr 2019 09:02:53 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by mx1.freebsd.org (Postfix) with ESMTP id C904F8CED4; Mon, 1 Apr 2019 09:02:52 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id 86AB043D588; Mon, 1 Apr 2019 20:02:49 +1100 (AEDT) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Konstantin Belousov cc: Bruce Evans , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r345696 - head/lib/libvgl In-Reply-To: <20190331145122.GL1923@kib.kiev.ua> Message-ID: <20190401185606.Q2155@besplex.bde.org> References: <201903291557.x2TFv9AW097226@repo.freebsd.org> <20190329182100.GZ1923@kib.kiev.ua> <20190330142319.I1011@besplex.bde.org> <20190330094558.GA1923@kib.kiev.ua> <20190331214235.K961@besplex.bde.org> <20190331121015.GK1923@kib.kiev.ua> <20190331231926.M1259@besplex.bde.org> <20190331145122.GL1923@kib.kiev.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=UJetJGXy c=1 sm=1 tr=0 cx=a_idp_d a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=nR6jlSWGY1YSvxl2fiIA:9 a=CjuIK1q_8ugA:10 Precedence: bulk X-Loop: FreeBSD.org Sender: owner-src-committers@freebsd.org X-Rspamd-Queue-Id: 3B0698CED9 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-6.96 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.96)[-0.957,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] Status: O X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 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: , Date: Tue, 03 Sep 2019 14:06:19 -0000 X-Original-Date: Mon, 1 Apr 2019 20:02:46 +1100 (EST) X-List-Received-Date: Tue, 03 Sep 2019 14:06:19 -0000 On Sun, 31 Mar 2019, Konstantin Belousov wrote: > On Mon, Apr 01, 2019 at 12:04:45AM +1100, Bruce Evans wrote: >> Serial consoles are not always available. >> >> Better debuggers switch the screen mode as necessary. >> >> I recently noticed another mode switching problem. On i386, cycling >> through about 50 modes to test them all takes a small fraction of a >> second for each mode switch (done directly in syscons or by a vm86 >> BIOS call) even when the monitor takes too long to resync (the monitor >> resyncs are coalesced, so 50 resyncs take about 5 seconds instead of >> 250). But on amd64, mode switches to VESA mode and back take about >> 20 seconds. They are not coalesced, and most of the system is stopped >> waiting for them (at least remote network access is stopped). amd64 >> can't use vm86, so it emulates BIOS calls. Why does the emulation stop >> the rest of the system and take so long? > > How many CPUs do you have ? 8 on the machine that shows the problem -- an underdesktop with Haswell graphics. A laptop with Sandybridge graphics only waits for 0.25 seconds (sys time) I don't know if it stops the system for that long (it would be 2 blockages for half that long). The laptop's integrated screen also syncs instantly. The undermydesktop has an LED screen connected by DVI-D. > x86bios.c x86bios_call() does spinlock_enter() around emulator calls. > This disables interrupts. > > If you have only one CPU, the consequences are obvious. If you have > more than one, then perhaps next IPI targeted to this CPU blocks the > originator, if IPI requires ack, which typically true for most common > TLB shutdown IPIs. Then both this CPU and originator block any other CPU > trying to send an IPI. Serial console interrupts on another CPU work to enter ddb instantly and show the emulator stopped. Binding drivers to CPU unimproves scheduling in general, and here it might result in iflib waiting for the CPU with interrupts disabled, but usually the CPU with interrupts disabled is not the one(s) bound to by iflib, and binding the graphics program to one not used by iflib doesn't help. Removing the spinlock_enter/exit() using ddb makes no difference. > For this reason I have to come through several hoops to not disable > interrupts for duration of EFI runtime calls, otherwise spinlocks die > due to 'spin lock held too long' on other CPUs. I turn off the 'spin lock held too long' panics in my fixes for console and message buffer i/o. Printing "spin lock held too long\n" takes 120 seconds at 2 bps. Draining 16K of buffered messages takes 81920 seconds at 2 bps. The main fix is to cancel the timeouts here while any console driver is making progress (hopefully printing messages about the actual error). 2 bps is too slow to be useful, but it gives a good stress test and a check that the timeouts are scaled properly by the console speed. Disabling interrupts might be FUD. vm86 on i386 only uses critical_enter() in addition to its sleep lock. But this is bad for scheduling too. Bruce