From mboxrd@z Thu Jan 1 00:00:00 1970 MIME-Version: 1.0 In-Reply-To: References: Date: Tue, 18 Jan 2011 18:37:55 -0800 Message-ID: From: ron minnich To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: [9fans] Fwd: plan9 go output faults on 9vx with rfork Topicbox-Message-UUID: 9effa212-ead6-11e9-9d60-3106f5b1d025 Pavel built a reproducer and sent it to me: ---------- Forwarded message ---------- From: Pavel Zholkover Date: Mon, Jan 17, 2011 at 12:24 PM Subject: Re: plan9 go output faults on 9vx with rfork To: ron minnich Hi Ron! I think I've traced the cause of the crash. It is unfortunately the syscall semacquire. The following C program will crash vanilla 0.12 9vx and the one I compiled from your branch: #include #include static long l=3D1; void main(int argc, char *argv[]) { =A0 =A0 =A0 =A0int i; =A0 =A0 =A0 =A0semacquire(&l, 1); =A0 =A0 =A0 =A0for(i=3D0; i < 999999; i++) =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0; =A0 =A0 =A0 =A0semrelease(&l, 1); =A0 =A0 =A0 =A0exits(nil); } --- Got peace and quite and a bulkhead seat to PHX, so had time to look. The problem was that cmpswap was never set to anything in 9vx, so the first time canacquire was used, well, kaboom, since canacquire was NULL. Changes can be seen here: https://bitbucket.org/rminnich/vx32/changeset/c7ba21bd847c My fix is in 9vx/main.c to do this: cmpswap =3D oscmpswap; What's oscmpswap? Well, for darwin, it is defined in 9vx/os/cmpswap.c You can see the rest of the changes; you can also see that this won't build on Linux until we fix it; left as an exercise for the reader, or until I get back home and fix it. The reproducer no longer crashes 9vx. Now, the question is, what's next to make Go work on 9vx? ron