Re: [9fans] imagereclaim()

2014-03-02 Thread Charles Forsyth
On 2 March 2014 03:55, cinap_len...@felloff.net wrote:

 checked nix/port/page.c. your duppage() is wrong.


It isn't needed at all. When a cached page is written, it's trying hard to
replace the page in the cache by a new copy,
to return the previously cached page. Instead, I copy the cached page and
return the copy, which is what it already
does in another instance. In the current version, not yet available (but
soon), I do away with the page hash
table entirely, so there's nowhere for the page hash chains to accumulate.
Page is smaller and simpler, with
a reference count but no lock.


Re: [9fans] Raspberry Pi: won't recognize the USB mouse

2014-03-02 Thread Richard Miller
 PFU HHKB2Lite
 old iMac usb keyboard c. 2001
 Apple 'Pro' keyboard, c. 2004
 
 these two work for me using the modifications here:
   http://9fans.net/archive/2014/02/202
 setting the langid is critical for some keyboards.

I've just tried Erik's usbd with a 2003 iMac keyboard:

usbotg: ep6.0 error intr 0402
usbotg: ep6.0 error intr 0402
usbotg: ep6.0 error intr 0402
usbotg: ep6.0 error intr 0402
usbotg: ep6.0 error intr 0402
usbotg: ep6.0 error intr 0402
usbotg: ep6.0 error intr 0402
usbotg: ep6.0 error intr 0402
/boot/usbd: loaddevconf: bug: out of configurations in device

0402 is Data Toggle Error + Channel Halted.

Erik, have you maybe changed something in the bcm kernel usb driver too
which makes it work for you?




Re: [9fans] Raspberry Pi: won't recognize the USB mouse

2014-03-02 Thread erik quanstrom
 I've just tried Erik's usbd with a 2003 iMac keyboard:
 
 usbotg: ep6.0 error intr 0402
 usbotg: ep6.0 error intr 0402
 usbotg: ep6.0 error intr 0402
 usbotg: ep6.0 error intr 0402
 usbotg: ep6.0 error intr 0402
 usbotg: ep6.0 error intr 0402
 usbotg: ep6.0 error intr 0402
 usbotg: ep6.0 error intr 0402
 /boot/usbd: loaddevconf: bug: out of configurations in device
 
 0402 is Data Toggle Error + Channel Halted.
 
 Erik, have you maybe changed something in the bcm kernel usb driver too
 which makes it work for you?

well, not directly.  later today, i will haul out my keyboard, retest and
post the results with whatever numbers are on the back of the kbd.

the only salient difference i see is that Spawndelay=250 rather than
100 in usbd.  i didn't have a specific reason for leaving it at 250
but since connecting is in human time scales, 100ms seemed
shorter than necessary to seem snappy.  could that be it?

also, according to the linux kernel, we should not be looking for
configurations on anything that's not a hub.  i have't looked into
this further than confirming that usb/kb calls startdevs - opendev
- loaddevconf.

(speaking of which, is the configuration error on the hub in the
keyboard, or the keyboard device itself?)

if you'd like, i can put up the kernel i'm using, which takes root
from the net.  i can do that later today.  i want to make sure to
copy it off the tested machine.

- erik



[9fans] cpp bug

2014-03-02 Thread erik quanstrom
david hoskin found a bug in cpp.  - is evaluated right to left, so
it computes the wrong result.  for example

# if 0 - 0 + 4 != 4
# error bogus preprocessor
# endif

errors, because cpp computes this as if it were

# if 0 - (0 + 4) != 4

this is because it evaluates right to left, not right to left.  it turns
out this is because the evalop uses  rather than = as the
pop (loop) condition for the prec stack.  thus a + b + c
will push to the end then pop from the right.

while the according-to-hoyle fix is to change  to =, this was
done on purpose.  it allows symbols that need no eval to be
omitted.  it would be a major rework to change this assumption.

so the hack-upon-hack solution might be to just convert - to
+ UMINUS(thing).  this is going to cause trouble if someone
is doing fancy arithmetic with division and counting on
non-underflow.

here is the diff that works on the test cases, and on everything
in /sys/src/cmd/ape.  is this acceptable?

- erik


chula; 9diff eval.c
/n/sources/plan9/sys/src/cmd/cpp/eval.c:122,127 - eval.c:122,128
op = ops;
*op++ = END;
for (rand=0, tp = trp-bp+ntok; tp  trp-lp; tp++) {
+   retry:
if(op = ops + NSTAK)
sysfatal(cpp: can't evaluate #if: increase NSTAK);
switch(tp-type) {
/n/sources/plan9/sys/src/cmd/cpp/eval.c:161,166 - eval.c:162,173
}
continue;
}
+   if(tp-type==MINUS){
+   *op++ = UMINUS;
+   tp-type = PLUS;
+   goto retry;
+   }
+   
/* flow through */
  
/* plain binary */



[9fans] Bell usb keys boot fails

2014-03-02 Thread Adriano Verardo

Hi, all

The Bell usb image doesn't boot on some (IMHO) very common machines.
Screenshots available on

https://plus.google.com/communities/114338091970720321008?partnerid=ogpy0

adriano



Re: [9fans] imagereclaim()

2014-03-02 Thread cinap_lenrek
you'r right. the smartness of duppage() isnt really neccesary. we
can just leave the cache alone. when memory is low, newpage() will
uncache pages for us.

fixfault():
...
lkp = *pg;
lock(lkp);
if(lkp-ref == 0)
panic(fault %#p ref == 0, lkp);
if(lkp-ref == 1  lkp-image == nil) {
unlock(lkp);
} else if(lkp-image == swapimage  (lkp-ref + 
swapcount(lkp-daddr)) == 1) {
uncachepage(lkp);
unlock(lkp);
} else {
unlock(lkp);
new = newpage(0, s, addr);
if(s == 0)
return -1;
*pg = new;
copypage(lkp, *pg);
putpage(lkp);
}
mmuphys = PPN((*pg)-pa) | PTEWRITE | PTEVALID;
(*pg)-modref = PG_MOD|PG_REF;
break;

--
cinap



Re: [9fans] imagereclaim()

2014-03-02 Thread Charles Forsyth
On 2 March 2014 18:46, cinap_len...@felloff.net wrote:

 you'r right. the smartness of duppage() isnt really neccesary. we
 can just leave the cache alone. when memory is low, newpage() will
 uncache pages for us.


I also ripped out all the swap stuff. Either I'm on a machine with at last
a Gb or two of RAM, or it's embedded
and there's no paging disk, or both.


Re: [9fans] Raspberry Pi: won't recognize the USB mouse

2014-03-02 Thread Richard Miller
 also, according to the linux kernel, we should not be looking for
 configurations on anything that's not a hub.

Personally I wouldn't look to the linux kernel as guidance for
correct behaviour.  Especially when there's a published specification
available.

Every usb device has at least one configuration descriptor.  The usb
spec allows for more than one, with a well-defined method for choosing
between them (not supported by plan 9 usb infrastructure).  In
practice though, it seems common for devices to ignore this and use some
bizarre proprietary and undocumented way to switch configurations instead.
Hence the need for abominations like the linux usb_modeswitch utility.




[9fans] How to find or build 9pxeload?

2014-03-02 Thread Peter Hull
 Hi all,
I was looking at booting via PXE (this is all just on Virtual Box
VMs). I need to provide a 9pxeload in the boot process but I can't
find it in my distribution and I can't understand how to build it. I
looked in the source tree but 9pxeload doesn't seem to be a target in
the makefile.

How can I build 9pxeload? (I am using plan 9 from Bell Labs, not
9front or 9atom)

Thanks,
Peter



Re: [9fans] How to find or build 9pxeload?

2014-03-02 Thread David du Colombier
 How can I build 9pxeload?

9pxeload has been replaced by 9boot since the new boot loader
replaced the old one in the distribution in May 2012.

-- 
David du Colombier



Re: [9fans] How to find or build 9pxeload?

2014-03-02 Thread peterhull90
OK, brilliant, thanks for the swift reply. I didn’t see that written down 
anywhere!

Pete








From: David du Colombier
Sent: ‎Sunday‎, ‎2‎ ‎March‎ ‎2014 ‎21‎:‎53
To: 9fans@9fans.net





 How can I build 9pxeload?

9pxeload has been replaced by 9boot since the new boot loader
replaced the old one in the distribution in May 2012.

-- 
David du Colombier

Re: [9fans] imagereclaim()

2014-03-02 Thread Anthony Martin
Charles Forsyth charles.fors...@gmail.com once said:
 I also ripped out all the swap stuff. Either I'm on a machine with at last
 a Gb or two of RAM, or it's embedded
 and there's no paging disk, or both.

What do you do when you're out of memory? Panic?
Do you still have something like the kickpager in
nix?

  Anthony



Re: [9fans] Raspberry Pi: won't recognize the USB mouse

2014-03-02 Thread Winston Kodogo
I'm not sure if this is helpful at this, or indeed any, stage in the
conversation, but for me one of the great joys of using Richard's port has
been that it just works on real hardware without having to mess about, or
having to worry about esoterica about USB and chums. At least they're
esoterica to me as a Windows programmer. A few weeks back I was handed a pi
at work, which is in the antipodes where the current flows in the other
direction. I powered it via USB using the mains adapter that came with my
iPod (which provides 2.1A at 5+ volts, although the 1A version that comes
with the iPad mini also works fine)  plugged in a keyboard or two that were
lying around (Logitech K120 and some random Dell keyboard worked equally
well), plugged in a really cheap spare Logitech mouse that was also just
lying around, attached a random monitor borrowed from the IT guys
downstairs using an HDMI to DVI cable, and it all just worked. So my
feeling, based on cop instinct, as Steve McGarrett used to say, is Book
him, Dano. Oops, no, sorry, that was wrong. Book a mains USB power
adapter, Dano, and borrow or scrounge any old rubbishy peripherals that the
IT guys have lying around in a dusty cupboard, and find something that
works. And if that doesn't work, and you're not having fun, just give up
and try something else. Sorry to bang on, but the pi, Richard's port,
Andrey's code, and assorted documents, including Michael Covington's newbie
guide and Nemo's book, have made programming fun again for me.


On 3 March 2014 08:54, Richard Miller 9f...@hamnavoe.com wrote:

  also, according to the linux kernel, we should not be looking for
  configurations on anything that's not a hub.

 Personally I wouldn't look to the linux kernel as guidance for
 correct behaviour.  Especially when there's a published specification
 available.

 Every usb device has at least one configuration descriptor.  The usb
 spec allows for more than one, with a well-defined method for choosing
 between them (not supported by plan 9 usb infrastructure).  In
 practice though, it seems common for devices to ignore this and use some
 bizarre proprietary and undocumented way to switch configurations instead.
 Hence the need for abominations like the linux usb_modeswitch utility.





[9fans] print(2)'s format

2014-03-02 Thread trebol
Hello, this is the little story:
I usually write scripts needing numbers padded on the left with zeros, like in 
'%03.0f'.  In UNIX I use printf(1), but now I'm using more and more rc scripts 
with P9P, and I like to use Plan9 programs to make the scripts more portable to 
Plan9... so I tried with seq, like '9 seq -f%03.0f $i $i' or -f%03g, getting 
the desired output in P9P, but discovering that in Plan9, the floating point 
verbs doesn't include the flag '0'.
I'm really curious about this.  Anyone knows the reason of letting out this 
flag (and including it in P9P)?

Regards,
trebol. 


Re: [9fans] Welcome Plan 9 community

2014-03-02 Thread erik quanstrom
 But to begin with the main issue that brings me to write this message. I
 know that before I can do anything on Plan 9, I need hardware that
 cooperate with it. I've read the Supported PC Hardware[0] and
 realised that there is not much of it. Is there only one reliable motherboard 
  
 (ASUS A8R32-MVP without NIC) that can run Plan9? I've also read there that
 there are several laptops pointed in this page without any additional
 comments in brackets. Does it mean that they are fully supported? I've
 also read that RaspberryPI can run Plan 9. I have RP rev. 2 so maybe it
 should be the hardware which I can use to start my Plan 9 adventure.

i've had good luck with plan 9 on a wide variety of hardware.  i've probablly
run it on 20-30 motherboards in the last 5-6 years.  everything from little
soekris to dell/ibm/hp blade servers.  but there are a few little changes that
i made, esp. to the 82563 (intel gigabit) and ahci drivers.

- erik



Re: [9fans] How to find or build 9pxeload?

2014-03-02 Thread erik quanstrom
On Sun Mar  2 16:55:07 EST 2014, 0in...@gmail.com wrote:
  How can I build 9pxeload?
 
 9pxeload has been replaced by 9boot since the new boot loader
 replaced the old one in the distribution in May 2012.

9pxeload is still found in 9atom, as is cinap's iplpxe, which is
much better.  it sets ether0 to the interface that pxe'd, avoiding
manual setting.

- erik



Re: [9fans] How to find or build 9pxeload?

2014-03-02 Thread cinap_lenrek
iplpxe is the most stupid name ever. tuttle is not amused.
its called 9boot on the front. central cervices has to screw
everything up... oh the paper work... ;-)

--
cinap



Re: [9fans] Raspberry Pi: won't recognize the USB mouse

2014-03-02 Thread erik quanstrom
 Personally I wouldn't look to the linux kernel as guidance for
 correct behaviour.  Especially when there's a published specification
 available.

after looking over the spec, i didn't see this question addressed.  do you?
it's a byte, so in theory there could be 255 configurations.  lacking anything 
else,
i needed something as guidance.  worse than nothing?

- erik



Re: [9fans] How to find or build 9pxeload?

2014-03-02 Thread erik quanstrom
On Sun Mar  2 20:19:12 EST 2014, cinap_len...@felloff.net wrote:
 iplpxe is the most stupid name ever. tuttle is not amused.
 its called 9boot on the front. central cervices has to screw
 everything up... oh the paper work... ;-)

thank you.  my new claim to fame.

as long as we're abolishing 360 jokes, what do you call dd in 9front,

http://en.wikipedia.org/wiki/Initial_Program_Load#IPL

☺

- erik



Re: [9fans] print(2)'s format

2014-03-02 Thread erik quanstrom
 Hello, this is the little story:
 I usually write scripts needing numbers padded on the left with zeros, like 
 in '%03.0f'.  In UNIX I use printf(1), but now I'm using more and more rc 
 scripts with P9P, and I like to use Plan9 programs to make the scripts more 
 portable to Plan9... so I tried with seq, like '9 seq -f%03.0f $i $i' or 
 -f%03g, getting the desired output in P9P, but discovering that in Plan9, the 
 floating point verbs doesn't include the flag '0'.
 I'm really curious about this.  Anyone knows the reason of letting out this 
 flag (and including it in P9P)?


i am not sure if there is any knock-on to this, but i think this is all that's
required.  unfortunately %06s might do some wierd things.  shouldn't
be a big issue, since that's not specified anyway,  and
g '%0[0-9]*(\.[0-9]*)?[sq]' /sys/src
turns up nothing.

i'm considering the patch. 

- erik

diff -c /n/dump/2014/0302/sys/src/libc/fmt/dofmt.c ./dofmt.c
/n/dump/2014/0302/sys/src/libc/fmt/dofmt.c:87,99 - ./dofmt.c:87,100
  int
  _fmtpad(Fmt *f, int n)
  {
-   char *t, *s;
+   char *t, *s, c;
int i;
  
t = f-to;
s = f-stop;
+   c = f-flagsFmtZero? '0': ' ';
for(i = 0; i  n; i++)
-   FMTCHAR(f, t, s, ' ');
+   FMTCHAR(f, t, s, c);
f-nfmt += t - (char *)f-to;
f-to = t;
return 0;
/n/dump/2014/0302/sys/src/libc/fmt/dofmt.c:102,114 - ./dofmt.c:103,116
  int
  _rfmtpad(Fmt *f, int n)
  {
-   Rune *t, *s;
+   Rune *t, *s, r;
int i;
  
t = f-to;
s = f-stop;
+   r = f-flagsFmtZero? '0': ' ';
for(i = 0; i  n; i++)
-   FMTRCHAR(f, t, s, ' ');
+   FMTRCHAR(f, t, s, r);
f-nfmt += t - (Rune *)f-to;
f-to = t;
return 0;
diff -c /n/dump/2014/0302/sys/src/libc/fmt/fltfmt.c ./fltfmt.c
/n/dump/2014/0302/sys/src/libc/fmt/fltfmt.c:303,309 - ./fltfmt.c:303,309
 * which is 341 currently.
 */ 
xdtoa(fmt, s, f);
-   fmt-flags = FmtWidth|FmtLeft;
+   fmt-flags = FmtZero|FmtWidth|FmtLeft;
_fmtcpy(fmt, s, strlen(s), strlen(s));
return 0;
  }




Re: [9fans] How to find or build 9pxeload?

2014-03-02 Thread andrey mirtchovski
 http://en.wikipedia.org/wiki/Initial_Program_Load#IPL

1. Set the P register to 9

I like it!



Re: [9fans] Welcome Plan 9 community

2014-03-02 Thread Grant Mather
 I've also read that RaspberryPI can run Plan 9. I have RP rev. 2 so maybe it
 should be the hardware which I can use to start my Plan 9 adventure.
 
 What hardware can you recommend? What hardware do you use? Is there is
 any PC that can run both Plan 9 and Inferno?

If you have a Raspberry Pi, I would just recommend running it on that.
This is currently the machine that I run Plan 9 on, and it runs fast and
very stable. Installing is simply a matter of using dd to copy it to a
SD card.



Re: [9fans] Bell usb keys boot fails

2014-03-02 Thread Nick Owens
On Sun, Mar 02, 2014 at 06:19:57PM +0100, Adriano Verardo wrote:
 Hi, all
 
 The Bell usb image doesn't boot on some (IMHO) very common machines.
 Screenshots available on
 

you could just try adding the did to /sys/src/9/pc/sdiahci.c:1939 and
recompile a new kernel.

maybe it will work, maybe it wont. only the people with the hardware can
test it.

also, it looks like that chipset might be affected by the intel cougar
point bug.



pgpvoYKcZIfK0.pgp
Description: PGP signature