Wednesday, 2022-01-05

*** kylel1 is now known as kylel10:19
lkclfound a bug in the PLRU code used for TLBs14:26
lkclreally obscure14:30
lkcljust restarted the linux kernel boot. it'll be an HOUR just "Allocating 0x5fb320 bytes for kernel"14:31
lkclstraight memcpy, no compression14:31
lkclmental14:31
*** iridium.libera.chat sets mode: +o toshywoshy15:32
*** iridium.libera.chat sets mode: +o lkcl15:32
ghostmansd[m]Hi folks, hope you had good holidays! I have some updates on binutils code generation, but would like to know if I got correctly the way the data from CSV is handled.16:46
ghostmansd[m]Given, say, fdiv from minor_63.csv...16:47
ghostmansd[m]Where the opcode is -----10010...16:48
ghostmansd[m]Am I right that the mask we employ before doing the check is 0b11111, and the exact value we check is 0b10010?16:49
ghostmansdAnother example...16:50
ghostmansdextra.csv, attn insn16:51
ghostmansdopcode is 000000---------------0100000000-16:51
ghostmansdmask is 0b11111100000000000000011111111110, value is 0b1000000000, right?16:52
ghostmansdunder mask/value, I mean that we check for opcode as ((this_value & mask) == (that_value & mask))16:53
ghostmansdI have no idea what nmigen Signal is, so it'd be great if you could give some clues on how these Signals map to C structures16:53
lkclghostmansd, yes, thank you :)17:00
lkclyes17:00
lkcl"-" means "we do not care what that bit is, at all"17:01
ghostmansdok, seems that `((this_value & mask) == (that_value & mask))` makes sense then17:02
lkcltreat them as arbitrary-length integers but with a set length.  more like a python int than a c uint64_t17:02
lkclyes17:02
* lkcl is staring at tens of thousands of simulated instructions rolling by...17:03
lkcl9 million instructions to get to the point i'm tracking down a bug17:04
ghostmansdwhoa17:07
ghostmansdis it possible to narrow the scope?17:07
lkclpossibly by taking a full snapshot of the processor "memory" (which is in a file, so is feasible)17:08
lkcltaking a full register dump17:08
lkcli'm doing output currently of PC, insn, and all LD/STs to a text file (verilator)17:09
lkclthen running microwatt to get a "known good"17:09
lkcland then doing a "diff -u" on the logs17:09
lkclwhich are still 15 million lines long but hey17:09
lkcllkcl@fizzy:~/src/libresoc/microwatt$ wc bram.microwatt.linux.dump17:10
lkcl 13145754  68823276 544792854 bram.microwatt.linux.dump17:10
lkcl13 million.17:10
ghostmansdheck17:10
ghostmansdgood luck with that17:10
lkcl:)17:10
lkclhas to be done.17:10
lkcli quite like the verbose debug logs, i find it reassuring :)17:12
lkclif only we had kernel-level debug access here, i could run gdb and find out what's going on that way17:16
lkclit's really strange, writing python programs that are so bluntly unsophisticated17:22
lkclthere is a... unwritten rule to do as much abstraction and as much code-reuse as possible, almost as a matter of pride and principle17:23
lkclyet in some cases it just becomes...17:24
lkclwell, i think i told other people here a story about a new web developer for a security company i worked for17:24
lkclthe customer needed a CPU reporting screen, as a full-screen "bar".17:25
lkcli did it in... mmm.... 800 lines including the back-end? can't remember if i read /proc or just ran loadavg | cut | ....17:26
lkclthey gave the job of replacing it to the new employee17:26
lkclsix *weeks* later he had written 14 THOUSAND lines of code17:26
lkcla full Model-View-Controller abstraction17:26
programmerjakewere they rewriting htop in php?17:27
lkcljust to report a fricking CPU usage as a bar on the screen17:27
lkcli think he decided to use django or some sort of vastly overblown framework17:27
lkclwhereas i'd knocked up a bit of python which outputted HTML after running os.popen()17:28
lkclno, it was really just, "put the CPU usage on-screen as a single bar like you see in systray"17:29
lkclnot even as a rolling graph17:29
programmerjakemodel-view-controller is sometimes overused...just like object orientedness...we're not writing in smalltalk...or in VB17:29
lkclhow the hell he managed to turn that into 14,000 lines i will never know17:30
lkclpc   603144 insn 9506000817:30
lkcl                          wr @ 0006580c do17:30
lkclah maaaan, that has to get up to Allocating 0x5fb32017:30
programmerjakemaybe you unintentionally counted whatever library he included, so he only wrote a few of the lines?17:31
lkclno, he really had written 14,000 lines in 6 weeks17:31
programmerjakeor maybe it was a monero miner disguised as a MVC implementation17:32
lkclthey fired him 6 months later and he sued them for wrongful dismissal17:32
lkcl:)17:32
lkclhe wasn't able to listen to instructions properly.  i had warned them to keep an eye on him but _they_ didn't listen.  the whole company went to hell in a handbasket after it was sold a couple years later17:33
lkclall a bit of a mess :)17:33
lkclthis is quite fascinating to see roll by17:34
lkcl                          rd @ 00135a95 di 74756d2065726120 sel ff .are.mut17:34
lkcl                          rd @ 00135a96 di 786520796c6c6175 sel ff ually.ex17:34
lkcl                          rd @ 00135a97 di   65766973756c63 sel ff clusive.17:34
lkclthe occasion ASCII string in a morass of instructions from the linux kernel, being copied from the vmlinux image into "RAM"17:35
* lkcl am getting dizzy with the scrolling, have to walk away get some soup :)17:35
lkclokaay an mtmsr should have thrown an illegal exception18:43
lkcloh wait...18:44
lkclpc    1ca9c insn 7c0006ac18:44
lkclpc      700 insn 7db243a618:44
lkclwhereas for microwatt:18:45
lkclpc    1ca9c insn 7c0006ac18:45
lkclpc    1caa0 insn 7869102818:45
lkclokaaay let's decode that..18:45
lkcllbzcix18:46
lkclahhhh i haven't implemented that yet :)18:46
programmerjakeno wonder it broke...18:52
lkcloh that's interesting: it's implemented, but is a privileged operation18:53
lkclBUT18:53
lkclurrr18:53
lkclmicrowatt said "ok" to that.18:53
lkcldamn, i should have brought out MSR as well as PC, oh well18:54
lkcli wonder if i'm checking the right bit18:54
programmerjakecan you attach jtag remote debug to the verilator simulation? sounds likely to make it waay easier to check via gdb18:56
octaviuslkcl, wow what a crazy example of code bloat XD18:56
lkclerr... ermermerm... i no unnerstand18:56
lkclprogrammerjake, i'd have to implement it.18:56
lkcli have that in the other verilator simulation (the one that can't run linux)18:57
lkclit'd have to be manually (explicitly) added18:57
lkcli mean, this is *real* basic. the microwatt verilator simulation used to only have... uart.  that was it.18:57
lkclthe sum total of all possible interaction18:57
programmerjakewould implementing it be faster than going through the simulation several more times cuz more bugs pop up? imho probably18:57
lkclhonestly not sure18:58
lkcloctavius, this is the linux kernel!18:58
programmerjakeor at least some form of debug access18:58
lkclnormally, those 13 million instructions would be executed at what... 2 ghz?18:58
lkclthey'd normally be completed in under 50 ms, caches notwithstanding18:59
lkclyyeah i have that in the other simulator, too.  DMI dump is done that way18:59
lkclbut this is 13 MILLION instructions18:59
programmerjakeidea: debug the verilator c++ in gdb then break when the correct output is printed...19:00
lkclpreviously what i did was "if 0xnnnn < PC < 0xnnnnn" { enable debug }19:00
lkclooo that's a truly dreadful idea that might actually work really well :)19:00
lkclohh i think they even allow you to fire off gdb from verilator19:00
lkclthat makes sense now19:01
programmerjakeother idea: add full simulation state save/restore, so you can start from a snapshot right before the error19:01
* lkcl want to track down why lbzcix threw an illegal exception19:01
lkclha, that's what lots of the debugging companies sell proprietary debug products for, for a whooole boat-load of cash :)19:02
lkclyes, there's no reason why the entire memory should not be saved out.19:03
programmerjakeah...run verilatorin gdb with hardware reverse debugging enabled...iirc intel cpus have hw support for helping with that19:03
lkcl       --savable19:04
lkcl           Enable including save and restore functions in the generated model.19:04
lkclcool!19:04
programmerjakehttps://sourceware.org/gdb/wiki/ReverseDebug19:07
lkclehn?? wtf?? lhzcix works fine, lbzcix - which by a coincidence we don't have a unit test for - raises an exception when i added it to the ldst_test_cases.py19:08
lkclmmmm19:08
lkclokaaay that's addeed...19:12
* lkcl acieeeed19:12
lkclit's going to be bizarre things like this, i think.19:13
lkclall the unit tests in the world are nothing compared to running a few hundred million instructions19:13
lkclokaaay off we go again, another 13 million instructions...19:18
* lkcl going to watch another episode of mythbusters, it's about how long it takes :)19:18
lkclmust remember i am at line 7963511 of the dump file though, that's where the exception happened before19:19
lkclfrickin mad19:19
programmerjakereminds me of when I got a ryzen 1000 cpu, and it would randomly segfault when running compilers...very annoying, but also shows that the best aren't immune to issues19:19
lkcloo that's usually a sign of a memory hardware fault19:20
lkclor in my case, an incorrect BIOS factory setting, putting in the wrong DRAM timings19:20
lkclwhich would have not been so serious if i hadn't bought 8 identical machines19:21
programmerjakeno, the memory works just fine...i'm currently using it in my desktop. it was that particular cpu model.19:21
lkclah deep joy19:21
programmerjakehttps://www.phoronix.com/scan.php?page=news_item&px=Ryzen-Test-Stress-Run19:21
programmerjakeafter I bought the next generation of cpu as a replacement, i gave it to my dad, who isn't a developer so doesn't really encounter those issues19:24
lkclnice19:53
lkclha, it was actually a missing instruction eieio23:54
lkclwhich is the column one over from lbzcix in the opcode map minor 3123:54
lkclhere we go again...23:57
lkclloading dtbImage.microwatt at 0x600000 size 0x5d101823:58

Generated by irclog2html.py 2.17.1 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!