IRC logs for #openrisc Tuesday, 2014-07-08

--- Log opened Tue Jul 08 00:00:09 2014
stekerndalias: (qemu-user fail thread tests) I know, but I thought it'd be a good start at least02:11
daliasstekern, do you have the run results/02:13
daliasi only saw build results02:13
stekerndalias: (build part) if I run 'make run' in libc-tests, the tests run (at least it looks like that to me), but I get no error output from that02:13
stekernwhich is suspicous, since at least the thread tests should fail...02:13
stekernhmm, ok... I don't get *any* output from src/common/runtest.exe when running it without args. looking at the source, I should at least get a 'usage' message then.02:28
stekernweird, but something is definitely off here02:28
daliasit's an executable for the target, right?02:29
daliasi suspect there's something keeping it from working on the or1k port02:29
stekernyes, executable02:30
stekern..for the target02:30
stekernyes, something is wrong, a simple hello world compiled with musl-gcc output nothing as well02:31
stekernmaybe I should have tested *that* before running the tests ;)02:33
stekerngotta run to the bus, be back in ~1 hour02:36
dalias*nod* ok02:36
daliasstrace is your friend, btw :)02:36
stekernyes, not going to work in qemu-user though :(02:37
daliasqemu-or1k -strace02:38
stekernhah, cool. I didn't now that feature existed. thanks02:40
daliasstekern, back?03:48
stekernjust arrived03:48
daliasah03:49
stekernstrace output is rather sparse:03:51
stekern32573 set_tid_address(-159405428,1,-159398720,3,1,-2097152) = 3257303:51
daliaswell the first syscall seems to be right03:52
daliasso it got that far03:52
stekernon a real target it segfaults, so should be relatively easy to debug from there04:07
dalias:)04:09
stekernor well, "real target", in or1ksim ;)04:11
dalias:)04:13
daliasbtw how practical is real or1k yet?04:13
stekernpractical, in what sense?04:18
daliasi meant for it to be an open-ended question because i don't know what sense04:19
stekernI would say it's as practical as any of the other soft cores (microblaze, nios II, lm32 etc)04:19
stekernwhen implemented on an FPGA I mean04:20
daliasso for example in terms of whether there are applications where it's cost-effective04:20
daliasalso how it performs, etc04:22
stekernwell, if you decide to tape out an ASIC with a CPU core, you can of course avoid license costs by using it.04:22
dalias*nod*04:22
stekernperformance wise, it depends on the implementation, but I can speak about mor1kx because I know that.04:23
stekernit's not super-fancy, simple in-order single-issue 6-stage implementation04:24
stekernbut it's fairly efficient at that04:24
stekernwhen running in FPGAs you of course get limited clock frequency (typically below 100MHz)04:26
daliasany idea on the segfault yet?04:28
stekernah, right, coffee-break chit chat is over ;)04:29
dalias;)04:29
stekernlooks like it's ld.so that segfaults in __reloc_self04:32
dalias:)04:32
stekernmaybe I should elaborate, I now tried to just run ld.so, and that segfaults too04:33
daliasany idea where?04:35
stekernoh, I mean, *that* is the one that segfaults in __reloc_self04:35
stekernor maybe you mean where in __reloc_self04:36
daliasyeah04:36
stekernwhen loading the second arg04:36
daliasso very early?04:36
daliasah, it looks like your _dlstart didn't setup any args for it...04:39
stekernor not exactly loading the second arg, but rather loading from the calculated address from arg1 and arg204:39
daliasyes but _dlstart never puts anything in the arg registers :)04:39
stekernhah, yeah... that might help.. ;)04:40
daliasalso, while -Bsymbolic-functions should fix this, you probably don't want a call via the plt here :)04:40
daliasjust a direct call to __reloc_self is what you want (but of course -Bsymbolic-functions makes it into one anyway)04:41
daliasand loading the GOT register is probably not useful at this point, since it won't yet point to any valid data04:41
dalias__reloc_self is written not to depend on any global data or calls04:42
stekernright, I think I understand now, I should just load arg1 with *sp, arg2 with sp+4 and arg3 with the address of _DYNAMIC05:04
stekernbut I do need to load the GOT register to get _DYNAMIC don't I?05:19
stekernwell, it doesn't have to be the GOT register, but I need to get the got address into a register so I can as well use that05:20
stekernbut _DYNAMIC is the first entry in GOT, so I should probably just load it into r5 instead05:34
stekerndalias: so, does something like this look sane? http://pastie.org/936637005:37
stekernat least ld.so runs happily with that05:38
stekerndalias: also, without the call through PLT, there's an R_OR1K_INSN_REL_26 inserted at the __reloc_self call site05:55
stekern(well, it will not actually be a call through plt, since it's already resolved when plt(__reloc_self) is used)05:56
stekernok, now the hello world works...07:56
stekernman, I've must have exceeded the Ballmer peak when I wrote that _dlstart or something...10:20
stekernthink I have straightened out the bugs in that now though10:20
ysionneauthe Ballmer peak?10:36
ysionneauah http://xkcd.com/323/10:37
rahhttp://wutheringbytes.com/11:57
rahanyone going to this?11:57
rahthere's this talk:11:57
rah* The Future of Microprocessors, Sophie Wilson (Director of IC Technology,11:58
rahBroadcom)11:58
-!- Francisco is now known as Guest6632214:19
Guest66322Hi all,14:19
Guest66322I'm getting this error:14:20
Guest66322INFO:  Preparing or1200 INFO:  Checking out http://opencores.org/ocsvn/openrisc/openrisc/trunk/or1200 revision 852 to /home/xico/.cache/fusesoc/or1200 svn: Server sent unexpected return value (502 Bad Gateway) in response to OPTIONS request for 'http://opencores.org/ocsvn/openrisc/openrisc/trunk/or1200' ERROR: Failed to configure the system ERROR: "svn co -q --no-auth-cache -r 852 --username orpsoc --password orpsoc http://open14:20
Guest66322Does anyone know if server is down ?14:20
daliasstekern, does the linker fail to resolve the REL_26? if so it's not a big deal to use the plt version since the linker will patch it out anyway due to -Bsymbolic-functions14:43
stekerndalias: yes, that's exactly what happens14:48
stekernI wonder, should we consider that a bug in the linker?14:48
daliasi'm not sure. i think it's consistent with the way other archs behave14:48
stekernanyway, I've left the plt() in there for now14:49
daliasiirc this is why we have illogical plt-type relocs on microblaze too14:49
stekernmmm, I saw that14:54
daliasare the +0 and +4 in your gotpc relocs right?14:55
daliasi ask because it would be easy to have the hi part wrong and still work most of the time14:56
stekernI think so, I don't have the code in front of me now. but r9 will contain the address at 1:14:58
-!- guilherme is now known as Guest1469315:06
-!- Guest14693 is now known as guiluz15:06
-!- Guest66322 is now known as Francisco15:15
-!- Francisco is now known as Guest5400715:16
-!- Guest54007 is now known as francisconunes15:16
daliasyes i think i see it now15:39
daliasi don't see how your code is working tho15:40
daliasit's passing the address of the GOT rather than the address of _DYNAMIC15:40
stekernyes, I know, but isn't that function it calls actually going through the got looking for relocations15:44
stekern?15:44
stekernI'll happily admit that I don't follow that function (that I blatantly copied from microblaze)15:45
jtdesousaHi, I am getting svn: Server sent unexpected return value (502 Bad Gateway) in response to OPTIONS request for 'http://opencores.org/ocsvn/openrisc/openrisc/trunk/or1200'15:47
jtdesousaERROR: Failed to configure the system15:47
jtdesousaERROR: "svn co -q --no-auth-cache -r 852 --username orpsoc --password orpsoc http://opencores.org/ocsvn/openrisc/openrisc/trunk/or1200 /home/jts/.cache/fusesoc/or1200" exited with an error code.15:47
jtdesousaERROR: See stderr for details.15:47
stekern'that function' = __reloc_self15:53
daliasstekern, no, the GOT doesn't have any information about relocations16:04
daliasit's one of the main targets on which the relocations are performed16:04
daliasthe relocations however are in a relocation table which can only be found by looking for the relevant DT_RELA etc. entries in the _DYNAMIC array16:05
stekerndalias: hmm, that's true. I'll take another look later tonight when I'm at the machine.16:14
daliasok16:19
-!- guilherme is now known as Guest9903716:53
stekerndalias: so, let's try again, hopefully this is the last version of start.s: https://github.com/skristiansson/musl-or1k/blob/master/src/ldso/or1k/start.s17:45
stekernthanks a lot for having the patience walking me through it17:45
daliasok i'll look17:46
daliasi think you could just use gotpchi and gotpclo directly with _DYNAMIC and _DYNAMIC+417:46
daliasrather than first loading the got address then adding the got-relative _DYNAMIC address17:47
daliasbut either way should be valid17:47
stekernyeah, that'd probably work18:01
daliasiirc that's how we do it on other archs18:02
daliasbtw i really like the way microblaze has 32-bit immediates via 2 instruction slots :)18:03
stekernme too18:07
stekernbut I'm curious how that's implemented in hw18:07
daliasi think it's a hidden temporary register that's cleared by all instructions except imm18:08
daliasand when it's clear, the low 16 bits are just sign-extended18:08
daliasrather than using the value of this register for the high bits18:08
daliasthere must also be some special logic for resetting pc back when an interrupt occurs between the imm and following instruction18:09
daliasor interrupts may just be deferred by one cycle18:09
stekernyes, I was more thinking in the lines of: is it threated like a single instruction, i.e. an exception can't happen in between the imm and the following insn18:09
stekernright18:09
daliasthe difference between these two implementations should be mostly non-observable18:10
stekernI would guess that they are just deferred, special logic is annoying18:10
daliasthe only way i can think that you might be able to observe it is attempting to measure a bias of randomly-timed interrupts' return addresses in a sequence of code with imm's18:11
daliasif the bias is backwards, it probably resets. if the bias is forward, it probably blocks interrupts18:11
stekernand the first has other implifications, like if you modify the return from exception register18:11
daliaseither has that.18:11
daliaseven if the instruction were executed atomically, you could still explicitly jump to the middle of it18:12
daliaswhich is what would happen if you modify the return-from-exception address18:12
stekernwell, yeah, but the first would still be more transparent in the ISA I think18:13
stekerni.e. I would expect it to be documented if that was the case18:14
stekerncan't say I've gone through the microblaze docs with a comb, maybe it is18:14
daliasoverall i like the microblaze isa. it's like "mips done right" ;-)18:15
stekernotoh, blocking exception has interesting side-effects when handling pagefaults if they would be located on each side of a page boundary18:16
daliasyes..18:16
daliasi suspect exceptions just decrement pc if the imm register is not clear18:16
daliasor maybe (this seems unlikely tho) exceptions even save/restore the imm register?18:17
stekernyeah, that's of course an option, but that wouldn't work if you (manually) nest exceptions18:32
stekerndalias: our assembler didn't like the micro-optimisation you suggested:18:34
stekernsrc/ldso/or1k/start.s: Assembler messages:18:34
stekernsrc/ldso/or1k/start.s: Internal error!18:34
stekernAssertion failure in gas_cgen_tc_gen_reloc at ../../binutils-gdb/gas/cgen.c line 1064.18:34
daliasah18:50
blueCmdstekern: do you know if ethmac _needs_ DMA?19:20
blueCmdseems like it, hmm19:24
blueCmdI would like to tell the ethoc driver to DMA map to a certain memory area19:30
blueCmdthe rational is that ethoc + it's memory chip it's DMAing to is not on the same board as the FPGA which is running Linux19:31
stekernmhmm19:31
stekernit's easy to tweak the driver to do that19:31
blueCmdcool! is it dirty or is it a candidate for upstream?19:32
stekernwell, dirty is easy19:33
stekernI bet if you want to do it upstreamable you shoud find/add devicetree mappings for that19:33
stekerndalias: I just did the setjmp optimization, and then I remembered one thing I saw in microblaze earlier: http://git.musl-libc.org/cgit/musl/tree/src/setjmp/microblaze/setjmp.s#n2020:06
stekernthat should be 30->4020:07
blueCmdstekern: FYI, it turns out that I can just do:20:10
blueCmdreg = <0x92000000 0x100>, <0x200000 0x8000>;20:10
blueCmdthe code is already there to let me specify a default :)20:10
stekernhah, ok. cool20:11
blueCmdthat will map the DMA area to 0x200000 (if that wasn't clear)20:11
stekernI'm not to familiar with the ethoc driver, I was just speaking generally that it is easy to change the driver to do that if it isn't supported20:11
stekernbut that's good to know.20:12
blueCmdindeed, and I learned quite a few things finding out how it worked :)20:12
stekernthat microblaze typo makes me wonder another thing, can microblaze handle unaligned accesses?20:13
olofkHas opencores.org become increasingly shaky? I'm considering cloning some of the repos to github to increase availability21:34
daliasstekern, thanks for the microblaze catch!23:34
--- Log closed Wed Jul 09 00:00:11 2014

Generated by irclog2html.py 2.15.2 by Marius Gedminas - find it at mg.pov.lt!