Pavel built a reproducer and sent it to me:

---------- Forwarded message ----------
From: Pavel Zholkover <paulz...@gmail.com>
Date: Mon, Jan 17, 2011 at 12:24 PM
Subject: Re: plan9 go output faults on 9vx with rfork
To: ron minnich <rminn...@gmail.com>


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 <u.h>
#include <libc.h>

static long l=1;

void main(int argc, char *argv[]) {
       int i;

       semacquire(&l, 1);

       for(i=0; i < 999999; i++)
               ;

       semrelease(&l, 1);
       exits(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 = 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

Reply via email to