From mboxrd@z Thu Jan 1 00:00:00 1970 From: paulzhol@gmail.com (Pavel Zholkover) Date: Mon, 4 Apr 2011 10:37:30 +0300 Subject: [9fans] Go Plan 9 In-Reply-To: <20110403223031.GA27441@dinah> References: <20110403211333.GA3905@dinah> <20110403211652.GA5977@dinah> <20110403223031.GA27441@dinah> Message-ID: Topicbox-Message-UUID: c7ed962a-ead6-11e9-9d60-3106f5b1d025 Thanks for the detailed explanation, I've added your patch to if that is alright with you https://bitbucket.org/paulzhol/golang-plan9- runtime-patches/ Pavel On Mon, Apr 4, 2011 at 1:30 AM, Anthony Martin wrote: > Pavel Zholkover once said: >> I'm not sure I understand the reason 9vx will fail to reserve 768mb >> with brk() while my Plan 9 install on kvm+qemu with 128mb or ram works >> fine, as long as it is not written to. > > The reason is because 9vx gives user processes a virtual > address space of only 256mb. ?The brk works but the > first time we fault one of those pages past USTKTOP the > program suicides. > > The first fault happens at src/pkg/runtime/mcache.c:21 > in the runtime?MCache_Alloc function. > > To show you what I mean, here's a formatted stack trace: > > term% cat y.go > package main > > func main() { > ? ? ? ?println("Hello, world.") > } > > term% ./8.out > 8.out 174: suicide: sys: trap: page fault pc=0x000021df > > term% db 8.out 174 > 386 binary > page fault > /go/src/pkg/runtime/mcache.c:21 runtime.MCache_Alloc+39/ ? ? ? ?MOVL ? ?0(AX),AX > $c > runtime.MCache_Alloc(sizeclass=0x1, c=0x30424000, size=0x8, zeroed=0x1) > ? ? ? ?/go/src/pkg/runtime/mcache.c:13 called from runtime.mallocgc+db > ? ? ? ?/go/src/pkg/runtime/malloc.goc:62 > runtime.mallocgc(size=0x8, zeroed=0x1, flag=0x0, dogc=0x0) > ? ? ? ?/go/src/pkg/runtime/malloc.goc:40 called from runtime.malloc+41 > ? ? ? ?/go/src/pkg/runtime/malloc.goc:115 > runtime.malloc(size=0x1) > ? ? ? ?/go/src/pkg/runtime/malloc.goc:113 called from runtime.mallocinit+e9 > ? ? ? ?/go/src/pkg/runtime/malloc.goc:319 > runtime.mallocinit() > ? ? ? ?/go/src/pkg/runtime/malloc.goc:237 called from runtime.schedinit+39 > ? ? ? ?/go/src/pkg/runtime/proc.c:122 > runtime.schedinit() > ? ? ? ?/go/src/pkg/runtime/proc.c:113 called from _rt0_386+b3 > ? ? ? ?/go/src/pkg/runtime/386/asm.s:78 > _rt0_386() > ? ? ? ?/go/src/pkg/runtime/386/asm.s:12 called from 1 > > > Cheers, > ?Anthony > >