IRC logs for #openrisc Wednesday, 2014-09-03

--- Log opened Wed Sep 03 00:00:35 2014
sb0stekern, it works, though the performance is rather low due to the CPU doing everything (preamble, FCS, etc.)01:51
sb0if you can live with a low-bandwidth network connection (a few hundred kilobytes/s) that uses a lot of CPU time, that's fine01:53
stekernhmm... not sure I can live with that ;)02:43
stekernadding preamble and FCS doesn't sound hard though02:45
poke53281I want to compile the descent 1 remake. Almost no problem during compiling. But it ends with a segmentation fault when I want to run it. Before it reaches the main routine. strace ends after loading the libraries. Last command: set_tid_address(0x300c1824)=6802:53
poke53281I guess the first test would be a static compile02:58
stekernpoke53281: to debug segfaults, I usually run my kernel with some debug printks sprinkled at the places where sigsegv is sent02:58
poke53281a working gdb would also help I guess. What is the easiest way to get address of this fault?03:00
poke53281Will try it03:01
stekernbut there are more places from where sigsegv can be sent03:01
stekernmost come from do_fault though, so try with that first03:03
stekernI couldn't refrain myself from porting the old mandelbrot code to SDL yesterday, it works, but oh so slow ;)03:04
poke53281don't use double03:25
poke53281and use -mhard-float03:25
stekernyes and no03:26
poke53281try an integer based mandelbrot03:26
poke53281this is possible03:26
stekernI know, I just wanted to preserve my antique code ;)03:26
stekernbut I can't use hard-float03:26
stekernI don't have an FPU03:27
poke53281I expected, that you would say this.03:27
poke53281then parallelize it with 64 cores. Use the biggest FPGA you can find ;)03:28
stekernwell, there's the one bandvig is working on, so in theory I could03:28
stekernbut, I think using fixed point math would still be faster03:29
poke53281like in the good old days.03:30
stekernit runs fast enough on my x86_64 workstation though ;)03:30
poke53281If you think it runs too fast try to implement using libmpfr and use 1000 digits accuracy.03:33
poke53281Then we will see which one is faster.03:33
stekernpoke53281: did you have some X building recipes btw?03:35
poke53281yes, of course. Wait03:36
poke53281This is everything you need.03:49
poke53281I you don't want to compile just use my .tar.bz2 packages03:50
poke53281please send every legimitate complaint to /dev/zero03:51
poke53281construxtive criticism however to the chat03:52
poke53281Today I would the whole scripts with bash. An not with make. What was I thinking.03:53
poke53281Sometimes I spread a -mhard-float into the Makefiles.03:55
poke53281pc is zero04:44
poke53281but I can start with GPR0904:46
poke53281and I can check for this pc in the emulator04:47
stekernyeah, and you can of course add some debug stuff to jor1k to track for pc = 004:47
stekernand save some state in a ring buffer04:47
poke53281this was the last point I mentioned :)04:48
stekernright, we were typing at the same time ;)04:48
poke53281sigh, according to ldd there is nothing at the address of gpr0904:50
stekernworth noting might be the segfault I had with scummvm 1.704:55
stekernmight or might not be related04:55
poke53281again, nothing loaded at this address04:57
poke53281hmm, maybe this is already part of the error04:58
stekernwhat is the output of ldd?04:59
poke53281one second04:59
poke53281        /lib/ (0x8000000)05:01
poke53281 => /usr/lib/ (0x30000000)05:01
poke53281 => /usr/lib/ (0x3007c000)05:01
poke53281 => /lib/ (0x8000000)05:01
poke53281 => /usr/lib/ (0x300b0000)05:01
poke53281 => /usr/lib/ (0x300b4000)05:01
poke53281libz end address should 300D675C05:08
poke53281I think musl is mapping something there.05:09
poke53281probably I should print the memory mapping during that segfault too.05:09
poke53281every library is independently tested with other programs. Also libphys05:11
poke53281stekern: the ringbuffer gives me
poke53281only every fourth pc printed05:56
poke53281so the last known position is in the function BlitNtoN in libSDL.06:03
stekernis that the 0x30024FF0?06:12
stekernwhere should it jump from there?06:13
poke53281it's actually 24FF806:14
stekernthat doesn't make sense06:16
poke53281I know06:16
stekerncan you dump epcr when the itlb miss hits?06:19
poke53281qemu-user also stops06:23
poke53281it stops somewhere slightly above the libSDL binary06:30
olofkthere were no problems enabling gdb and sim when building binutils06:32
olofkAnd I made sure to not have any or1k-elf- stuff in my path when building it06:33
poke53281I will also print the opcode now06:35
poke53281add this addres is mapped and not libSDL06:51
poke53281ldd is really really wrong06:52
poke53281do_init_fini of libc06:57
poke53281I don't have a clue what's at 0x3017976806:58
stekernolofk: but then you are building binutils from or1k-src?06:58
stekernpoke53281: ok, that starts to make more sense at least06:59
poke53281stekern: what is the section .plt ?07:15
stekernwhat are you asking about it?07:20
poke53281found the crash position07:20
poke53281in libz.so07:21
stekernis it the jump to frame_dummy or to __do_global_ctors_aux?07:23
poke53281it's the jump in .plt07:24
poke53281in section .plt and function <.plt>07:24
poke53281Have to sleep soon. You can find the binary in the libz.tar.bz2 in the packages directory I send you a few hours ago if you want to investigate it further.07:26
poke53281But it seems, that this is a real error.07:26
poke53281real severe error.07:26
poke53281the libc is in musl.tar.bz207:27
stekernwhat do you mean by the 'jump in .plt'?07:28
stekernafaics the calls from _init doesn't go through the plt?07:29
poke53281sorry, it's late07:32
poke53281one moment07:32
stekernyeah, no problem, don't let me keep you up ;)07:32
poke53281but it looks correct07:35
poke53281look at the disassembly07:37
poke53281he jumps to <_init+0x36c>07:37
poke53281which is in <.plt> and not in <_init>07:37
poke53281je jumps at pc:0x30179DCC, which is 0x1DCC in the disassembly.07:39
stekernyeah, so *that* call goes through the plt07:39
poke53281this one I posted before07:39
stekernI was only looking at the frame_dummy and __do_global_ctors_aux calls07:40
stekernyes, I was suppose to paste this from that: "pc:0x30179DCC epcr:0x30179768 ins:0x07FFFF42" master.js:191  l.jal 1ad4 <_init+0x36c>07:41
poke53281the l.lwz gives probably a zero value and then he tried to zero07:41
poke53281to jump to zero07:41
stekernso what function should it jump to from that plt entry?07:41
poke53281don't know07:41
poke53281I don't even know what the plt is. I am just telling you what's written here :)07:42
olofkstekern: Yes, building from or1k-src. The point of this exercise (except for learning what the hell is really going on) is so that we can clean up the build instructions a bit07:43
stekernaha, plt is the procedure linkage table. position independent calls go through that07:44
stekernolofk: but we "shouldn't" build binutils from that, but from upstream07:44
olofkstekern: Yes I know, but at least splitting out newlib is a good first step07:45
olofkAnd once gdb is upstreamed, we will probably do it like this anyway07:45
olofkAnd if we don't care about gdb, we can build from upstream binutils07:46
olofk(given that newlib is split out)07:46
stekernpoke53281: I can take a look at it, but just as a reference, you can get the function that is getting called by looking at the offset to r16 in at 0x1ad4 and then use that offset to look up the function in the GOT (r16 should point to that)07:47
olofkI thought about rebasing our newlib port to upstream newlib, but I'm a bit scared of their CVS repo07:47
stekernpoke53281: you should objdump with -RD to get more info07:48
olofkAha. There's a git repo as well now07:48
poke53281stekern: Sorry, too late. But the first thing you can try is check the output from for an arbitrary binary.07:50
poke53281if ldd is correctly mapped to 0x80000000 or 0x3000000007:50
poke53281I mean if libc is correctly mapped07:50
stekernyeah, go to bed ;) as I said, I can objdump libz myself and look it up, I'm just mentioning it for future reference07:51
poke53281last message for today: registers right before the jump to zero. r12 is indeed zero07:55
poke53281"   r4: 0x3019A2A4   r5: 0x30179768   r6: 0x7FDC1CCC   r7: 0x7FDC1D20" master.js:19107:55
poke53281"   r8: 0x7FDC1D38   r9: 0x30179DD4   r10: 0x300C18C8   r11: 0x000001EC" master.js:19107:55
poke53281"   r12: 0x00000000   r13: 0x00000000   r14: 0x7FDC1E44   r15: 0x0000807E" master.js:19107:55
poke53281"   r16: 0x3019A1BC   r17: 0xFFFFFFF9   r18: 0x00000000   r19: 0x00008079" master.js:19107:55
poke53281"   r20: 0x00000000   r21: 0x30172234   r22: 0x300C3280   r23: 0x00000000" master.js:19107:55
poke53281"   r24: 0x300C1970   r25: 0x00000000   r26: 0x300C1964   r27: 0xFFFFFFF9" master.js:19107:55
poke53281"   r28: 0x300C196C   r29: 0x00008079   r30: 0x00000000   r31: 0x00000010"07:55
olofkSo, should I use musl, uClibc or glibc for my linux toolchain?09:10
olofkCan is any of them also able to build linux now? I'm trying to cut down on my toolchain building09:11
stekernnone of the libc's are involved when you build Linux09:22
stekernbut you should be able to build Linux with the gcc from any of them09:22
stekernpoke53281: looks like it's  __register_frame_info that it tries to call at the place where it fails09:38
stekernand the got pointer (r16) in your register dump looks right, so somehow the dynloader hasn't resolved that reloc09:59
olofkwallento: Is your or1k-newlib repo in good enough shape to be used?10:12
olofkhmmm.. looks like it could need some more stuff10:16
olofkDoesn't CROSS_COMPILER= work anymore for building the kernel?10:54
olofkah.. maybe I forgot a make clean after switching branches10:58
wallentoolofk: nope, I just started this11:01
wallentoi hope end of the week11:01
olofkwallento: But it's a complete reimplementation, right?11:02
olofkThe reason why I'm asking is that we probably don't want to send the current GPLv3-licensed port upstream11:02
wallentoi am still not sure how the build tree stuff works11:02
wallentonot a complete, but only those part where the authors are not fine with BSD11:02
wallentothey don't accept, we have already been there11:02
olofkExactly what I was going to ask :)11:02
wallentotalked with julius, stefan and jeremy11:03
wallentothink I missed you11:03
olofkI miss you too :)11:03
olofkI think that I only submitted ordb2a.S and I'm fine with another license for that11:03
olofkThe D&R license is pretty good11:14
stekernI (seriously) like wtfpl best11:30
maxpalnBTW, I was asked to do some rough benchmarking of the new processor vs the old one. One of them was the boot time for Linux - it has dropped from some 55 seconds (with OR1200) to 9 secocds (with MOR1KX) :-) That's a nice reduction!!12:22
stekernthere's no secret that or1200 is a lot slower than mor1kx, especially when MMUs are turned on. that's more difference than I'd expected though12:47
maxpalnwell, in slight fairness to the OR1200, I wasn't able to run it with cache'ing (because of the bug I found) and the clock rate was slower, but the OR1200 clock rate was as fast as I could get it. So the improvement is from a number of factors - the 55 seconds was as good as I could get the OR1200, 9 seconds is probably as good as I can get the MOR1KX.12:50
maxpalnshort of putting it in one of our instant-on devices - then it would probably be 2-3 seconds.12:51
heshamIs l.csync instruction supported? I am trying to use it from asm volatile statement and I got "unrecognized form of instruction `l.csync'" assembler error13:04
heshamThe same goes for l.msync13:04
stekernhesham: they are supported in upstream binutils at least14:17
stekernand, prior to this:
stekernmor1kx would cause an illegal instruction on it, instead of treating it as a nop14:19
stekernl.csync will still cause an illegal instruction unless you explicitly "enable" it (there's no real logic behind it)14:20
stekernstrictly speaking, even though load/stores are ordered, I should add proper support for l.msync14:24
sb0stekern, btw, have you tried porting the old milkymist soc drivers to misoc/mor1kx?14:25
stekernfor the case where where instruction mem is written and you want to ensure that the store has finished before you run the code14:26
stekernsb0: what drivers are you speaking about? Linux drivers?14:28
sb0for uart and timer14:29
stekernno, but it's something I want to do at some time14:29
stekernlet's make that s/want/intend ;)14:30
stekernthe timer is actually relevant to what I'm currently doing, removing the hard dependency on the built-in or1k timer14:33
maxpalnnow that my HW is stable, I'm reviewing the Linux config. I have noticed that the interrupts I have assigned in the DTS might have become out of date - I only have a few entries in there so it probably isn't that big a deal right now. But as I add a few more I want to make sure the interrupts are correctly assigned.15:01
maxpalnWhat interrupt should assigned to the pic?15:01
maxpalnit is currently assigned to interrupt 1 - which from memory used to be an unassigned non-maskable interrupt in orpsoc_top15:02
maxpalnah, my mistake - the PIC doesnb't have an interrupts entry. It has an interrupt-cells entry. Very different!!15:18
--- Log closed Wed Sep 03 16:04:41 2014
--- Log opened Wed Sep 03 16:05:15 2014
-!- Irssi: #openrisc: Total of 42 nicks [0 ops, 0 halfops, 0 voices, 42 normal]16:05
-!- Irssi: Join to #openrisc was synced in 23 secs16:05
poke53281stekern: the value 0x0 to this address is written by the function do_relocs.16:18
poke53281case REL_SYM_OR_REL16:19
-!- rah_ is now known as rah16:20
stekernpoke53281: yes16:22
poke53281you know?16:23
stekernyes: SJK DEBUG: Relocating /usr/lib/ __register_frame_info: base = 3016e000, def.sym = 0, 3019026c <= 016:24
poke53281Ok, so you can reproduce the bug.16:25
stekernyes, I haven't got my head fully around it though16:25
stekern__register_frame_info is defined in, *but* glibc defines that as well (musl don't)16:26
poke53281with my binary or also yours. Note that we use a daily snapshot of binutils16:26
stekernI don't think binutils is related here16:27
stekernor at least not on that level that there would be a difference between the daily snapshots16:28
stekernbut, to answer your question, with your binary16:28
poke53281Strange is, that libz is one of the most linked libraries after libc. And so far, all other programs work.16:29
stekernoh... actually, maybe it's not that __register_frame_info resolves to 0 there that is the error16:31
stekernwait, I'll paste my full debug printout to show what I'm speaking about16:32
poke53281note that it doesn't work in qemu either. So probably it has nothing to do with the kernel and the emulator.16:33
stekernno, it doesn't16:34
stekernnotice that there are 2 __register_frame_info there16:34
stekernand this is the output of readelf -rd:
stekernthe one that resolves to zero is the R_OR1K_JMP_SLOT and the one that resolves to 4464 is the R_OR1K_GLOB_DAT16:36
maxpalnfeeling stupid. Trying to mount the SPI flash in Linux - I keep getting told that my mount command contains an invalid argument!!16:37
stekernnow let's take a look at libgcc's crtstuff to find out why those two are there16:37
maxpalnI am wondering if it is complaining about the jffs2 FSTYPE - does this need to be included in the Linux lernel, I have looked and can;t find a specific entry for it....16:38
stekernso, the 'if (__register_frame_info)' is the R_OR1K_GLOB_DAT and the '__register_frame_info (__EH_FRAME_BEGIN__, &object);' is the R_OR1K_JMP_SLOT16:39
stekernwhy doesn't that R_OR1K_GLOB_DAT resolve to 0?16:39
poke53281don't know16:41
stekernmaxpaln: what about JFFS2_FS?16:41
maxpalnstekern: maybe you're right - this moved me to:16:42
maxpaln# mount -t JFFS2_FS /dev/mtd2 /mnt/spi016:42
maxpalnmount: mounting /dev/mtd2 on /mnt/spi0 failed: No such device16:42
maxpalnI am confused by this one - I have just run a flash_eraseall on the /dev/mtd2 partition! hmmm.....16:43
stekernmaxpaln: I meant in the kernel config16:44
maxpalnLOL - in which case the new error message from the command prompt is really odd!!16:44
maxpalnI#ll check the kernel config...16:44
maxpalnok, JFFS2 is set: CONFIG_JFFS2_FS=y16:45
stekernpoke53281: yeah, me neither... but I think finding that out is the right track16:47
maxpalnhmmm, confused - I am using the same commands as the last time I was at this point (on our eval board some 6 months ago - wow, what a ride to here!) - but this 'invalid argument' has me confused.16:53
poke53281Hmm, the from sabotage linux doesn't even have the register_frame entry16:54
maxpalnboth the directory I am pointing at and the device I am pointing at exist -16:54
maxpaln# mount -t jffs2 /dev/mtd2 /mnt/spi016:54
maxpalnmount: mounting /dev/mtd2 on /mnt/spi0 failed: Invalid argument16:54
poke53281But is has _Jv_RegisterClasses16:55
poke53281and the entries are at the same places if I look at the readelf output16:56
poke53281stekern: I can give you any output you want before the jump. Just tell me.17:02
poke53281maxpaln: Is there no checkdisk utility for jffs2. Maybe your image is broken17:08
maxpalnhmmm, all I've done is a flash_eraseall - no image.17:09
maxpalnthe erase seems to work correctly:17:09
maxpaln# flash_eraseall -j /dev/mtd217:09
maxpalnErasing 64 Kibyte @ 2d0000 - 100% complete.Cleanmarker written at 2c0000.17:09
poke53281aehmm, mkfs.jffs2 before mounting maybe?17:09
maxpalnI don't have the mkfs.jffs2 command -17:09
maxpalnadding the mtd-utils (or whichever package adds it) was next on my list17:10
maxpalnbut I have definitely been able to mount the SPI Flash using just the mount command before -17:10
poke53281but if it is just erased, how should the mount work. jffs2 is not reckognized then.17:11
maxpalnok - I thought the -j option to the flash_eraseall would format for jffs217:11
maxpalnis that wrong?17:11
maxpalnor perhaps there is another step...I don't remember having another step (if on;y I'd written down the commands!!!)17:12
poke53281I have never used it. Don't know anything about the -j option.17:13
stekernpoke53281: hmmm... interesting. but I don't know if that's of essence.17:13
poke53281maxpaln: I would suggest to install those mtd tools and try to use the mkfs.jffs2 program.17:15
maxpalnyeah, good approach.17:15
maxpalnone for tomorrow now I think. Thanks all17:16
poke53281stekern: Just try to narrow down the problem.17:17
stekernpoke53281: because, __register_frame_info is declared as a weak reference in crtstuff. which means that it should resolve to 0 if nothing defines it17:20
stekernso, to me it seems like that it doesn't resolve to zero would be the problem17:22
stekernmaybe x86_64 is able to completely remove that reloc in that case?17:23
poke53281simple libz programs work. Maybe it would make sense to run your musl debug version here directly on this binary.17:57
poke53281some other part must interfere here.17:58
stekerndo "simple libz programs" pull in
poke53281tried "gcc prog.c -lgcc_s -lz" and  "gcc prog.c -lz -lgcc_s"18:01
poke53281both link according to ldd and work without problems18:02
stekernthis is the debug print I've added
stekernyes, if they pull in libgcc_s, then they will probably work18:02
poke53281I linked a program so that the ldd output is exactly the same. The program runs.18:07
stekerncan you give me that program?18:08
poke53281you mean the binary18:10
stekernyes, but I can try compiling that too ;)18:11
daliasi'm just jumping in this conv...18:11
daliasbut gratuitous is usually a toolchain bug in ld18:11
poke53281the ldd output is the same as for d1x-rebirth18:14
poke53281dalias: Something maybe not related to this bug here: the ldd output differs from the real mapping. ldd tells me that libc and ls-musl-....   is mapped to 0x80000000. But actually it is mapped to 0x3000000018:15
stekerndalias: I was counting on that you would have some valuable info on the subject, but I consider asking you before trying to investigate ourselfs cheating ;)18:15
daliasiirc --as-needed is supposed to be passed to the linker for libgcc_s18:16
daliasand the linker is supposed to omit linking it if it's not _needed_ to satisfy undefined, _non-weak_ symbol references18:16
daliaslots of toolchains historically had bugs where they would pull in libgcc_s even if it wasn't needed if it was satisfying weak symbol references18:16
stekerndalias: to sum up, this is the code that cause the reloc:
stekernI would assume that the case where we fail is when libgcc_s is *not* needed18:19
poke53281stekern: Now I try to link d1x-rebirth with libgcc_s18:19
stekernso the weak reference is not satisfied (which would then be correct)18:20
stekernbut the problem is that when the relocs for the code in frame_dummy is done, the 'if (__register_frame_info)' does not resolve to 018:21
poke53281stekern: Indeed, it works18:23
poke53281d1x-rebirth starts now18:24
-!- knz_ is now known as knz18:24
stekernthere's more to it... with your a.out, the R_OR1K_GLOB_DAT __register_frame_info get resolved to 018:27
poke53281stekern: This is the final linking process:
poke53281Nothing unusal I would say.18:35
stekernbut without the -lgcc_s normally, right?18:36
poke53281I included -lgcc_s five minutes ago.18:37
poke53281Now I get a segmentation fault because he is out of memory :) Descent 1 was supposed to run with 4MB. And now not even 32MB is enough. Cruel world.18:38
poke53281hmm, he tries to map 770MB.19:23
poke53281of course an unaligned access19:26
olofkUSB passthrough in Virtualbox is really cool. I can run openocd against my de0_nano from inside a VM19:31
ysionneauI usually flash my fpga boards through virtualbox on my macbook19:36
poke53281does virtualbox finally support usb 2.0?19:37
olofkpoke53281: Yes, so now we are waiting for USB passthrough in jor1k as well ;)19:41
poke53281If the development of the browsers go on like in the last few years they will implement such a feature in html 6 or 7.19:45
poke53281so that I can use it19:45
poke53281It looks like d1x-rebirth need a lot of patches in order to solve the alignment issue.20:07
stekernpoke53281: where is it coming from?20:28
poke53281Basically from everywhere. Have fixed two positions, got a third one.20:33
poke53281int pof_read_int()20:33
poke53281        i = *((int *) &bufp[Pof_addr]);20:33
poke53281that's the first one.20:33
poke53281people have problems to run it on arm devices too.20:33
poke53281it puts pointers of packed structs directly into the loaded file. And then swaps integers around.20:35
poke53281So, without a complete rewrite of some loading functions it won't work.20:35
poke53281nothing you can do I would say.20:38
stekernmmm, fun...20:42
olofkI should get me one of the UART adapters with short cables for each of the pins so I don't have to change the pin mapping for every damn adapter20:44
poke53281blueCmd: How do I find if debian uses any patches for a program? Where are the build-scripts they are using?21:42
olofkOh windows. How I forgot what a shitty fucking OS you are21:43
olofkTo find out if a .exe is 32 or 64 bit they recommend using GNU File :)21:50
poke53281It's still amazing that the most often used string you can find in Windows is "This program cannot be run in DOS mode"21:53
poke53281It's in every executable in the header.21:53
poke53281.dll .sys .exe, ...21:53
olofkWhat a waste of bytes21:54
--- Log closed Thu Sep 04 00:00:37 2014

Generated by 2.15.2 by Marius Gedminas - find it at!