[9fans] why u.h, why qid?

2014-05-07 Thread Yoann Padioleau
Hi,

I was wondering what was the reasons for the name u.h? Is it because
it has lots of uxxx type in it?

Also what is the meaning of Qid. What the Q stands for?





Re: [9fans] why u.h, why qid?

2014-05-09 Thread Yoann Padioleau
No answer? Nobody knows or my question is stupid?
I really search for the history of QID and why this Q but could
not find anything …


On May 7, 2014, at 10:45 PM, Yoann Padioleau  wrote:

> Hi,
> 
> I was wondering what was the reasons for the name u.h? Is it because
> it has lots of uxxx type in it?
> 
> Also what is the meaning of Qid. What the Q stands for?
> 
> 
> 




[9fans] kernel bug

2014-06-02 Thread Yoann Padioleau
Hi,

in the newseg() function there is:

mapsize = ROUND(size, PTEPERTAB)/PTEPERTAB;
if(mapsize > nelem(s->ssegmap)){
mapsize *= 2;
if(mapsize > (SEGMAPSIZE*PTEPERTAB))
mapsize = (SEGMAPSIZE*PTEPERTAB);
s->map = smalloc(mapsize*sizeof(Pte*));
s->mapsize = mapsize;
}
else{
s->map = s->ssegmap;
s->mapsize = nelem(s->ssegmap);
}

I think it should be
if(mapsize > (SEGMAPSIZE))
mapsize = SEGMAPSIZE;

Also why in the kernel they use 'struct Pte' instead of the better name 
Pagetable.
In many places this is very confusing because when I see Pte I think of a 
Pagetable Entry
where really they are speaking about a Pagetable.


[9fans] minor kernel bug

2014-06-04 Thread Yoann Padioleau
Hi,

Here is a patch for tasklock.c:

int
lock(Lock *l)
{
int i;
ulong pc;

pc = getcallerpc(&l);

lockstats.locks++;
if(up)
inccnt(&up->nlocks);/* prevent being scheded */
if(tas(&l->key) == 0){
if(up)
up->lastlock = l;
l->pc = pc;
l->p = up;
l->isilock = 0;
+   l->m = MACHP(m->machno);
...
return 0;
}

we do that in ilock() and canlock() so it's a bug I think to not do it also in 
lock().
The field is only used in iprintcanlock which use canlock(), not lock(), so this
if fine, but for consistency it would be better to also do it in lock() no?





[9fans] other kernel bug

2014-06-04 Thread Yoann Padioleau
Hi,

I think I've found another one :)

in confinit() we do:

kmem -= conf.upages*sizeof(Page)
+ conf.nproc*sizeof(Proc)
+ conf.nimage*sizeof(KImage)
+ conf.nswap
+ conf.nswppo*sizeof(Page); // <- BUG

but in swapinit we actually do
iolist = xalloc(conf.nswppo*sizeof(Page*));

so in confinit() it should be conf.nswppo*sizeof(Page*)





Re: [9fans] What is Plan9 exactly?

2014-06-05 Thread Yoann Padioleau
Nice!

On Jun 4, 2014, at 8:14 PM, s...@9front.org wrote:

> https://urldefense.proofpoint.com/v1/url?u=http://code.google.com/p/plan9front/wiki/fqa0&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=%2FN9d7W2LRwZks3eyFNLr8Q%3D%3D%0A&m=932ql2s0yZzSIWvDmA7Ow3MAsKVfP6fSFQC%2Fj%2BdntMU%3D%0A&s=5073da3bad45a50f3d32794c907cb48394fd92ea90ebf6a999b2470190f58110
> 
> sl
> 




[9fans] advanced core Linux kernel features not in plan9

2014-06-06 Thread Yoann Padioleau
Hi,

I was curious to know which core features of the Linux kernel are not 
implemented
in the plan9 kernel. By core I mean that I know plan9 does not have all the 
drivers,
filesystems, buses, etc Linux has, but it has many of its core
features (virtual memory, paging, swapping, demand loading, copy on write, etc),
and even more.

For instance I was not able to find any code related to the buffer cache Linux 
has.
If you open a big file in a plan9 process, then close it, and later you open it 
again,
will you pay the IO again? Or is it cached somewhere?




[9fans] 9pi on qemu failure

2014-06-07 Thread Yoann Padioleau
Hi,

I've tried to run 9pi from richard miller on qemu but failed
http://plan9.bell-labs.com/sources/contrib/miller/

qemu-system-arm -cpu arm1176 -m 512 -M versatilepb -kernel 9pi
qemu: fatal: Trying to execute code outside RAM or ROM at 0x80010028

R00= R01=00052078 R02=0552 R03=0fff
R04=3000 R05=09ff R06=1ff0040e R07=2100
R08=7f00 R09= R10= R11=1805
R12=000a8ffc R13=80002ffc R14=00010058 R15=80010028
PSR=01d3  A svc32
s00= s01= d00=
s02= s03= d01=
s04= s05= d02=
s06= s07= d03=
s08= s09= d04=
s10= s11= d05=
s12= s13= d06=
s14= s15= d07=
s16= s17= d08=
s18= s19= d09=
s20= s21= d10=
s22= s23= d11=
s24= s25= d12=
s26= s27= d13=
s28= s29= d14=
s30= s31= d15=
FPSCR: 
abort trap: 6



This works though with a linux kernel compiled for the raspberry, e.g.
from http://xecdesign.com/qemu-emulating-raspberry-pi-the-easy-way/

  *   wget http://xecdesign.com/downloads/linux-qemu/kernel-qemu


and then
qemu-system-arm -cpu arm1176 -m 512 -M versatilepb -kernel kernel-qemu

works.



Re: [9fans] 9pi on qemu failure

2014-06-09 Thread Yoann Padioleau
Hi,

I have a raspberry pi :) but I've found it incredibly convenient to have an 
emulator
to test things. The development iterative loop is far faster when you can 
cross-compile
from your pc and test directly on your pc. Then once it works you can deploy
and test on the real machine. Anyway, I understand it would be complicated
to make plan9 works on qemu for arm1176.

On Jun 8, 2014, at 9:02 AM, Richard Miller <9f...@hamnavoe.com> wrote:

>>> This works though with a linux kernel compiled for the raspberry, e.g.
>>> from 
>>> https://urldefense.proofpoint.com/v1/url?u=http://xecdesign.com/qemu-emulating-raspberry-pi-the-easy-way/&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=%2FN9d7W2LRwZks3eyFNLr8Q%3D%3D%0A&m=xtUc%2B%2BLTD9Nd9zDzA3%2BHrYrg6YJxYvceJz4dKM6VilU%3D%0A&s=aafa0b698d8faa75b24756ff8567b8699fd2686c0d38562cc6c97e5a00bcf362
>>>  
>>> wget 
>>> https://urldefense.proofpoint.com/v1/url?u=http://xecdesign.com/downloads/linux-qemu/kernel-qemu&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=%2FN9d7W2LRwZks3eyFNLr8Q%3D%3D%0A&m=xtUc%2B%2BLTD9Nd9zDzA3%2BHrYrg6YJxYvceJz4dKM6VilU%3D%0A&s=bbec0427d0c6670d2da7f7bb614919390a9829436af5205dc85696cf4cb582e5
> 
> I would bet that linux kernel isn't actually configured for the
> raspberry pi -- it will be for a generic arm1176.  The pi's processor isn't
> an arm1176 exactly; it's a Broadcom bcm2835 videocore gpu, with an arm
> core grafted on.  It's highly unlikely that qemu knows how to emulate
> this well enough for a native bcm kernel like 9pi to run successfuly.
> The "emulating raspberry pi the easy way" is not really emulating the
> pi, just using a generic arm kernel to run linux software from a
> raspberry pi linux distribution image.
> 
> If you want to run 9pi, I recommend buying a raspberry pi.  They aren't
> expensive, and native Plan 9 is a much more rewarding experience.
> 
> 




[9fans] kernel possible double free

2014-06-09 Thread Yoann Padioleau
Hi,

I think I've found a possible situation where we call two times free on the 
same pointer.
in sysexec() there is essentially

sysexec(...) {
 … 
if(waserror()){
free(file0);
free(elem);
nexterror();
}

for(;;){
tc = namec(file, Aopen, OEXEC, 0);
if(waserror()){
cclose(tc);
nexterror();
}

…
   }
qlock(&up->seglock);
if(waserror()){
qunlock(&up->seglock);
nexterror();
}

 …
free(file0);
+  file0 = nil; <- we should add that, for the same 
reason we do elem = nil below
free(up->text);
up->text = elem;
elem = nil; /* so waserror() won't free elem */
USED(elem);

…
qunlock(&up->seglock);
poperror(); /* seglock */
-   poperror(); /* elem */ <--- actually this is 
not the poperror of elem, but of tc

…
poperror();
cclose(tc);
+  poperror(); /* elem and file0 */ <--- this is where the poperror 
of elem should be.


}


Re: [9fans] other kernel bug

2014-06-09 Thread Yoann Padioleau
Hi cinap,

Would it be possible to change a bit the 9front mercurial repository so that
it can work on MacOS filesystem. 

I get some:
abort: case-folding collision between sys/lib/troff/font/devutf/charlib/lH and 
sys/lib/troff/font/devutf/charlib/LH

when hg pull; hg update.

I can understand the hate for non plan9 OS but it would be nice :)

On Jun 5, 2014, at 9:15 PM, cinap_len...@felloff.net wrote:

> no. it just makes the kernels malloc arena limit a bit smaller than
> it should be.
> 
> --
> cinap
> 




[9fans] possible buffer overflow in devcons.c?

2014-06-18 Thread Yoann Padioleau
Hi,

In devcons.c there is

/*
 *  Put character, possibly a rune, into read queue at interrupt time.
 *  Called at interrupt time to process a character.
 */
int
kbdputc(Queue*, int ch)
{
int i, n;
char buf[3]; <- enough?
Rune r;
char *next;

if(kbd.ir == nil)
return 0;   /* in case we're not inited yet */

ilock(&kbd.lockputc);   /* just a mutex */
r = ch;
n = runetochar(buf, &r);
for(i = 0; i < n; i++){
next = kbd.iw+1;
if(next >= kbd.ie)
next = kbd.istage;
if(next == kbd.ir)
break;
*kbd.iw = buf[i];
kbd.iw = next;
}
iunlock(&kbd.lockputc);
return 0;
}

But is the buf[3] enough? UTFMAX is 4 so we could possibly overflow no?
Shouldn't it be buf[UTFMAX] ?





Re: [9fans] possible buffer overflow in devcons.c?

2014-06-18 Thread Yoann Padioleau
Well, hard to grep for '3' in a big codebase. They should have used UTFMAX in 
the first place.

I see though that currently in libc.h I have

enum
{
UTFmax  = 4,/* maximum bytes per rune */
Runesync= 0x80, /* cannot represent part of a UTF 
sequence (<) */
Runeself= 0x80, /* rune and UTF sequences are the same 
(<) */
Runeerror   = 0xFFFD,   /* decoding error in UTF */
Runemax = 0x10, /* 21-bit rune */
Runemask= 0x1F, /* bits used by runes (see grep) */
};

so Runemax seems to indicate we never produce rune using more than 3 bytes no?
So maybe buf[3] is safe?

On Jun 18, 2014, at 10:36 AM, erik quanstrom  wrote:

> On Wed Jun 18 13:36:09 EDT 2014, mirtchov...@gmail.com wrote:
>> used to be 3 :)
>> 
>> "UTFmax, defined as 3 in , is the maximum number of bytes
>> required to represent a rune."
> 
> which is exactly why this should have been caught.
> this one's my fault.
> 
> - erik
> 




[9fans] crashing plan9 source boot CD with key combination (buffer overflow)

2014-06-20 Thread Yoann Padioleau
Hi,

There is another buffer overflow somewhere I think.

The code in kbdputsc() in kbd.c does not look very safe:

kbscan->kc[kbscan->nk++] = c; <- no bound checking, can 
overflow.
c = latin1(kbscan->kc, kbscan->nk);
if(c < -1)  /* need more keystrokes */
return;
if(c != -1) /* valid sequence */
kbdputc(kbdq, c);
else/* dump characters */
for(i=0; ink; i++)
kbdputc(kbdq, kbscan->kc[i]);
kbscan->nk = 0;
kbscan->collecting = 0;

Actually with the plan9 actual iso, when I boot from the CD
and in rio I open a new terminal and type

 x ddd  lc
then I crash the cpu.




Re: [9fans] [GSOC] plan9 kernel scheduler

2014-06-21 Thread Yoann Padioleau
if you look in sys/src/9/port
and grep for functions like

sched()
schedinit()
runproc()
updatecpu()
repriotirize()

you'll get the logic of the scheduling algorithm. It's mostly
priority queue fair robin I think, with a few hooks to prefer reschedule
on the same CPU.

Context switching is done with the
gotolabel()
setlabel()
mmuswtich()
taskswitch()


On Jun 21, 2014, at 12:30 PM, yan cui  wrote:

> Hi all,
> 
> On SMP or multicore systems, what algorithm(s) does Plan 9 use to 
> schedule(context switching and load balancing) different tasks (process or 
> thread) and where is it implemented? I searched some plan9 documents, but 
> cannot find some about this topic. Any recommendations?
> 
> 
> Thanks, Yan
> 
> -- 
> Think big; Dream impossible; Make it happen.  




Re: [9fans] bug in procwired() for x86 scheduler?

2014-06-22 Thread Yoann Padioleau
The code should be

if(up != p && (p->wired == nil || p->wired == MACHP(m->machno))
   m->readied = p;

no?

> 
> if(up != p && (p->wired == nil || p->wired == m))
>   m->readied = p; /* group scheduling */

On Jun 22, 2014, at 10:20 AM, yoann padioleau  wrote:

> Hi,
> 
> Looking at the scheduler code I think I've found a bug related to the
> customized affinity one can set for a process.
> 
> In ready() there is:
> 
>   if(up != p && (p->wired == nil || p->wired == m))
>   m->readied = p; /* group scheduling */
> 
> but on x86 'm' is actually set to a fixed address, MACHADDR. Each cpu actually
> have a different mapping in its pagetable to then translate MACHADDR virtual 
> address to a different
> physical address.
> 
> in procwired() there is:
>   p->wired = MACHP(bm);
> 
> MACHP is an array of addresses of all Mach in memory but not using this
> MACHADDR fixed virtual address. Each entry corresponds to a different Mach 
> virtual
> address. 
> 
> So there is no way the test in ready() p->wired == m can even return true. 
> 




Re: [9fans] bug in procwired() for x86 scheduler?

2014-06-23 Thread Yoann Padioleau
Yes I agree, it's better that way. Is there a list somewhere on the web with all
those 9atom patches?

On Jun 22, 2014, at 5:57 PM, erik quanstrom 
 wrote:

>> On 22 June 2014 23:25, Yoann Padioleau  wrote:
>> 
>>> if(up != p && (p->wired == nil || p->wired == MACHP(m->machno))
>>>   m->readied = p;
>>> 
>> 
>> yes, because on 386 m is effectively a constant. the code was written with
>> extern register Mach *m in mind.
>> 
> 
> 
> 9atom has had it as
> 
>   if(up != p && (p->wired == nil || p->wired->machno == m->machno))
> 
> which i believe is equivalent, and less obnoxious.  the pc kernel should be 
> rewritten
> with the GS extern register bit, and then we could get rid of MACHP.
> 
> - erik
> 




Re: [9fans] Cross-compiling Plan 9

2014-07-07 Thread Yoann Padioleau
Hi,

I was able to cross compile Plan9 from MacOS which is probably quite similar
to cross compiling from Linux.

The first thing was to compile the plan9 C compilers
on MacOS. I used https://code.google.com/p/ken-cc/ because this fork
of the Plan9 C compilers are easier to compile on non-plan9 OSes.

Then I installed plan9port which contained a few utilities that are used
when compiling the plan9 kernel (/bin/rc, /bin/mk).

Then I setup a few symlinks at the root e.g.

/lib -> /home/pad/plan9/root/lib
/386 -> /home/pad/plan9/root/386
/sys -> /home/pad/plan9/sys

Finally I have a env.sh that I source that contains important environment 
variables:
export KENCC=/home/pad/kencc
# need to modify plan9/src/cmd/mk/shell.c and put rcshell as default shell
export PLAN9=/usr/local/plan9

export PATH=$PLAN9/bin:$KENCC/bin:$PATH

#for 8._cp to be found and called
PATH=$PATH:.

export objtype=386
#export objtype=arm
export cputype=386

Then I did a few modifications to plan9 Labs and was able to compile and run 
everything
under qemu.

My forks:
https://github.com/aryx/fork-kencc
https://github.com/aryx/fork-plan9


On Jul 5, 2014, at 7:02 AM, Charles Forsyth 
mailto:charles.fors...@gmail.com>>
 wrote:


On 5 July 2014 14:13, Aleksandar Kuktin 
mailto:akuk...@gmail.com>> wrote:

Are there any pointers or short instructions or a HOWTO or something
similar on the art of cross-compiling Plan 9 from Linux?

It would be easier to compile using 9vx under Linux, or a virtual plan 9 
machine in qemu under Linux.
It is possible to cross-compile directly, but I've only built and used that 
environment twice myself
(once for Solaris, once for Linux), and it isn't any longer in any 
distributable shape. It might reappear
as a side effect of some work on the compiler suite. It's similar to the way 
Inferno's kernel is cross
compiled using the Plan 9 compilers hosted by some other OS, but needs a few 
special twists to
deal with the Plan 9 source tree.




Re: [9fans] Cross-compiling Plan 9

2014-07-07 Thread Yoann Padioleau
Hi,

Thx a lot Charles for 
https://code.google.com/p/ken-cc/<https://urldefense.proofpoint.com/v1/url?u=https://code.google.com/p/ken-cc/&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=%2FN9d7W2LRwZks3eyFNLr8Q%3D%3D%0A&m=kAvsCQ2h%2FsxAGKi2jv2IOZ6RdU94%2FThwCj1BUwwuHa8%3D%0A&s=6cc3a6fec9ae89696979739db03eef1df62ed849f99cc320c993d3897fc22f09>

The main issues I had were related to Rune incompatibilities. See:
https://github.com/aryx/fork-kencc/commit/67149c8a19d3dcccb303d9d8de4e679384ca1bf6
https://github.com/aryx/fork-kencc/commit/c0877323424a28e86352bbe172c5dad431441c53
https://github.com/aryx/fork-kencc/commit/160e42f7db33acc7b48e89d5999f5ec3a9c49993
...

On Jul 7, 2014, at 11:34 AM, Charles Forsyth 
mailto:charles.fors...@gmail.com>>
 wrote:


On 7 July 2014 18:41, Yoann Padioleau mailto:p...@fb.com>> wrote:

The first thing was to compile the plan9 C compilers
on MacOS. I used 
https://code.google.com/p/ken-cc/<https://urldefense.proofpoint.com/v1/url?u=https://code.google.com/p/ken-cc/&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=%2FN9d7W2LRwZks3eyFNLr8Q%3D%3D%0A&m=kAvsCQ2h%2FsxAGKi2jv2IOZ6RdU94%2FThwCj1BUwwuHa8%3D%0A&s=6cc3a6fec9ae89696979739db03eef1df62ed849f99cc320c993d3897fc22f09>
 because this fork
of the Plan9 C compilers are easier to compile on non-plan9 OSes.

I'm (slowly, as usual) bringing those up to date, and will include arm64.



Re: [9fans] Cross-compiling Plan 9

2014-07-14 Thread Yoann Padioleau
Yep, I did exactly the same. With kencc+a-few-patches+plan9port+few-symlinks
you can easily cross compile plan9.

See my kencc fork changes:
https://github.com/aryx/fork-kencc/commits/master
(and my fork 9 fork:
https://github.com/aryx/fork-plan9
)
On Jul 14, 2014, at 3:19 PM, David du Colombier 
<0in...@gmail.com> wrote:

Since I am building everything on Unix, and am using the Unix shell
(bash in my case), I had to rewrite much of the mkfile rules,
specifically ones that deal with loops, conditionals and substituting
outputs from commands. Because all those rules are simple, this was a
trivial task. I also needed to change sed programs embedded all over
the place to be understandable to my systems sed.

If you use plan9port's mk, you can define MKSHELL=rc in the
mkfiles, instead of translating them to bash.

In the same way, you can place $PLAN9/bin at the beginning of
your PATH to use plan9port's sed instead of the Unix one.

In my side, I also tried to compile the Plan 9 programs and
libraries on Unix using Charles' toolchain. It was working
pretty fine. The main issue I encountered was the lack of
support for long Runes in his version.

Thus, I simply copied the related code from Plan 9:

https://urldefense.proofpoint.com/v1/url?u=http://www.9legacy.org/9legacy/patch/kencc-rune.diff&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=%2FN9d7W2LRwZks3eyFNLr8Q%3D%3D%0A&m=aLQhZbTqEOAyTguyZu3l8YOQdmbEXDfuDYgNH8idwCE%3D%0A&s=a9410420e661f42c32ce304cfe6fe28914154e91a65bd7c1c9e5f0f341b0b146

--
David du Colombier




[9fans] simplest disk filesystem

2014-07-15 Thread Yoann Padioleau
Hi,

What is the simplest storage filesystem in terms of code size in plan9?
I’m looking for a very simple in-kernel filesystem. Maybe older version of plan9
was including such a filesystem? On Linux for instance the minixfs was probably
the simplest filesystem. The dos must also be simple but it’s currently a 
fileserver
which makes it sligtly more complicated.


Re: [9fans] simplest disk filesystem

2014-07-15 Thread Yoann Padioleau
But I would like something that actually can persist … a real but simple storage
persistent filesystem.

On Jul 15, 2014, at 10:57 AM, andrey mirtchovski  wrote:

> /sys/src/cmd/ramfs.c?
> 
> On Tue, Jul 15, 2014 at 11:53 AM, Yoann Padioleau  wrote:
>> Hi,
>> 
>> What is the simplest storage filesystem in terms of code size in plan9?
>> I’m looking for a very simple in-kernel filesystem. Maybe older version of 
>> plan9
>> was including such a filesystem? On Linux for instance the minixfs was 
>> probably
>> the simplest filesystem. The dos must also be simple but it’s currently a 
>> fileserver
>> which makes it sligtly more complicated.
> 




Re: [9fans] simplest disk filesystem

2014-07-15 Thread Yoann Padioleau
I’m trying to make a tutorial explaining the code of a not too large kernel
(9), but there are too many things to explain so I have to cut things.
So having a simple fs which does not require to explain
9p, the rpc, the mount device, etc would be great.
I know that explaining plan9 without 9p is kinda nonsense, but I would
do that in another tutorial.

On Jul 15, 2014, at 1:52 PM, Brian L. Stuart  wrote:

>> I’m looking for a very simple in-kernel filesystem.
> 
> What's motivating the desire for to be in-kernel?  Nearly,
> every file system in Plan 9 runs in user space.  All the
> ones that have been mentioned do.  The only in-kernel
> file system in the labs' distribution is devroot which is
> read-only and intended only to provide enough bits to
> get the system up and running.  9atom also includes
> a devtinyfs that you could take a look at.
> 
> BLS
> 
> 




Re: [9fans] simplest disk filesystem

2014-07-16 Thread Yoann Padioleau

Yes, maybe you’re right :) I’ll probably stick to the idea on just focus on 
devroot.c as someone suggested.

On Jul 16, 2014, at 11:17 AM, s...@9front.org wrote:

> It just seems like creating a fake os (as in, no one even intends
> to use this os) from scratch in order to explain a real os (as in,
> the goal is to finally understand or at least use this os) makes
> things even more difficult to understand.
> 
> sl
> 




Re: [9fans] Brasil

2014-07-18 Thread Yoann Padioleau
I thought it was the old name of plan9:

http://swtch.com/plan9history/?p=1999/1031;v=difflist


On Jul 17, 2014, at 6:27 PM, Shane Morris 
mailto:edgecombe...@gmail.com>> wrote:

Hello 9fans,

I've been doing some research, and come across Brasil, which, if I've got this 
right, was a co-operating system minimal Inferno layer used on the Blue Gene/L 
project. Now, if I've got that wrong, please tell me...!

This interests me, of course, as I prepare to bring up my Parallella board (I 
still need a fan for it - tsk tsk). Is there any source for Brasil available to 
the public, as my Google searches isn't showing any repos (but I did get this: 
http://graverobbers.blogspot.com.au/2009/05/few-words-on-brasil.html)?
 I understand the project to the Blue Gene/L was many years ago, and all of the 
IBM references on their website seem to have disappeared in the interim.

Many thanks!

Shane.



Re: [9fans] Announcing The Virtual Plan 9 Server Cookbook

2014-08-29 Thread Yoann Padioleau
This is great. Pdf please!

On Aug 28, 2014, at 9:59 PM, Scott Elcomb  wrote:

> On Thu, Aug 28, 2014 at 9:25 AM, David L. Craig  wrote:
>> If a lot of people think CSS-challenged newbies
>> would have a better experience with a default black-on-white
>> presentation, I'll go with that.
> 
> Thanks for writing this up; very much looking forward to working through it. 
> =)
> 
> I found the colours a bit difficult as well so I've mirrored the
> package in black-on-white at
> .
> 
> Planning to run it through 
> 
>  to
> convert to pdf & epub when time permits.
> 
> Best,
> -- 
>  Scott Elcomb @psema4
>  
> https://urldefense.proofpoint.com/v1/url?u=http://psema4.com/pubkey.txt&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=%2FN9d7W2LRwZks3eyFNLr8Q%3D%3D%0A&m=DJPJ2GNPQN8FPmxmFDuC1TX0xqlqFxi3B9jNEeFj1rM%3D%0A&s=9135e91804ab223fdd94969c5f9785b60e4009f21a8e29da2434da41ef466cf6
> 
> https://urldefense.proofpoint.com/v1/url?u=http://www.pirateparty.ca/&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=%2FN9d7W2LRwZks3eyFNLr8Q%3D%3D%0A&m=DJPJ2GNPQN8FPmxmFDuC1TX0xqlqFxi3B9jNEeFj1rM%3D%0A&s=18ff91b0303d0079908a6b03a2fefb9bed7b71ac41babe52161f20aa9d847798
> 




[9fans] copy paste bug in cc.y?

2014-10-14 Thread Yoann Padioleau
Hi,

It’s a copy paste bug here right?
https://code.google.com/p/ken-cc/source/browse/src/cmd/cc/cc.y#476


|   LSWITCH '(' cexpr ')' stmnt

{

$$ = new(OCONST, Z, Z);

$$->vconst = 0;

$$->type = types[TINT];

$3 = new(OSUB, $$, $3);



$$ = new(OCONST, Z, Z);

$$->vconst = 0;

$$->type = types[TINT];

$3 = new(OSUB, $$, $3);



$$ = new(OSWITCH, $3, $5);

}




Re: [9fans] copy paste bug in cc.y?

2014-10-17 Thread Yoann Padioleau
Somehow?

Would be nice to have a comment explaining this “somehow" then
because it looks tricky.

Also is there a place explaining the naming conventions?
I have a hard time understanding what is the difference
between tcom(), acom(), xcom(), and then there’s  complex() …


On Oct 14, 2014, at 5:50 PM, Rob Pike 
mailto:robp...@gmail.com>> wrote:

It's not dead code. It's prepping the switch somehow.

-rob


On Tue, Oct 14, 2014 at 3:45 PM, Rob Pike 
mailto:robp...@gmail.com>> wrote:
Looks like it.

-rob


On Tue, Oct 14, 2014 at 3:11 PM, Yoann Padioleau 
mailto:p...@fb.com>> wrote:
Hi,

It’s a copy paste bug here right?
https://code.google.com/p/ken-cc/source/browse/src/cmd/cc/cc.y#476<https://urldefense.proofpoint.com/v1/url?u=https://code.google.com/p/ken-cc/source/browse/src/cmd/cc/cc.y%23476&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=%2FN9d7W2LRwZks3eyFNLr8Q%3D%3D%0A&m=4cyv139G%2BaY3rKB1R87WcxrtStd7gWlsDg4w5ndKAww%3D%0A&s=0dfb82e35769784cecce2b03828c23174d1f09519028880890cc63d7dd24265c>


|   LSWITCH '(' cexpr ')' stmnt

{

$$ = new(OCONST, Z, Z);

$$->vconst = 0;

$$->type = types[TINT];

$3 = new(OSUB, $$, $3);



$$ = new(OCONST, Z, Z);

$$->vconst = 0;

$$->type = types[TINT];

$3 = new(OSUB, $$, $3);



$$ = new(OSWITCH, $3, $5);

}







[9fans] kencc benchmark vs gcc

2014-10-17 Thread Yoann Padioleau
Hi,

Is there any benchmark results comparing kencc (e.g. 8c) vs gcc, clang, etc?
I’m interested mainly in the speed of the generated code, not so much in the
time it takes to compile something.





Re: [9fans] copy paste bug in cc.y?

2014-10-17 Thread Yoann Padioleau

0:int - x   was not enough for those balancing(?) and promoting thing?


On Oct 17, 2014, at 12:07 PM, Charles Forsyth 
mailto:charles.fors...@gmail.com>> wrote:

it's building a tree for (0:int-(0:int-x)) which later transformations will 
simplify to x, but having done "the usual arithmetic conversions"
balancing and promoting 0s and x as required, if it's char/int/long/vlong.



Re: [9fans] copy paste bug in cc.y?

2014-10-17 Thread Yoann Padioleau
:) Got it :)

On Oct 17, 2014, at 1:04 PM, minux 
mailto:minux...@gmail.com>> wrote:


On Fri, Oct 17, 2014 at 4:00 PM, Yoann Padioleau 
mailto:p...@fb.com>> wrote:
0:int - x   was not enough for those balancing(?) and promoting thing?
It's enough for type promotion, but you changed the semantics of the program.



Re: [9fans] gsoc reunion

2014-10-20 Thread Yoann Padioleau
Hi,

What is this event? When exactly and where it is? Might be nice to meet
some other plan9 enthousiasts.

On Oct 18, 2014, at 9:10 AM, yy  wrote:

> Is anybody going to the GSoC reunion organized by Google next weekend
> in San Jose? I will be there from Thursday to Sunday. Let me know if
> you want to meet.
> 
> 
> -- 
> - yiyus || JGL .
> 




Re: [9fans] copy paste bug in cc.y?

2014-10-21 Thread Yoann Padioleau

but (0:int + x)   would not do the same thing? What is special about using SUB 
instead
of ADD?


On Oct 17, 2014, at 12:07 PM, Charles Forsyth 
mailto:charles.fors...@gmail.com>> wrote:


On 17 October 2014 18:48, Yoann Padioleau mailto:p...@fb.com>> 
wrote:
Somehow?

Would be nice to have a comment explaining this “somehow" then
because it looks tricky.

it's building a tree for (0:int-(0:int-x)) which later transformations will 
simplify to x, but having done "the usual arithmetic conversions"
balancing and promoting 0s and x as required, if it's char/int/long/vlong.



Re: [9fans] Porting plan9

2014-12-02 Thread yoann padioleau
I think one of the reason 9load is quite complicated is because
they wanted to boot a kernel from the network, so you need a network stack and 
the drivers for the ethernet card, so you really need lots of OS code in the 
end.

On Dec 2, 2014, at 2:28 PM, Enrico Weigelt, metux IT consult 
 wrote:

> On 02.12.2014 23:02, Iruatã Souza wrote:
> 
>>> apropos kernel/bootloader: I just recently had a look at the code
>>> and somewhat got the impression that 9load seems to be a specially
>>> tailored plan9 kernel, which then loads the real kernel.
>>> 
>>> is that correct or am I mistaken here ?
>> 
>> Correct.
> 
> hmm, interesting.
> 
> What's the exact reason behind that ?
> 
> I'm really not an expert for bootloaders, but I always got the
> impression, that bootloaders need to be extremly minimal (eg. on
> PC you'll have only about 0.5k for the first stage) and serve an
> entirely different purpose than an OS kernel.
> 
> OTOH, having a complete OS/Kernel as preboot environment of course
> also has it's charm - allows easily adding lots of setup things,
> even rescue stuff, etc.
> 
> Can 9front also boot other operating systems, eg. Linux ?
> Could it become a replacement for other bootloaders like grub ?
> 
> 
> cu
> --
> Enrico Weigelt,
> metux IT consulting
> +49-151-27565287
> 




Re: [9fans] plan 9 on github

2014-12-08 Thread yoann padioleau
This is great! Thx!

I had a few bug reports on the kernel that I think
never got included in the mainline plan9. Should I make pull requests? Is there 
anyway this github repo could be synchronized with the main plan9-labs repo?


On Dec 8, 2014, at 11:52 AM, David du Colombier <0in...@gmail.com> wrote:

>> You could have used --aggressive garbage collection,
>> it reduces the package to exactly 100MB.
> 
> Yes. Unfortunately, this is too late for the GitHub
> repository now. On the other side, it would be only
> 10 MB smaller.
> 
> -- 
> David du Colombier
> 




[9fans] memory bug in 5l

2014-12-09 Thread yoann padioleau
in 5l/obj.c#zaddr()
there is:
case D_FCONST:
while(nhunk < sizeof(Ieee))
gethunk();
a->ieee = (Ieee*)hunk;
nhunk -= NSNAME;
hunk += NSNAME;

I think it’s a copy paste bug, it should
be sizeof(Ieee) instead of those NSNAME
(or even better the whole code could be factorized
in a call to a->ieee = malloc(sizeof(Ieee));




Re: [9fans] memory bug in 5l

2014-12-09 Thread yoann padioleau
Also, by curiosity, does anybody know why 5a/, 5l/, 5c/
(and the other architecture variants) are redefining
malloc and free? Why not using the malloc and free
from the libc?


On Dec 9, 2014, at 4:21 PM, yoann padioleau  wrote:

> in 5l/obj.c#zaddr()
> there is:
>   case D_FCONST:
>   while(nhunk < sizeof(Ieee))
>   gethunk();
>   a->ieee = (Ieee*)hunk;
>   nhunk -= NSNAME;
>   hunk += NSNAME;
> 
> I think it’s a copy paste bug, it should
> be sizeof(Ieee) instead of those NSNAME
> (or even better the whole code could be factorized
> in a call to a->ieee = malloc(sizeof(Ieee));
> 




Re: [9fans] memory bug in 5l

2014-12-09 Thread yoann padioleau
There is a related bug still in this file in ldobj() I think:

if(nhunk < sizeof(Prog))
gethunk();
p = (Prog*)hunk;
nhunk -= sizeof(Prog);
hunk += sizeof(Prog);

it should be while(chunk < sizeof(Prog))
(or even better again, a simple call to malloc(sizeof(Prog))


On Dec 9, 2014, at 4:21 PM, yoann padioleau  wrote:

> in 5l/obj.c#zaddr()
> there is:
>   case D_FCONST:
>   while(nhunk < sizeof(Ieee))
>   gethunk();
>   a->ieee = (Ieee*)hunk;
>   nhunk -= NSNAME;
>   hunk += NSNAME;
> 
> I think it’s a copy paste bug, it should
> be sizeof(Ieee) instead of those NSNAME
> (or even better the whole code could be factorized
> in a call to a->ieee = malloc(sizeof(Ieee));
> 




Re: [9fans] memory bug in 5l

2014-12-15 Thread yoann padioleau
Right, but the same code in 8l does the while
loop, and most of the code in 5l does the while loop,
so for consistency it seems it should also be a while loop
here.


On Dec 10, 2014, at 2:07 AM, Charles Forsyth  wrote:

> 
> On Wed, Dec 10, 2014 at 1:19 AM, yoann padioleau  
> wrote:
> it should be while(chunk < sizeof(Prog))
> 
> a hunk is always much bigger than sizeof(Prog) so it's the same as if



[9fans] setitimer equivalent

2015-04-28 Thread yoann padioleau
Hi,

I’m trying to port some code to plan9 using APE
but I can’t find the setitimer function in any include/ape/ files.
What is the equivalent to setitimer under plan9?




Re: [9fans] setitimer equivalent, and sigvtalarm equivalent

2015-04-30 Thread yoann padioleau
Hi,

I’m not sure I understand your proposal.

But looking more at the code I need to port, an interpreter, I think
the main issue is that the interpreter relies on sigvtalarm as
a way to preempt the interpreted program while allowing
the user program to use only sigalarm. So more generally
the problem is how can I have two alarms in plan9? I see only
one alarm signal in ape, SIGALRM. There is no SIGVTALRM.



> On Apr 29, 2015, at 9:47 AM, erik quanstrom  wrote:
> 
> On Tue Apr 28 21:30:24 PDT 2015, aryx.pada...@gmail.com wrote:
>> Hi,
>> 
>> I’m trying to port some code to plan9 using APE
>> but I can’t find the setitimer function in any include/ape/ files.
>> What is the equivalent to setitimer under plan9?
> 
> if you're ok on using nsec() as your time source, select(3) as posix would
> have it, will do.
> 
> - erik
> 




Re: [9fans] setitimer equivalent, and sigvtalarm equivalent

2015-05-02 Thread yoann padioleau
Hi,

Yes I think you’re right. Indeed the machine has one
timer interrupt and it’s enough for the kernel to demultiplex
it over many processes who each can have different alarm
requirments.

Thx.

> On May 2, 2015, at 8:06 AM, erik quanstrom  wrote:
> 
>> I’m not sure I understand your proposal.
>> 
>> But looking more at the code I need to port, an interpreter, I think
>> the main issue is that the interpreter relies on sigvtalarm as
>> a way to preempt the interpreted program while allowing
>> the user program to use only sigalarm. So more generally
>> the problem is how can I have two alarms in plan9? I see only
>> one alarm signal in ape, SIGALRM. There is no SIGVTALRM.
> 
> the standard way to do this is as the kernel does.  the kernel typically
> keeps one highres timer (per core), and a linked list of events sorted by 
> alarm
> time.  when the alarm fires, do the action associated with each alarm that has
> passed and reload periodic timers.  this is in port/portclock.c.  i'm sure 
> there
> are implementations of this algorithm elsewhere, too.
> 
> - erik
> 




[9fans] bug in network stack regarding Ipht

2015-06-08 Thread yoann padioleau
Hi,

I think I’ve found a bug in the network stack.
in 9/ip/ip.h there is
struct Ipht
{
Lock;
Iphash  *tab[Nipht];
};

where Night is 521,

but then in 9/ip/ipaux.c there is

ulong
iphash(uchar *sa, ushort sp, uchar *da, ushort dp)
{
return ((sa[IPaddrlen-1]<<24) ^ (sp << 16) ^ (da[IPaddrlen-1]<<8) ^ dp 
) % Nhash;
}

where Nhash is just 64,

so lots of entries in Ipht.tab will never be used. This slows down every 
ip+port lookups in the UDP and TCP code.





[9fans] website

2015-10-29 Thread yoann padioleau
The website is down?





[9fans] fail to crosscompile Rasperry Pi Miller's kernel

2017-01-13 Thread yoann padioleau
Hi,

I am trying to compile the plan9 kernel for the Rasperry pi
from Richard Miller. I am using from MacOSX the kencc toolchain
https://code.google.com/hosting/moved?project=ken-cc 

now
https://bitbucket.org/plan9-from-bell-labs/9-cc/ 

(actually I use my own simplified fork:
https://github.com/aryx/fork-kencc 
)

I am able to compile/link the default bcm/ kernel
with this distribution: https://github.com/0intro/plan9/ 

I am also able to compile/link the latest kernel from richard miller
http://9p.io/magic/webls?dir=/sources/contrib/miller/9/bcm 


The problem is that when I boot it on my physical Raspberry Pi 1,
I just get a blue screen. I don’t get the Plan9 console greeting,
nothing.

The call to fbinit in bcm/vcore.c is working because
the memset in fbinit is working (hence the blue screen).
But calls following fbinit do not work. I tracked it down
to a call to malloc() in allocmemimage in libmemdraw.
In fact, if I do a call to malloc() in main.c before the call to
screeninit, nothing works (I get a gradient picture on the screen).

Does any of you have any idea what could be the cause of the problem? The 
linker 5l in kencc does not support the -f linking option, but I think none of 
the code in pool.c or libmemdraw use float/double at this point.
Is there some important patches to 5l or 5c I am missing in kencc/? 

Note that the 9pi image at http://9p.io/magic/webls?dir=/sources/contrib/miller 
 is working on my 
Raspberry Pi. So this is not a problem in my Raspberry. I am also using the 
official plan9 distribution https://github.com/0intro/plan9/ 
 from Jan 2015, so I guess the problem has to 
be in kencc/.









Re: [9fans] fail to crosscompile Rasperry Pi Miller's kernel

2017-01-16 Thread yoann padioleau
Without -f I was able to get something on the screen.
The code in libdraw and libmemdraw does not use floats.
But I was having weird failures in malloc.

I updated my kencc fork to the latest version
and now everything works!
The problem apparently was more related to 5c than 5l.
I updated 5l to support -f but I still had the problem.
After updating 5c then everything worked.


> On Jan 15, 2017, at 4:11 PM, erik quanstrom  wrote:
> 
>> Does any of you have any idea what could be the cause of the problem?
>> The linker 5l in kencc does not support the -f linking option, but I think 
>> none
>> of the code in pool.c or libmemdraw use float/double at this point.
>> Is there some important patches to 5l or 5c I am missing in kencc/? 
> 
> i think your source is out-of-sync:
> 
> -f (5l only) Generate VFP hardware floating-point
> instructions.  Without this option, 5l generates
> arm7500 floating-point instructions which are emu-
> lated in the kernel.
> 
> i would imagine that your machine may have booted (the kernel does not use 
> floating point),
> but you can't see the screen.  if you set up a cpu server, there's a good 
> chance it will be
> accessable.
> 
> - erik




[9fans] coherence function in kernel (especially in raspberry pi port)

2017-03-30 Thread yoann padioleau
Hi,

What is exactly the logic of the calls to coherence?
When do we need to call coherence in the kernel?
For example I see this code in bcm/taslock.c

coherence();
l->key = 0;
coherence();

bcm/taslock.c seems actually mostly a copy paste of port/taslock.c
with an extra call to coherence before the assignment above.

Also, in the code of coherence for ARM, 
what is the meaning of the instructions ISB and DSB?
The I and D seems to corrrespond to instruction vs data cache,
but I fail to understand the meaning of S and B.





[9fans] qemu and networking

2014-01-07 Thread Yoann Padioleau
Hi,

I've installed plan9 on a plan9.raw.img file via qemu and I'm able to boot on 
it.
How can I transfer files between plan9 and my host (I'm under macos)?
I've followed 
http://plan9.bell-labs.com/wiki/plan9/installing_plan_9_on_qemu/index.html
and run


qemu -hda Plan9.qcow2.img -net nic -net user

but from plan9 when I do

 rc> ip/ping 10.0.2.2 nothing happens.




[9fans] mechanism to bind partitions in /dev?

2014-01-17 Thread Yoann Padioleau
Hi,

Can someone explain how the partitions in /dev/sdC0/xxx are populated? Who
create those device files? I have a small plan9 kernel running a small shell 
(sh.Z)
in memory and when I do  'bind #S/sdC0 /dev/' I just see the 'data', 'ctl', and 
'raw' files.
There is no 9fat or plan9 or whatever partitions there is on this disk. In fact 
I've
tried to make on MACos via the Utility disk some fat images and when I do 
qemu -hdb dosdisk.img I can not access again the fat partition on this disk
(I've tried dossrv and then mount /srv/dos/ /mnt #sdC1/data but it does not 
work).
I can access it though when it's on a floppy disk (mount /srv/dos /mnt 
/dev/fd0disk
works). How fd0disk is different from #sdC1/data?





Re: [9fans] mechanism to bind partitions in /dev?

2014-01-18 Thread Yoann Padioleau
Got it, thx a lot.
Just need to do  fdisk -p /dev/sdC0/data > /dev/sdC0/ctl
and then prep -p /dev/sdC0/plan9 > /dev/sdC0/ctl


On Jan 17, 2014, at 11:17 PM, Bruce Ellis 
mailto:bruce.el...@gmail.com>> wrote:

disk/prep (and it's mates) are what you need for sdC0. man 8 prep.

brucee


On 18 January 2014 17:57, Yoann Padioleau mailto:p...@fb.com>> 
wrote:
Hi,

Can someone explain how the partitions in /dev/sdC0/xxx are populated? Who
create those device files? I have a small plan9 kernel running a small shell 
(sh.Z)
in memory and when I do  'bind #S/sdC0 /dev/' I just see the 'data', 'ctl', and 
'raw' files.
There is no 9fat or plan9 or whatever partitions there is on this disk. In fact 
I've
tried to make on MACos via the Utility disk some fat images and when I do
qemu -hdb dosdisk.img I can not access again the fat partition on this disk
(I've tried dossrv and then mount /srv/dos/ /mnt #sdC1/data but it does not 
work).
I can access it though when it's on a floppy disk (mount /srv/dos /mnt 
/dev/fd0disk
works). How fd0disk is different from #sdC1/data?







[9fans] about KTZERO mismatch in mkfile and mem.h

2014-01-20 Thread Yoann Padioleau
Hi,

in 9/pc/mem.h it says:
/*
 *  Address spaces
 */
#define KZERO   0xF000  /* base of kernel address space 
*/
#define KTZERO  (KZERO+0x10)/* first address in kernel text 
- 9load sits below */


and in 9/pc/mkfile:
# must match mem.h
APBOOTSTRAP=0xF0003000
KTZERO=0xF0100020


so why the difference? what is this additional 20 for KTZERO?




[9fans] networking, qemu, and telnet

2014-01-24 Thread Yoann Padioleau
Hi,

I'm able to ping from plan9 the host (the macos machine running qemu).
After
% ip/ipconfig
% ndb/dns -r

I have something in /net/ndb
and running ndb/dnsquery
and entering address like www.google.com works.

ip/ipconfig 10.0.2.2
also works which is great.

Now I would like to do some very basic test by from plan9 telneting into the 
host.
But when I do
% telnet 10.0.2.2
I get
telnet: tcp!10.0.2.2!telnet: net unreachable.

Note that telnetd is running on my macos for sure
(I've run sudo -s launchctl load -w /System/Library/LaunchDaemons/telnet.plist)
and on macos doing in a terminal  telnet localhost does working.

So what do I need to be able to telnet from my plan9 to my host (macos) telnetd?







Re: [9fans] networking, qemu, and telnet

2014-01-24 Thread Yoann Padioleau
> 
> ip/ipconfig 10.0.2.2
> also works which is great.

Sorry, I meant ip/ping 10.0.2.2 works

> 
> Now I would like to do some very basic test by from plan9 telneting into the 
> host.
> But when I do
> % telnet 10.0.2.2
> I get
> telnet: tcp!10.0.2.2!telnet: net unreachable.
> 
> Note that telnetd is running on my macos for sure
> (I've run sudo -s launchctl load -w 
> /System/Library/LaunchDaemons/telnet.plist)
> and on macos doing in a terminal  telnet localhost does working.
> 
> So what do I need to be able to telnet from my plan9 to my host (macos) 
> telnetd?
> 
> 
> 
> 




Re: [9fans] networking, qemu, and telnet

2014-01-24 Thread Yoann Padioleau
net unreachable,
same than with the telnet command.

On Jan 24, 2014, at 7:44 PM, Skip Tavakkolian 
mailto:skip.tavakkol...@gmail.com>>
 wrote:

con tcp!host!telnet



On Fri, Jan 24, 2014 at 6:23 PM, Yoann Padioleau 
mailto:p...@fb.com>> wrote:
>
> ip/ipconfig 10.0.2.2
> also works which is great.

Sorry, I meant ip/ping 10.0.2.2 works

>
> Now I would like to do some very basic test by from plan9 telneting into the 
> host.
> But when I do
> % telnet 10.0.2.2
> I get
> telnet: tcp!10.0.2.2!telnet: net unreachable.
>
> Note that telnetd is running on my macos for sure
> (I've run sudo -s launchctl load -w 
> /System/Library/LaunchDaemons/telnet.plist)
> and on macos doing in a terminal  telnet localhost does working.
>
> So what do I need to be able to telnet from my plan9 to my host (macos) 
> telnetd?
>
>
>
>






Re: [9fans] Raspberry Pi image

2014-02-18 Thread Yoann Padioleau
Yes, thx Richard.

But how this image was produced? just mk in the sys/src/9/bcm/ 
official plan9 distribution or do you have a custom plan9?

On Feb 18, 2014, at 1:05 PM, Richard Miller <9f...@hamnavoe.com>
 wrote:

>> Thank you for creating the Raspberry Pi port.  I had always wanted to
>> use Plan 9, but I was not able to until this port was created, because
>> I didn't have any compatible hardware.
> 
> Yes, that's why I did it -- to give people a low-cost way to try Plan 9,
> and also to give Plan 9 users a way to try the Raspberry Pi.  I'm glad
> to know it's been useful.
> 
>