From owner-freebsd-haskell@freebsd.org Sun Nov 10 02:27:53 2019 Return-Path: Delivered-To: freebsd-haskell@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 93CBD1A7098 for ; Sun, 10 Nov 2019 02:27:53 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mailman.nyi.freebsd.org (mailman.nyi.freebsd.org [IPv6:2610:1c1:1:606c::50:13]) by mx1.freebsd.org (Postfix) with ESMTP id 479dG13THRz4R1R for ; Sun, 10 Nov 2019 02:27:53 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: by mailman.nyi.freebsd.org (Postfix) id 773A31A7097; Sun, 10 Nov 2019 02:27:53 +0000 (UTC) Delivered-To: haskell@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 76FF21A7096 for ; Sun, 10 Nov 2019 02:27:53 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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 "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 479dG12Zlfz4R1Q for ; Sun, 10 Nov 2019 02:27:53 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3BFC2202A1 for ; Sun, 10 Nov 2019 02:27:53 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id xAA2Rrrm032645 for ; Sun, 10 Nov 2019 02:27:53 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id xAA2RrYt032641 for haskell@FreeBSD.org; Sun, 10 Nov 2019 02:27:53 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" From: bugzilla-noreply@freebsd.org To: haskell@FreeBSD.org Subject: maintainer-feedback requested: [Bug 241849] lang/ghc: Enable USE_PTHREAD_FOR_ITIMER Date: Sun, 10 Nov 2019 02:27:52 +0000 X-Bugzilla-Type: request X-Bugzilla-Product: Ports & Packages X-Bugzilla-Component: Individual Port(s) X-Bugzilla-Version: Latest X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: haskell@FreeBSD.org X-Bugzilla-Flags: maintainer-feedback? Message-ID: In-Reply-To: References: X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-haskell@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FreeBSD-specific Haskell issues and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 Nov 2019 02:27:53 -0000 Bugzilla Automation has asked freebsd-haskell mailing list for maintainer-feedback: Bug 241849: lang/ghc: Enable USE_PTHREAD_FOR_ITIMER https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D241849 --- Description --- The GHC RTS has an interval timer that is apparently used both in the threa= ded (-threaded) and non-threaded runtime. On some operating systems, rts/posix/Itimer.c sets USE_PTHREAD_FOR_ITIMER, which uses usleep() at regular intervals instead of SIGVALRM. Per the comments about Darwin (macOS) above: * We want to avoid using the SIGALRM signals whenever possible as these signals * interrupt system calls (see #10840) and can be overridden by user code. = On * Darwin we can use a dedicated thread and usleep. The attached patch applies this for FreeBSD as well. To see the difference, run 'truss' on a simple test program: =3D=3D test.hs =3D=3D main =3D do c <- getChar putChar c $ ghc test.hs $ truss ./test.hs ... some stuff SIGNAL 26 (SIGVTALRM) code=3DSI_TIMER value=3D0x0 timerid=3D3 overrun=3D0 sigprocmask(SIG_SETMASK,{ SIGVTALRM },0x0) =3D 0 (0x0) sigreturn(0x7fffffff9880) =3D 0 (0x0) ioctl(0,TIOCGETA,0x7fffffffa270) =3D 0 (0x0) poll({ 0/POLLIN },1,0) =3D 0 (0x0) select(1,{ 0 },{ },0x0,0x0) ERR#4 'Interrupted system call' SIGNAL 26 (SIGVTALRM) code=3DSI_TIMER value=3D0x0 timerid=3D3 overrun=3D0 sigprocmask(SIG_SETMASK,{ SIGVTALRM },0x0) =3D 0 (0x0) sigreturn(0x7fffffffd6c0) ERR#4 'Interrupted system call' select(1,{ 0 },{ },0x0,0x0) ERR#4 'Interrupted system call' ... more of this After this change: ... some stuff ioctl(0,TIOCGETA,0x7fffffffa270) =3D 0 (0x0) poll({ 0/POLLIN },1,0) =3D 0 (0x0) nanosleep({ 0.010000000 }) =3D 0 (0x0) nanosleep({ 0.010000000 }) =3D 0 (0x0) nanosleep({ 0.010000000 }) =3D 0 (0x0) ... more of this select(1,{ 0 },{ },0x0,0x0) =3D 1 (0x1) ... more stuff