From owner-freebsd-arch@FreeBSD.ORG Wed Sep 12 20:32:51 2007 Return-Path: Delivered-To: freebsd-arch@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5D99B16A420 for ; Wed, 12 Sep 2007 20:32:51 +0000 (UTC) (envelope-from marcus@FreeBSD.org) Received: from creme-brulee.marcuscom.com (marcuscom-pt.tunnel.tserv1.fmt.ipv6.he.net [IPv6:2001:470:1f00:ffff::1279]) by mx1.freebsd.org (Postfix) with ESMTP id DDD9913C474 for ; Wed, 12 Sep 2007 20:32:50 +0000 (UTC) (envelope-from marcus@FreeBSD.org) Received: from [IPv6:2001:470:1f00:2464::4] (shumai.marcuscom.com [IPv6:2001:470:1f00:2464::4]) by creme-brulee.marcuscom.com (8.14.1/8.14.1) with ESMTP id l8CKXPES057901; Wed, 12 Sep 2007 16:33:26 -0400 (EDT) (envelope-from marcus@FreeBSD.org) From: Joe Marcus Clarke To: Bruce Evans In-Reply-To: <20070902131910.H46281@delplex.bde.org> References: <1188600721.1255.11.camel@shumai.marcuscom.com> <20070901112600.GA33832@stack.nl> <1188660782.41727.5.camel@shumai.marcuscom.com> <20070901224025.GA97796@stack.nl> <20070902131910.H46281@delplex.bde.org> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-8zv3kekHV5lojjJdjkLb" Organization: FreeBSD, Inc. Date: Wed, 12 Sep 2007 16:32:44 -0400 Message-Id: <1189629164.80084.81.camel@shumai.marcuscom.com> Mime-Version: 1.0 X-Mailer: Evolution 2.10.3 FreeBSD GNOME Team Port X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,NO_RELAYS autolearn=ham version=3.2.3 X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on creme-brulee.marcuscom.com Cc: Jilles Tjoelker , freebsd-arch@FreeBSD.org Subject: Re: Understanding interrupted system calls X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Sep 2007 20:32:51 -0000 --=-8zv3kekHV5lojjJdjkLb Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Sun, 2007-09-02 at 14:17 +1000, Bruce Evans wrote: > >From Jilles' previous reply: >=20 > >>> The problem seems to be the following code in > >>> src/sys/dev/syscons/syscons.c, in case VT_WAITACTIVE in scioctl(): > >>>=20 > >>> while ((error=3Dtsleep(&scp->smode, PZERO|PCATCH, > >>> "waitvt", 0)) =3D=3D ERESTART) ; > >>>=20 > >>> If a signal is caught and system call restart is enabled for that > >>> signal, this makes it spin in a tight loop, waiting in vain for the > >>> signal to go away. The idea of ERESTART is that the syscall function > >>> returns it and then the signal handler is entered. If and when the > >>> signal handler returns, it will return to the system call instruction= , > >>> restarting it (perhaps this is optimized to avoid the switch to userl= and > >>> and back). With EINTR, the signal handler would return to directly > >>> after the system call instruction. > >>>=20 > >>> The fixed version would then be > >>>=20 > >>> error =3D tsleep(&scp->smode, PZERO|PCATCH, "waitvt", 0); >=20 > I think this is right. The kernel should never loop on ERESTART like thi= s. > Please fix the remaining style bug in it (missing spaces around binary > operator). Bruce, I didn't know if you saw my fix, if it needs more work, or if you're going to commit it? I'd really like to get this fixed before 7.0. Should I open a PR to track it? Thanks. http://www.marcuscom.com/downloads/syscons.c.diff http://www.marcuscom.com/downloads/pcvt_ext.c (-STABLE only) Joe --=20 Joe Marcus Clarke FreeBSD GNOME Team :: gnome@FreeBSD.org FreeNode / #freebsd-gnome http://www.FreeBSD.org/gnome --=-8zv3kekHV5lojjJdjkLb Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (FreeBSD) iD8DBQBG6Ezpb2iPiv4Uz4cRAh0rAJ4kMI4f+FZQ2rcFMlHeZPDU5cLLyQCcCvwf ePZ8O9KB60ZTp7RsnnWE5A4= =iyHG -----END PGP SIGNATURE----- --=-8zv3kekHV5lojjJdjkLb--