channel logs for 2004 - 2010 are archived at http://tunes.org/~nef/logs/old/ ·· can't be searched
#osdev2 = #osdev @ Libera from 23may2021 to present
#osdev @ OPN/FreeNode from 3apr2001 to 23may2021
all other channels are on OPN/FreeNode from 2004 to present
http://bespin.org/~qz/search/?view=1&c=osdev2&y=23&m=1&d=19
00:00:00 <heat> ah
00:00:00 <mjg> and you only do 1 pause
00:00:00 <heat> hm?
00:00:00 <mjg> read the fucking mcs paper
00:00:00 <heat> I do many pauses as long as the atomic loads keep giving me occupied vals
00:00:00 <mjg> you re-read after 1 pause
00:00:00 <heat> ... you want more pauses?
00:00:00 <mjg> for a centralized lock that's pretty bad
00:01:00 <mjg> 01:00 < mjg> read the fucking mcs paper
00:01:00 <heat> maybe one day
00:01:00 <moon-child> https://www.cs.rochester.edu/u/scott/papers/1991_TOCS_synch.pdf this?
00:01:00 <heat> also didn't mcs scale horribly?
00:02:00 <heat> (didn't we touch on this some days ago?)
00:02:00 <heat> erm, sorry
00:02:00 <heat> perform poorly on low cpu counts
00:02:00 <mjg> yein
00:03:00 <mjg> moon-child: yep
00:03:00 <mjg> mcs trades throughput for bounded latency for everyone
00:03:00 <mjg> as in it may arbitrarily suck, but when it does, sucks the same for everyone
00:03:00 <mjg> greedy locks may starve other cpus
00:04:00 <moon-child> screw other cpus
00:04:00 <moon-child> shoulda been faster
00:04:00 <mjg> ye sucks to be you, the other cpu!
00:04:00 <heat> locks are such a we live in a society moment
00:04:00 <mjg> there is a misconception that mcs "scales better"
00:04:00 <moon-child> lol
00:05:00 <mjg> it is particuarly bad with numa in that aspect
00:05:00 <mjg> but you probably want it anyway
00:05:00 <mjg> there were people fucking around with a hybrid lock
00:05:00 <mjg> you do mcs within a domain and backoff otherwise
00:05:00 <mjg> and other ideas to that extent
00:06:00 <mjg> say you have a 2 node ystem
00:06:00 <mjg> every single cpu thread wants to take the lock once
00:06:00 <mjg> least slow variant would be: everyone on node 0 gets the lock an fucks off, then it is send across the interlink and everyone in node 1 does the same
00:07:00 <mjg> the end
00:07:00 <mjg> the slowest possible variant would be ping ponging the lock across the interconnect *every fucking time*
00:07:00 <mjg> which, in worst case, mcs will end up doing
00:07:00 <mjg> greedy lock will favor local cpus up to a point
00:08:00 <heat> and this is why capitalism is good
00:08:00 <heat> thank you mjg
00:08:00 <mjg> it's mr Warren BUffet for you
00:08:00 <mjg> now imagine an 4 or 8 node system
00:08:00 <mjg> 's not good for the fair lock innit
00:08:00 <moon-child> hmmm, so
00:08:00 <moon-child> how does the node that doesn't hold the lock figure out when it can grab it?
00:09:00 <heat> mjg, ok, funny idea: lightweight monitor/mwait
00:09:00 <heat> no need to spin endlessly with weird loads and pause
00:09:00 <mjg> cpus have their own under the hood protocol where they "negotitae" who gets to win in a atomic op fight
00:10:00 <mjg> the more you try, the morel ikely you are to win
00:10:00 <moon-child> heat: like umonitor/umwait?
00:10:00 <moon-child> :)
00:10:00 <mjg> and greedy locks try a lot, but *locally* can do it more often
00:10:00 <heat> i don't remember how umonitor works
00:11:00 <heat> but point being the CPU could treat it like a wait queue of sorts and be smarter when "giving out locks"
00:11:00 <mjg> i thought the lulwait instruction had too much latency
00:12:00 <mjg> i don't know of anyone actually using them for real when waiting for contention to clear
00:12:00 <mjg> which means windows is possibly dong it :s
00:14:00 <heat> https://ieeexplore.ieee.org/document/8978918
00:14:00 <bslsk05> ieeexplore.ieee.org: Catnap: A Backoff Scheme for Kernel Spinlocks in Many-Core Systems | IEEE Journals & Magazine | IEEE Xplore
00:14:00 <heat> may be interesting
00:14:00 <heat> using monitor+mwait
00:19:00 <mjg> they acknowledge this is of any use only if you wait long enough(tm)
05:22:00 <dinkelhacker> So I have a question regarding initrd: From what I get the main argument is to keep the kernel smaller. But since dist vendors don't know what machine they'll be booing on they might end up in a catch22 where they need a file to load the module of the file system driver. However, initrds or initramfs are also shipped by the vendor and not specific to my machine right? So they kind of still have the
05:22:00 <dinkelhacker> problem, that all the drivers whould have to be in the ram disk? So what's the point here?
05:24:00 <Mutabah> A default initrd might have all of the driver modules in it, but it's very easy to rebuild to have a smaller set...
05:24:00 <Mutabah> However... that's not really its main role, most kernels (linux and hobby ones) have all of the drivers they need
05:24:00 <dinkelhacker> Yeah but why wouldn't you just put them into the kernel to begin with?
05:24:00 <Mutabah> It's there to give a small userland stub that's hard to corrupt, before doing the potentially complex disk mounting
05:26:00 <dinkelhacker> Okay... could you elaborate on that? Why do you need that hard to corrupt userland stub?
05:31:00 <Mutabah> To be honst, I don't know enough about linux to be completely sure
05:31:00 <dinkelhacker> And maybe going back to what I wrote: Is it actually true that the initramfs is not specific to my hardware? Or is it created during the installation process and actually contains the right modules. If so, that would make a lot more sense..
05:31:00 <Mutabah> In my old kernel, I did have a initrd - which was mostly just a disk image containing a small userland, could have booted straight of storage
05:32:00 <Mutabah> And I assume linux can do that too...
05:32:00 <Mutabah> dinkelhacker: initrds are (afaik) installation specific on linux
05:32:00 <Mutabah> (Note: This is not #linux)
05:32:00 <Mutabah> Example: Your initrd might contain the modules for a specific raid setup, or non-standard disk controller
05:33:00 <Mutabah> Things that are not part of a standard kernel, but are needed before the disks can be read
05:34:00 <dinkelhacker> Yeah sure I'm asking because I'm wondering if I need that for my hobby OS^^. Okay if it is created during the installation that makes sense because otherwise they would just shift the problem of having all the drivers in the kernel to having them in the initrd/initramfs.
05:35:00 <Mutabah> Well, it's a lot easier to add/remove drivers from an initrd than it is from a kernel binary
05:40:00 <dinkelhacker> bc you have to reconfigure/recompile?
05:41:00 <Mutabah> Yep
05:41:00 <klange> My entire system runs out of an 'initial' ramdisk. =)
05:41:00 <Mutabah> and recompiling a kernel requies having the source and a build environment
05:41:00 <zid> You will want one during dev anyway
05:41:00 <zid> regardless if you end up with one at the end
05:41:00 <Mutabah> while remaking an initrd might be as simple as calling `tar`
05:42:00 <zid> It's kind of hard to write a filesystem driver without a vfs to use it against, kind of hard to write a vfs without a filesystem driver etc etc
05:42:00 <zid> ramfs solves a bunch of nasty problems
05:44:00 <sham1> Now you need a ramfs driver, which depending on the kernel model can be either trivial or very annoying
05:46:00 <zid> what's a ramfs driver, it's just a pre-populated disk cache ;)
05:48:00 <moon-child> lol
05:52:00 <dinkelhacker> zid: why is it easier to implement a fs driver against a ramdisk than against a file system that is on "real hw" (say emmc)? Because you'd also need the driver for the emmc?
05:53:00 <zid> and the filesystem
05:53:00 <zid> and usb or ahci
05:53:00 <zid> or ide
05:53:00 <sham1> And the women and children too
05:56:00 <dinkelhacker> kk... so the strategy would be to for example have an ext2 fs as a ramfs and just implement the ext2 driver against that?
05:56:00 <klange> you could do that, but ext2 is annoying to build from scratch
05:57:00 <zid> the kernel ues 'cpio'
05:57:00 <klange> I mean literally "an ext2 filesystem image" is annoying to build. I used to do this, with genext2fs.
05:57:00 <zid> which is the tape backup archive format I think
05:57:00 <zid> like tar
05:57:00 <zid> or something idk
05:57:00 <zid> klange: needs root on linux to do easily, which is weird
05:57:00 <sham1> squashfs is also one to consider
05:58:00 <sham1> Since it's meant for this
05:58:00 <zid> losetup /dev/loop0 file.fs; mkfs.ext2 /dev/loop0 mount /dev/loop0 fs/;
05:58:00 <dinkelhacker> So cpio and squashfs are less annoying?^^ good to know.
05:58:00 <zid> cp files fs/
05:58:00 <clever> zid: mkfs can copy files on its own
05:58:00 <klange> genext2fs does not need root, but ext2 is still a bit heavy for these purposes; the good choices are all "write once" formats that almost don't count as "filesystems".
05:59:00 <clever> mkfs.ext4 -d ./rootImage blk.bin
05:59:00 <klange> cpio, of course, as zid said Linux uses; I use tar but there's lots of different extensions to tar so it can be tricky to ensure you're getting a consistent format
05:59:00 <klange> squashfs is newer and fancier and more specifically designed for this purpose
06:00:00 <zid> but that shouldn't be your starting goal
06:00:00 <zid> your starting goal is "can I get *A* file loaded"
06:00:00 <zid> so just a directory entry and no nesting support is plenty at first, it'll let you establish a lot of supplemental crap
06:01:00 <zid> hand made in a hex editor for all it matters
06:01:00 <sham1> Eww
06:01:00 <klange> that's more than just "*A* file", start with a single static executable and run it :)
06:01:00 <dinkelhacker> klange: you said your entire system is running out of a ramfs. ToarusOS does not support any non-volatile storage?
06:01:00 <sham1> One should at least have a tool for that
06:02:00 <klange> dinkelhacker: it does but I build live CDs because they are much easier to iterate on, and I also haven't put much effort into my ext2 write implementation so it's very fragile and prone to breaking :)
06:03:00 <klange> I have a test VM sitting around that does a persistent install on a disk image. I was able to install Doom on it from my package manager and it still plays fine.
06:03:00 <dinkelhacker> nice!
06:03:00 <sham1> Microkernels would make iterating easier as you should be able to just iterate on the design and replace the filesystem server on the fly
06:04:00 <zid> (no they don't)
06:04:00 <sham1> In practice, yeah. Sad
06:05:00 <zid> I should write a vfsy thing at some point
06:05:00 <zid> I'd probably just do it in userspace
06:06:00 <zid> startup code that mmap's an archive, and a main that is just a test rig for manipulating some files
06:06:00 <zid> and I implement it all then just copy pate it into kernel
06:06:00 <zid> nce it's done
06:07:00 <dinkelhacker> zid: how do you hand make a file system? tbh I have no knowledge about file systems so the qustion might be obvious, but I assume they have some kind of format/encoding/standard? So wouldn't you have to decide if you wanna use cpuo/squashfs, create a ramfs of that kind and then implement the driver for reading/writing from/to that?
06:07:00 <zid> sure, but, you don't need write support at first (or perhaps ever), and the format doesn't have to be complicated because of that
06:08:00 <zid> so you could literally just do something like "name",len,0xdatadatadata
06:08:00 <zid> which is buildable in a bash script or something :P
06:08:00 <sham1> Add some alignment, god damn
06:09:00 <zid> fine, name, offset, len and all the files go at the end
06:09:00 <zid> with a fancy binpack algo to minimize padding
06:09:00 <dinkelhacker> Okay I see, that would be a home grown fs
06:09:00 <zid> minimizing all the *other* problems lets you write more of the supplemental stuff, then you can complixify it later, is the point
06:09:00 <sham1> Yeah, that's like the most trivial thing. As said, should be buildable in bash, although a C version would be basically just as trivial
06:09:00 <zid> once the supplemental stuff is in and tested
06:10:00 <zid> trying to hook up a vfs + fs driver + ahci driver all simultaneously with no way to test any of them in isolation first will be a nightmare
06:10:00 <sham1> The hardest part would be to deal with the C, but hey, that's also most likely the hardest part of the OSDev, so it's all good
06:12:00 <dinkelhacker> what do you mean with supplemental stuff? Say if I make up my own toy fs like you said, what could I actually reuse once I switch to something real like squashfs?
06:12:00 <zid> once you have your crappy filesystem put in, you can add a vfs driver to talk to it with, and then replace it with an 'on disk' version, and your test rig suddenly becomes 'does it stop working'
06:12:00 <zid> instead of 'idk, I can ask it for data, but nobody actually does anything with that data yet'
06:12:00 <sham1> It's integration testing on crack
06:12:00 <zid> then you can replace the disk format with ext2
06:12:00 <zid> and if it still works.. you're finished
06:13:00 <zid> never having written anything that wasn't testable
06:13:00 <sham1> Sadly osdev isn't all that amicable towards TDD. It's impractical in many ways
06:14:00 <sham1> Microkernels do help because in theory you can test the servers in the development environment, but in practice it's not that easy now is it
06:14:00 <zid> I can do that without it being a microkernel though
06:14:00 <zid> incremental linking acts just the same way
06:15:00 <sham1> Sure, if you decouple things well enough
06:15:00 <zid> I can test it all in userspace, and move the .o across :P
06:16:00 <klange> I do tend to do some microkernelly things when iterating on device drivers; like for USB, I built a shim device interface as a module that a Kuroko script poked to interact with the XHCI card from userspace :)
06:16:00 <sham1> A microkernel would be decoupled well by design… unless you just end up essentially making a system Daemon (a systemd, if you will) that's essentially just a monolithic kernel but in userspace
06:17:00 <zid> good osdev is coming up with good ways to test things :P
06:17:00 <klange> Most of my kernel modules spin up threads to do stuff. They're basically microkernel services, they just run in priveleged space.
06:18:00 <dinkelhacker> couldn't you just test a USB driver against qemu?
06:18:00 <zid> test it to do what? in what environment?
06:18:00 <klange> lol not really
06:19:00 <zid> usb is actually one of the super easy things to test on hw because of iommus :P
06:19:00 <zid> can just boot a VM using a real hub
06:19:00 <zid> I have like 6 hubs, I could passthrough one np
06:19:00 <klange> that still doesn't help me when I'm trying to test an rpi4 natively.
06:20:00 <zid> could do each hub in turn so you get usb 1 2 and 3 too :P
06:21:00 <zid> I even have an irl OHCI test setup available :o
06:21:00 <clever> klange: of note, the vl805 xhci controller on the pi4, has a hardware bug, certain combinations of xhci requests, plus certain latencies on the usb end, cause it to repeat entire buffers
06:21:00 <zid> wait no I don't, that device broke
06:21:00 <clever> klange: as a result, doing 512 byte sector writes over usb, can horribly corrupt your fs
06:21:00 <dinkelhacker> Can't you make qemu to connect the USB to a real thing on my pc? So you could test the driver against it?
06:21:00 <clever> 2022-12-05 19:33:14 <clever> https://github.com/raspberrypi/linux/issues/4844#issuecomment-1041497643
06:21:00 <zid> dinkelhacker: yea that's what I was talking about
06:21:00 <clever> 2022-12-05 19:33:19 <clever> read this comment and weep! :D
06:21:00 <bslsk05> github.com: Raspberry Pi 4 : USB3 SSD Connected via USB3 Hub : BOOT Files Corrupted Following Reboot · Issue #4844 · raspberrypi/linux · GitHub
06:22:00 <klange> lovely
06:22:00 <clever> that kind of defective xhci device, isnt something you can just test around on any machine, you would need to get a vl805 pcie card, and install it into your desktop
06:22:00 <klange> I just want to talk the keyboard on a 400
06:22:00 <clever> but if you use 4096 byte clusters, the problem doesnt occur
06:22:00 <zid> VL2616 for life
06:23:00 <clever> the keyboard is just native usb hid on the pcie xhci controller, so youll need pcie drivers, the special vl805 init sequence, xhci, and hid
06:23:00 <clever> and the bug involves certain combinations of hubs, and outgoing writes, both seem like they will never happen with the internal HID
06:23:00 <zid> finding out that it needs 512 byte sectors to trigger must have been a bear
06:24:00 <clever> zid: the bug only showed itself on the /boot partition, where it was trashing dtb files
06:24:00 <clever> 512 byte chunks of the dtb where replaced with chunks from other dtb files
06:24:00 <zid> yea I am reading it
06:24:00 <zid> I don't need to tab back and read it again :p
06:25:00 <clever> i think the biggest problem in this bug, is that you need a usb analyzer to even confirm the problem
06:26:00 <klange> I have pcie and vl805 init as of earlier last year, then I went on vacation, then I promptly forgot everything and now it's a year later.
06:26:00 <klange> I am at the point where I need to build the XHCI / USB / HID stack and that is something I can feasibly do in QEMU with a bog standard XHCI emulation.
06:26:00 <klange> So we'll get there.
06:27:00 <clever> yep
06:27:00 <clever> i think the only thing special on the rpi, is that the controller needs the xhci scratch space setup
06:27:00 <clever> thats an optional thing, so not all xhci controllers require it
06:28:00 <clever> my rough understanding, is that it basically makes the xhci controller cheaper, why put more ram on it, when you can steal some host ram?
06:28:00 <clever> and qemu isnt constrained by how much ram they include on the "xhci chip"
06:30:00 <clever> ive heard nvme can do the same, a cheap stick can store the translation cache in host ram
06:31:00 <clever> while an expensive stick with the identical controller, can store it in a local dram chip
06:46:00 <dinkelhacker> so regarding vfs. Is there on that everybody uses? Do people roll their own?
06:47:00 <klange> The vfs is a concept that you need to build yourself, not a thing you can pull a design off the shelf for.
06:50:00 <mjg> ::]
06:51:00 <mjg> well the classic unix vfs is reasonably documented i think in OS books
06:51:00 <mjg> ont that i would recommend it
06:51:00 <Mutabah> The VFS is just your API between the user (userland or bits of the kernel that want file access) and the filesystem drivers
06:51:00 <mjg> where is a non-crap vfs though
06:52:00 <mjg> aking for a friend
06:52:00 <zid> and interfaces with things like disk caches
06:53:00 <epony> there are designs on that in the FreeBSD and BSD shelves in the library and it has source code and books too.
06:53:00 <epony> supposedly the Linux shelf has some of that too
06:53:00 <epony> no idea about Hurd
06:54:00 <epony> plan9 should have it too
06:54:00 <zid> caches directory lookups, turns filenames into devices + path, etc
06:55:00 <sham1> Or include the device in the path, like with C:\
06:55:00 * sham1 runs
06:55:00 <epony> I can only recommend the design and implementation of the 4.4BSD system and same book about FreeBSD
06:56:00 <epony> McKusick et al
06:56:00 * moon-child trouts sham1
06:56:00 <epony> https://en.wikipedia.org/wiki/Marshall_Kirk_McKusick#Bibliography
06:57:00 <epony> it's a high level details explanations with technical details enough to understand the system sources then
06:57:00 * sham1 chomps on trout
06:57:00 <zid> sham1: still included in what I meant
06:57:00 <zid> it needs to chop the C part off, figure out what *device* C means
06:58:00 <sham1> Yeah, but now you don't necessarily need to look at mount points
06:58:00 <zid> It's still a mount point, it's just.. simpler
06:58:00 <zid> but either way you end up with a 'struct opened_file_yo { struct device *d; ... };'
06:59:00 <sham1> Simple and neat. DOS did have some good things while also being a steaming pile
07:00:00 <dinkelhacker> gosh I'm not even done with my seconf coffee and my brain is already smoking. Thx for the recommendations and explanations. Just 8 hours work ahead xD
07:02:00 <sham1> But yeah, you still need a handle to the drive, but it's easier with Windows paths arguably (of course there still are non-drive letter mount points in modern windows, bleh)
07:02:00 <zid> plus UNC paths
07:02:00 <zid> which may need to do networky stuff
07:02:00 <zid> \\?\ best syntax btw
07:03:00 <sham1> Networky stuff is the problem of the filesystem server
07:03:00 <zid> I mean yea you just treat it like a device as far as the vfs part is concerned
07:03:00 <zid> but your vfs needs to parse it
07:03:00 <sham1> Well, VFS server needs to know that the path is networky, but eh
07:05:00 <mjg> dos?
07:05:00 <mjg> godo things?
07:05:00 <mjg> like what
07:06:00 <sham1> Clearly delineated devices. It's obvious from the path, what device you're talking about
07:07:00 <zid> mount points and links
07:07:00 <zid> are kinda annoying to reason about
07:08:00 <zid> mount points means you can hide files underneath other files, links break your security and deletion is funky, blah blah
07:08:00 <sham1> Plan9 did away with links, and the rationale was very sane.
07:09:00 <sham1> Of course, one could just have a 9p server that implements symlinks, but why one would do so, I have no idea
07:09:00 <clever> on linux, the working directory acts like a file handle, and renaming a directory doesnt break the cwd, i assume there is then a tree of pointers in ram, re-creating part of the directory structure
07:09:00 <clever> but some of that could be cache like, and discarded/recreated on demand
07:09:00 <zid> hardest part of a vfs imo is not making it just.. run out of memory if you add a big device :P
07:10:00 <zid> easy to want to cache a trillion directory entries blindly if I do find /mnt/bigdev
07:10:00 <clever> but ive also seen LK, where the working directory is just a string, cd just appends/deletes elements without validating, and every time you open a file, it traverses the entire path again from /
07:10:00 <sham1> Unused RAM is wasted RAM though
07:10:00 <clever> but LK also doesnt really have processes, so a working directory kinda doesnt fit
07:10:00 <zid> I mean, that command ooms the kernel and it powers offf
07:10:00 <zid> is easy to implement
07:11:00 <clever> zid: you need memory pressure, and the ability to delete vfs entries when malloc fails, then retry malloc
07:11:00 <clever> and dynamically recreate them on demand
07:11:00 <zid> yes
07:11:00 <zid> but that's more code
07:12:00 <zid> than not doing it at all
07:12:00 <zid> hence, harder
07:12:00 <clever> yeah
07:12:00 <clever> LK doesnt cache any vfs state, only the raw blocks of the backing block dev
07:12:00 <clever> so it has to re-parse the fs on every action
07:12:00 <sham1> Disgusting
07:13:00 <clever> LK wasnt really meant to be an os, i think its meant more to be a bootloader?
07:13:00 <clever> so its usually going to read a couple files, then die
07:14:00 <sham1> Well okay, then it makes sense
07:15:00 <clever> and even the cases where i am abusing it as an OS, it only does disk io once during boot, and then never again
07:16:00 <clever> because linux is going to take over the block device, and sharing hardware between 2 kernels isnt easy
07:48:00 <zid> I think if I just wanted some 'light' caching I'd just pool allocate the structs out of a fixed block of memory
07:48:00 <zid> and then if I wanted to be extra fancy, come up with an eviction strategy
08:51:00 <geist> clever: like hell it's meant to be a bootloader
08:52:00 <geist> it's just not trying to have that level of overhead in the FS layer
08:53:00 <geist> it's more of an embedded system, where in general trading memory for caching is not desirable
08:53:00 <geist> OTOH i would like to spiff up the VFS, but i also have other things to work on
08:54:00 <clever> geist: thats why i had a ? at the end, wasnt sure
08:55:00 <geist> note the strategy if treating the CWD as a string is not that strange, it's just not a unixy thing to do
08:56:00 <clever> yeah, its just an alternative solution
08:56:00 <geist> VMS notably did it that way. in general your working dir is basically a 'prefix' to your path
08:56:00 <Mutabah> Pretty sure I did that in my previous attempt
08:56:00 <geist> ie, `set def [foo]` kinda stuff
08:57:00 <geist> vms operates much more along the line of having lots of process and job and shell variables that are somewhat more powerfuly expanded by the OS than unix does environment variables
08:58:00 <kazinsal> a fun one is the Cisco OSes, which have no concept of working directory
08:58:00 <kazinsal> all paths are absolute
08:59:00 <geist> yeah exactly. working directory is just one of those things that seems fairly universal now, but really isnt required per se
08:59:00 <geist> unix made it somewhat of a first class citizen in that the kernel tracks the cwd of a process, but it doesn't really *have* to
09:00:00 <geist> it's just a thing that seems kinda natural now because everything has it
09:00:00 <clever> with the recent additions like `openat`, the cwd could be entirely in userland
09:00:00 <kazinsal> this can get a bit funky on some devices where the path/filespec "running-config" may be "memory:/running-config" or "system:/running-config" or just a nebulous "running-config"
09:00:00 <clever> and you could even have a seperate working dir for every light thread (userland context switching)
09:02:00 <kazinsal> imo it makes sense to make cwd a userland thing especially if you have a standard, system-provided userland library that's either dynamically linked or a vDSO type thing
09:02:00 <geist> yah, whether orn ot it's performant and/or breaks your security model is a different thing
09:02:00 <kazinsal> the vfs and subsequent pfs (is that a term?) endpoints get simplified a lot if you always provide them absolute paths
09:03:00 <clever> the only case i can see where cwd kinda leaves userland, is with execve, how do you pass that working dir over to the new exe?
09:03:00 <geist> yah tis why i'm not overly interested in revisiting the cwd as a vfs construct
09:03:00 <clever> do we just extend stdin/out/err, and make cwd the 4th fh?
09:03:00 <geist> could do it VMS style: a system variable
09:03:00 <geist> in whatever mechanism env vars are passed
09:04:00 <kazinsal> clone the existing environment and use the `char** envp` to update
09:04:00 <clever> i can also see how you might entirely delete the concept of the / and chroot
09:04:00 <kazinsal> maybe this isn't valid per the posix spec, I'm not sure
09:04:00 <clever> just pass the root dir as a second file handle, along stdin/out/err/cwd
09:05:00 <clever> then chroot is just changing what handle you give to execve
09:05:00 <geist> probably not. i have a suspicion that not having a kernel mediated CWD would break some other stuff, like renaming dir structures that you're a cwd in and whether or not posix says it has to follow
09:05:00 <clever> i'm thinking along the lines of cwd is still a file handle, but its in the normal open file table, not a magical field on the proc
09:05:00 <geist> ie, if your CWD is /foo/bar and foo gets renamed to foo2 does it still work? in posix it does, your cwd is just now intrinsically /foo2/bar but dunno if its specced that way
09:05:00 <geist> or just is that way because that's how it works
09:06:00 <clever> and userland is free to have multiple dirs open
09:06:00 <clever> so it will follow the rename as before
09:06:00 <kazinsal> now becomes a problem of where you maintain the cwd path to vfs/inode mapping
09:07:00 <moon-child> what if userspace cwd is a pointer instead of a pathname?
09:07:00 <Mutabah> Challenge with a fd based cwd is - how do you go up?
09:07:00 <moon-child> right
09:07:00 <kazinsal> and this is why my two to-do OS projects are dumb and don't give a rat's ass about the end user experience
09:07:00 <moon-child> fuchsia answer is: you can't, and that's a feature
09:07:00 <clever> Mutabah: openat(cwd,"..")
09:07:00 <moon-child> I think that's not unreasonable
09:07:00 <clever> now you have a handle to the parent dir
09:08:00 <Mutabah> assuming that's present in the filesystem
09:08:00 <geist> *this* is why .. exists
09:08:00 <clever> then you close the old cwd, and overwrite the cwd var {tls|global} var
09:13:00 <clever> geist: i feel like .. existing on-disk, is also to allow for a dumber fs driver, an ext{2,3,4} file handle could just be an inode# alone, and you can still .. your way up to the root, without having to track the directory structure in ram
09:13:00 <geist> right
09:13:00 <clever> and thats also a reason you cant hardlink directories
09:14:00 <geist> and . lets you look up the inode number of a dir based on just the dir entries itself
09:14:00 <clever> which parent does .. point to?
09:14:00 <geist> correct
09:14:00 <sham1> Right up until you'll have to cross a mount point, so at least those are needed to augment the otherwise naïve processing
09:14:00 <clever> sham1: and thats also where chroot escape exploits arise
09:17:00 <gog> mew
09:17:00 <mjg> sham1: the device letter thing is imo a major drawback
09:17:00 <gog> i have to work with google analytics again today somebody kill me
09:17:00 * kazinsal pets gog
09:17:00 <mjg> gog: do you happen to have a bottle of bleach nearby?
09:17:00 <gog> yes
09:17:00 <mjg> gog: check under the sink or perhaps in the bathroom
09:17:00 <mjg> perfect
09:17:00 <mjg> now open it
09:17:00 <gog> ok
09:18:00 <gog> then what?
09:18:00 <mjg> call help
09:18:00 <gog> :P
09:18:00 <sham1> This is the Google Analytics prevention hotline
09:19:00 <epony> you have been prevented to analyse yourself
09:19:00 <mjg> press 1 to for help finding bleach
09:19:00 <mjg> press 2 for life guidance
09:19:00 <kazinsal> we're here to reassure you that everything is okay, ML is just a fad, and the six speed manual transmission will be here for decades to come
09:19:00 <epony> 7 speed
09:19:00 <mjg> your call is very important to us
09:20:00 <zid> ML is not a fad, but it will always suck
09:20:00 <mjg> 8 to pick an optin at random
09:20:00 <epony> press * for the matrix
09:21:00 <sham1> I'm doing ML stuff at uni and I can confirm, it does indeed suck
09:21:00 <epony> no, your Uni sucks
09:21:00 <epony> you'll suck later when you graduate too
09:21:00 <zid> stochastic parrot
09:21:00 <mjg> can we use more inclusive language here
09:21:00 <mjg> lemme lead the charge
09:21:00 <zid> it.. turbo mega fucks the pooch?
09:22:00 <mjg> this is unprofessional zid
09:22:00 <epony> for now, just Turbo Basic
09:22:00 <zid> How do I be professor
09:22:00 <epony> you can't
09:22:00 <mjg> if you have concerns about quality of a solution, project or whatever else
09:22:00 <mjg> you can raise them respectfully
09:23:00 <sham1> I mean, there's interesting tech behind ML, but the problem is that it's touted as a silver bullet. Although that's just marketing department
09:23:00 <moon-child> you also have to have at least 3 avxes
09:23:00 <mjg> people say the world ends not with a bang, but with a wimper
09:23:00 <zid> If stochastic parrots are the solution to your problem, it's not a very interesting problem
09:23:00 <mjg> but it really ends with ML results on IOT
09:24:00 <kazinsal> doomerism is the most boring thing my fellow millennials could have devoted themselves to and I hate it
09:24:00 <zid> performance doesn't matter, accuracy doesn't matter
09:24:00 <epony> btw, fun fact, one of Nirvana's albums was called BLEACH
09:24:00 <zid> It might be okay for like, video games?
09:24:00 <epony> mostly because of the wigs they were wearing at the time
09:25:00 <epony> you know one of those judgemental wiggies
09:25:00 <zid> and advertizing
09:25:00 <epony> like the Brits wear to dinner parties during planneddemic
09:26:00 <sham1> But yeah, apparently GAnalytics is illegal here
09:26:00 <gog> where?
09:26:00 <epony> Google is banned from R&D Universities in EU
09:26:00 <mjg> looking to move gog? :p
09:26:00 <moon-child> kazinsal: tbf
09:26:00 <sham1> Finland. And apparently there's some more general EU trouble as well
09:26:00 <moon-child> world is kinda going down the shitter
09:26:00 <moon-child> sooo
09:26:00 <epony> because GOOG will steal your secrets
09:27:00 <zid> finland the tropical paradise, fancy!
09:27:00 <gog> ah yeah. GA4 was meant to comply with GDPR stuff
09:27:00 <mjg> chromium aready stole my cpu cycles
09:27:00 <gog> we still ahve to get cookie consent
09:27:00 <zid> That's some prime real-estate you've got there sham1
09:27:00 <gog> which we weren't because my boss removed the fucking HTML for the cookie consent thing
09:27:00 <gog> he doesn't know why
09:28:00 <gog> i fixed it but idk how long it was like that :|
09:28:00 <gog> the good news is that we weren't collecting analytics on anybody during that time lol
09:28:00 <zid> the cookie consent thing is turbo dogshit
09:28:00 <zid> It isn't needed and isn't useful either
09:29:00 <heat> the cookie consent popups are always slightly misleading in getting you to click accept all
09:29:00 <gog> yes
09:29:00 <heat> there ought to be regulation on that really...
09:29:00 <sham1> Hmm, actually I misread. The fine was for not properly handling the Referer-header
09:30:00 <zid> Top tip: If the website has one, they're SO worried about doing illegal shit, they're trying to get you to accept a EULA first
09:30:00 <heat> they are required to have one aren't they? with gdpr
09:30:00 <zid> no
09:30:00 <zid> they're required not to do illegal shit without consent
09:30:00 <sham1> Good thing those kinds of EULA are not enforceable
09:30:00 <GeDaMo> You only need to ask for consent for 'essential' cookies
09:30:00 <zid> non*
09:30:00 <GeDaMo> Yeah, sorry
09:31:00 <zid> functional stuff is fine, it's the extra spyware you have to 'agree' to
09:31:00 <heat> i had a plugin that auto fucked-off those popups but it broke some websites
09:31:00 <sham1> Going to a website sometimes feels like playing Cookie Clicker
09:31:00 <zid> best part: if you don't enable cookies, the fucking banner comes back, every time
09:31:00 <GeDaMo> uBlock Origin removes a lot of cookie consents
09:31:00 <epony> as a joy to you all, now wikipedia has new mode for people with disabilities, check on https://en.wikipedia.org/wiki/Microsoft for a sample
09:31:00 <heat> hmm
09:31:00 <heat> possibly
09:32:00 <zid> I'm already implicitly allowing you to set cookies by visiting your domain, if I didn't want third party cookies I'd block them anyway which.. I do
09:32:00 <heat> but I do use chrome on mobile so no ublock for me
09:32:00 <zid> so to me it PURELY fucked me over
09:32:00 <zid> as now I have to actually accept a EULA
09:32:00 <sham1> Is Microsoft a disability now?
09:32:00 <zid> in order to make the website's stupid banner stop blocking the content
09:32:00 <heat> i have my cat on my lap
09:33:00 <heat> this is nice
09:33:00 <zid> did you find it?
09:33:00 <zid> or buy it?
09:33:00 <sham1> PET IT
09:33:00 <heat> i am petting it
09:33:00 <heat> zid, we found it ye
09:33:00 <zid> I was talking to the cat.
09:33:00 <heat> we no buy animals, buying animals bad
09:33:00 <heat> oh ok, he says ""
09:33:00 <kazinsal> do catgirls count as animals
09:34:00 <heat> yes and no
09:34:00 <LivewareProblem> i mean kinda?
09:34:00 <sham1> I suppose
09:34:00 <clever> do humans count as animals?
09:34:00 <LivewareProblem> oh right
09:34:00 <sham1> Although you probably couldn't own one
09:34:00 <LivewareProblem> humans are animals
09:34:00 <LivewareProblem> i forgot
09:34:00 <heat> sham1, don't kink shame
09:34:00 <LivewareProblem> yeah so clearly catgirls are also animals
09:34:00 <LivewareProblem> heat: lmao
09:35:00 <sham1> No, they're actually fungi
09:35:00 <kazinsal> mycelium catgirl body pillow
09:35:00 <moon-child> lol
09:35:00 <sham1> Anyway, office slippers are so nice
09:35:00 <heat> wtf
09:35:00 <heat> why do you have them
09:36:00 <epony> NZ PM steps down to attend to fungi too.
09:36:00 <sham1> Because I'm in an office. Duh
09:36:00 <LivewareProblem> sham1: pog
09:36:00 <moon-child> all slippers are slippers if you're in an office!
09:36:00 * moon-child wanna cat
09:37:00 <GeDaMo> Possibly NSFW images https://kawaiibabe.com/products/3d-paw-print-pad-stockings
09:37:00 <heat> a part of me wants to go out and get some decent coffee, another part of me wants to go watch the tennis, but the largest part of me just wants lap cat
09:38:00 <heat> GeDaMo, possibly is an understatement
09:38:00 <zid> heat: buy me a coffee, make the cat watch the tennis
09:38:00 <zid> there, problems solved
09:38:00 <zid> why I have to do all the thinking round here
09:38:00 <heat> the cat does not give a shit about tennis
09:38:00 <heat> he's a badminton cat
09:39:00 <zid> *make*
09:39:00 <zid> Have you seen a clockwork orange
09:39:00 <heat> no
09:39:00 <zid> you should
09:39:00 <heat> why
09:39:00 <sham1> Have you read it though?
09:40:00 <zid> It is relevent, and also a good movie
09:40:00 * gog catgirls
09:40:00 <heat> gog, cat
09:40:00 <LivewareProblem> gog: moon-child needs a cat
09:40:00 <heat> moon-child, go to your local cat shelter
09:41:00 <heat> plenty of them cats
09:41:00 <gog> catgirl shelteer
09:41:00 <moon-child> can't. landlord policy
09:41:00 <moon-child> :\
09:41:00 <heat> lmao
09:41:00 <kazinsal> no pet policies in my current lease but I can't find any unwanted catgirls
09:41:00 <kazinsal> sigh
09:42:00 <zid> why would you get a cat girl
09:42:00 <zid> when you can get a goth gf
09:42:00 <kazinsal> tag team them against the femboys and we'll see what the real outcome looks like
09:42:00 <LivewareProblem> why not both?
09:43:00 <heat> because cat girl and cat boi cannot live in peace
09:43:00 <heat> there can only be one
09:43:00 <zid> My type is 'demon lord' but I don't think there's a dating site for those
09:44:00 <kazinsal> you'd think catgirl and catboy would just be ruttin mad like hamsters
09:44:00 <epony> you can get your own food timestamps
09:44:00 <gog> a catgirl and a goth gf can be one in the same
09:44:00 <epony> not in Iran
09:44:00 <LivewareProblem> gog: that's what I said
09:45:00 <gog> oh
09:45:00 <gog> :)
09:45:00 <moon-child> who the fuck is LivewareProblem
09:45:00 <moon-child> is it aoei
09:45:00 <gog> yes
09:46:00 <zid> what's an aoei
09:46:00 <zid> is it the person who was quantumbanana the other day
09:47:00 <moon-child> maybe?
09:47:00 <LivewareProblem> nah, I'm actually a demon lady
09:47:00 <kazinsal> yo where do I get a goth catgirl gf who will fuckin step on me^H^H^H^W^W^W^W^W^W
09:47:00 <zid> named dan?
09:47:00 <zid> or is it jan
09:47:00 <LivewareProblem> kazinsal: I can do 2/3
09:47:00 <epony> a Japanese word for them your PC is on screen safe mode
09:47:00 * LivewareProblem is not a catgirl
09:47:00 <zid> kazinsal: Sounds like you want a demon lord also
09:48:00 <LivewareProblem> or a demon lady!
09:48:00 <zid> lord is neuter
09:48:00 <LivewareProblem> is it?
09:48:00 <moon-child> not _yet_
09:48:00 <LivewareProblem> it sounds so masc
09:48:00 <sham1> I just saw the new Wikipedia. Eugh
09:48:00 <epony> or just a landlord
09:48:00 <kazinsal> demon *mommy* god dammit you fucks
09:48:00 <zid> it's the same for me so far, but I did see someone else moaning
09:48:00 <zid> oh no I don't want a mommy
09:48:00 <sham1> If you're going to do a redesign, why not have the top-bar of the page also stick to the top of the screen
09:48:00 <heat> why do cats breathe so fucking fast
09:48:00 <zid> that's way out of my strike range
09:48:00 <heat> it's nuts
09:48:00 <zid> heat: higher heatbeat
09:48:00 <zid> smaller thing
09:49:00 <zid> mice are like 800bpm
09:49:00 <heat> zid, they need to calm the fuck down
09:49:00 <GeDaMo> Oh, I just read about the redesign
09:49:00 <GeDaMo> Eh ...
09:49:00 <moon-child> heatbeat
09:49:00 <GeDaMo> I'm not sure that's an improvement
09:49:00 <heat> the arch wiki went through the redesign a few months ago
09:49:00 <heat> maybe year?
09:49:00 <LivewareProblem> kazinsal: so uhhh i heard you're lookin for a demon mommy huh
09:50:00 <zid> shion > nina
09:50:00 <GeDaMo> At least it still works without JS
09:50:00 <epony> after 7-8 pages of scroll down
09:51:00 <epony> 500 lines of text to first paragraph.. fantastic stupidity
09:51:00 <GeDaMo> Why do sites insist on so much blank space at the sides?
09:51:00 <epony> because people have very narrow eyes like cats
09:51:00 <epony> and sheep
09:51:00 <zid> cus they aren't columnated
09:51:00 <Ermine> because text width should be less than 80-100 characters
09:52:00 <epony> it's a sheeple redesign for more baaah
09:52:00 <zid> and there's no real advantage to super long lines
09:52:00 <zid> the question is why do people have their browsers 8000 pixels wide
09:52:00 <epony> landlord mode
09:52:00 <epony> check it out in w3m https://en.wikipedia.org/wiki/Microsoft looks like someone shat over their design hands
09:53:00 <zid> We should settle on all websites being A4 sized
09:53:00 <sham1> GeDaMo: having the top bar stick would also work without JS. You just need a bit of CSS. Hell, the ToC already stays with your scroll position
09:53:00 <Ermine> Wide lines are unergonomical. That's something book publishers know for quite a lot time
09:53:00 <epony> first scroll 8 pages
09:54:00 <zid> position: fixed;
09:54:00 <zid> float absolute
09:54:00 <zid> blah blah
09:54:00 <zid> I did css once, 20 years ago!
09:54:00 <GeDaMo> The site shouldn't be trying to dictate how wide the text is, I can adjust my window if it's too wide
09:54:00 <Ermine> zid: wide browsers can be used for more columns I guess
09:55:00 <zid> GeDaMo: I disagree, I'd rather be able to chop content off by resizing
09:55:00 <sham1> There's a full-screen button at the bottom right, which widens the text
09:55:00 <zid> it's been impossilble for a decade to say, crop down a website so that you can only see the video player
09:55:00 <zid> or paragraph of text you're interested in
09:55:00 <sham1> Although I guess that doesn't work without JS
09:55:00 <zid> because they now all reflow
09:56:00 <GeDaMo> sham1: :|
09:56:00 <zid> so I have to have bbc iplayer open fullscreen or whatever just to have a 480p video player onscreen
09:56:00 <sham1> Why don't website vendors remember that Reader mode exists specifically for the reading experience if one needs it
09:56:00 <zid> because users don't
09:56:00 <zid> users ruin everything afterall
09:57:00 <sham1> True
09:58:00 <heat> zid, oi do you have a tv license
09:58:00 <epony> it's a cone spiracy of halitosis and bad headache from eating too much concetrated garlic farts
09:58:00 <zid> yes
09:59:00 <zid> do you pay your netflix licence
09:59:00 <epony> it's called petfleax
09:59:00 <heat> yes
10:00:00 <Ermine> GeDaMo: going further, the fact of site being able to control how data are presented to user is flaw of HTML/CSS. Stuff like gemini tries to address this.
10:00:00 <zid> html should be latex, and document size should be fixed to A4, fite me irl
10:01:00 <epony> the GOOG page looks better than the MSFT one https://en.wikipedia.org/wiki/Google
10:01:00 <epony> so.. maybe must MSFT and AAPL are full of shit
10:02:00 <zid> 16:9 can fuck off as well, let's go for 1:2^0.5
10:02:00 <epony> it's technically 22:9
10:02:00 <epony> or 21:9
10:03:00 <epony> but you get cheated of the other 5-6 parts
10:03:00 <GeDaMo> The Google page still looks like the old design to me
10:04:00 <Ermine> zid: wee need (sqrt(5)+1)/2
10:04:00 <zid> no
10:04:00 <zid> 2^0.5 or bust
10:05:00 <Ermine> Golden ratio or bust
10:05:00 <zid> bloody americans
10:05:00 <zid> and their LETTER
10:05:00 <zid> Don't understand the glory of DIN
10:06:00 <Ermine> ?
10:06:00 <zid> https://en.wikipedia.org/wiki/ISO_216#A_series
10:07:00 <epony> for idiots: https://en.wikipedia.org/wiki/21:9#Smartphones
10:10:00 <Ermine> Ah, LETTER is some other paper size which I never cared about...
10:11:00 <zid> PC LOAD LETTER
10:12:00 <Ermine> too many LETTERs
10:12:00 <Ermine> bloody muricans indeed
10:13:00 <epony> and then the letterbox
10:13:00 <epony> and forking noto fonts
10:19:00 <zid> Warning: This program containad strong language and adult themes
10:27:00 <zid> and por spelig
10:34:00 <heat> best spelled efi spec
10:35:00 <epony> it was supposed to be UFOY but ended up UEFIed up
10:36:00 <epony> Apple always gets things wrong..
10:42:00 <mrvn> happy new year
10:43:00 <Ermine> happy new year mrvn
10:48:00 <mrvn> I've been pondering debugging kernel crashes better so tell me if this is the greatest idea since sliced toast: each core gets a ring buffer for debug output and when investigating crashes you turn on debugging in suspected functions (compile time, runtime, whatever system you have) and that just dumps all the output into the ring buffer. Then on BUG(), GP, panic() the debug ring buffer is dumped along with
10:48:00 <mrvn> the register and stack dump.
10:49:00 <epony> CPUs have now USB debugging exposed
10:49:00 <mrvn> That way you aren't flooded with debug output while everything still works but on crash you can all the output you missed to the extend of the ring buffer.
10:49:00 <mrvn> +see
10:51:00 <heat> but you're still slow in that case, aren't you?
10:53:00 <mrvn> as slow as converting the debug stuff to ascii is.
10:54:00 <mrvn> not as slow as waiting for it to be written to a file.
11:20:00 <epony> China will be having the best viralunar new year any time now, very soon.
11:21:00 <clever> epony: the usb debugging that ive seen (ehci debug), is less of a jtag port, and more of a uart, that lets you talk over a usb cable without a usb stack
11:21:00 <epony> jtag is nice
11:22:00 <clever> basically, the ehci controller, can drive an ehci debug dongle, without a usb stack
11:22:00 <clever> and you can just give it bytes, like a dumb uart
11:22:00 <epony> processors have management controller systems in them now too
11:22:00 <clever> but as part of the design, its usb2 only, it cant downgrade to usb1
11:23:00 <zid> I've seen usb3 snifferers
11:23:00 <zid> they're expensive af though
11:41:00 <mrvn> clever: does Linux network console work on RPi?
11:41:00 <mrvn> (or rather how well?)
11:43:00 <clever> mrvn: hmmm, ive not really tried it
11:43:00 <clever> the firmware also has its own net console
11:45:00 <dinkelhacker> Does anybody know if I can emulate a raspi3/4 like system timer peripheral with the virt machine type?
11:45:00 <clever> mrvn: let me try setting it up, and see what happens
11:45:00 <clever> dinkelhacker: pi3/pi4 are using the standard arm generic timer, which qemu should emulate
11:45:00 <clever> the vpu timer is still present, but doesnt have enough channels
11:46:00 <clever> and cant do per-core irq's
11:48:00 <dinkelhacker> clever: I find a "armv8 timer" in qemu's dts but it has no "reg" specified o.O ?
11:48:00 <clever> dinkelhacker: you access it with msr/mrs
11:48:00 <dinkelhacker> So i was assuming this is some core interal timer which might be accessed via system registers.
11:49:00 <clever> i think
11:49:00 <clever> let me check how LK does it
11:49:00 <clever> yep
11:50:00 <dinkelhacker> yeah but the bcm2711 has a system timer mapped to 0xFE003000
11:50:00 <dinkelhacker> https://datasheets.raspberrypi.com/bcm2711/bcm2711-peripherals.pdf
11:50:00 <clever> dinkelhacker: https://github.com/littlekernel/lk/blob/master/dev/timer/arm_generic/arm_generic_timer.c#L27-L49
11:50:00 <bslsk05> github.com: lk/arm_generic_timer.c at master · littlekernel/lk · GitHub
11:51:00 <clever> dinkelhacker: 0x7e003000/0xFE003000 is the vpu timer, entirely seperate from the arm timers
11:52:00 <clever> the vpu timer has a CLO/CHI 64bit counter, that counts as 1mhz, and 4 compare (C0/C1/C2/C3) channels, that fire an irq each, when CLO matches
11:52:00 <clever> but the VPU firmware needs 2 of those channels
11:52:00 <clever> and the VPU timer cant trigger per-core irq's on the arm
11:52:00 <mrvn> clever: how does the firmware net console work? mailbox on the RPi side and same format as linux on the ether?
11:52:00 <clever> so it basically became useless the moment the arm got 4 cores
11:53:00 <clever> mrvn: its only active during the firmware bootloader, and dies as soon as start4.elf is executd
11:53:00 <clever> the official docs, recommend using it to dump usb logs, when it cant boot from usb
11:53:00 <clever> because it doesnt have the same bandwidth limits as uart
11:53:00 <mrvn> dinkelhacker: the vpu timers are common to all RPis and run at 1MHz.
11:53:00 <dinkelhacker> clever: yeah right.. I've been using that so far on the actual HW to trigger the scheduler but now that I want to work more with qemu I wondered if I it can emulate that
11:54:00 <clever> dinkelhacker: qemu does emulate the VPU timer, at the same address
11:54:00 <clever> but using the arm generic timer is better
11:54:00 <clever> each core has its own timer, and irq's go back to that core
11:54:00 <dinkelhacker> but only if I use the rpi3 machine type right? not with virt?
11:55:00 <clever> yeah, only the rpi based machines have the vpu timer
11:55:00 <mrvn> dinkelhacker: virt on an RPi?
11:55:00 <clever> if you use arm virt, youll only have generic arm timers
11:55:00 <dinkelhacker> Makes sense.
11:56:00 <mrvn> If you use ARM virt then you also get memory at 0x20000000 unlike the RPi that has it at 0x0. The kernel gets loaded to a different address.
11:56:00 <mrvn> iirc
11:57:00 <clever> thats also why you should be parsing dtb if you can
11:57:00 <clever> in theory, you can build one kernel, that works on both virt and rpi, including real hardware
11:57:00 <clever> it should just parse the dtb, and initialize the right drivers for the current system
11:57:00 <dinkelhacker> mrvn: I started developing on the actual pi, than fiddled around with the -M rpiX and now want to use virt to be a bit more flexible.
11:57:00 <mrvn> which is indeed quite hard
11:58:00 <dinkelhacker> Yeah parsing the dtb is on my TODO list.
11:58:00 <clever> personally, i would start by ignoring dtb, and get uart, printf, and maybe heap online
11:58:00 <clever> then use that to debug the dtb stuff, and start using dtb
11:58:00 <mrvn> dinkelhacker: you need to hand craft asm code to be position independent and relocate your kernel or map virtual memory and jump there. Can't do it in C.
11:58:00 <mrvn> (safely)
11:59:00 <clever> but most of my arm stuff, has been in a pre-dtb situation, so i havent really been able to do that
11:59:00 <dinkelhacker> mrvn: For me it loads actually to 0x40080000
11:59:00 <mrvn> or link your kernel to where the cpu model you emulate has the memory.
12:01:00 <mrvn> dinkelhacker: so you can put that into the linker script and check where the UART is in the dtb by hand and hardcoded that too and you cna print debug stuff for the rest.
12:01:00 <dinkelhacker> I have uart working, basic smp, locking and now wanted to dig deeper into heap stuff. But for that I wanted to get a nicer qemu setup so I won't become insame with the real hw.
12:02:00 <mrvn> all of that breaks when you switch from RPi to virt, probably.
12:02:00 <mrvn> The DTB describes the hardware layout and since you don't parse that you won't adjust to the changed layout.
12:03:00 <dinkelhacker> but from what I understand I basically just have to change my timer code to use the ARM generic timer, and have a second memmap for the virts peripheral base adresses and than I should be good
12:03:00 <mrvn> at a minimum
12:03:00 <dinkelhacker> Yeah of course I have to adjust all the addresses as long as I don't have the dtb parsing.
12:03:00 <clever> the rpi is using a pl011 uart, the same as arm-virt
12:04:00 <mrvn> the DTB tells you which uart to use as console too
12:04:00 <clever> so you just have to change the base addr of the uart, and that should come back
12:04:00 <clever> assuming you have the basics (mmu, ram) working
12:04:00 <mrvn> clever: depends on BT being active or not
12:04:00 <clever> yeah
12:04:00 <clever> bt can also run on the mini-uart
12:04:00 <dinkelhacker> bt?
12:05:00 <mrvn> Is anyone developing their RPi kernel with BT activated?
12:05:00 <clever> bluetooth
12:05:00 <mrvn> bluetooth
12:05:00 <clever> some might, by not knowing how the muxing works, and what options exist
12:08:00 <dinkelhacker> I just tried a minimal image with qemu and I get output from the pl011 so that seems to work. So yeah gotta change the timer code so I can have all 4 cores print heartbeat messages every second (that's basically all it does so far >D). Then it should work on qemu and the p.
12:09:00 <mrvn> how do you multitask with just the vpu timer? Fixed time slices?
12:10:00 <dinkelhacker> yes... like every second I get an interrupt, and all cores swich to the next task
12:11:00 <mrvn> doing tickless multitasking has real benefits.
12:11:00 <dinkelhacker> I root the interrupt to one core and that interrupts all other cores with sgis^^
12:13:00 <dinkelhacker> Well this was just "convenient" to work on spinlocks..anyway it's just a toy/learning setup at the moment. What do you mean with tickless multitaskin?
12:14:00 <clever> dinkelhacker: if there is only 1 task scheduled on a core, dont set a timer to interrupt it
12:14:00 <mrvn> you don't generate an interrupt every second but you set the timer to fire when you next need to wake up.
12:14:00 <clever> let it be!
12:15:00 <mrvn> E.g. if some process does "usleep(500);" you set it to 500us from now. When you only have one process ready to run you might not set a timer at all.
12:15:00 <mrvn> If a process started with a 1s time slice but got interrupts 0.6s into that slice you set the timer for the remaining 0.4s.
12:16:00 <zid> That's a very very minor detail
12:17:00 <clever> when LK is built with dynamic timers, it does a bit of both
12:17:00 <dinkelhacker> Oh yeah of course there are much better strategies for "real" applications. Sice I wanted to see if the task switching works that was just the first thing I came up with.
12:17:00 <clever> there is a software timer layer, that keeps track of every timer
12:17:00 <clever> and then the hw timer, schedules an irq for when the next software timer will expire
12:17:00 <clever> but, then scheduler wont create timers, if there are no more runnable threads
12:18:00 <clever> so if there are enough cores to go around, it never ticks
12:18:00 <mrvn> clever: the "no timer with just one process" is actually much harder than the rest I feel.
12:18:00 <clever> but if there is a sleeping thread, with a 12 second timer left on it, then in 12s, it will create a hw timer for 12s, and and then consider context switching then
12:18:00 <moon-child> why?
12:19:00 <clever> above statement is a bit jumbled, paused mid-sentence
12:20:00 <mrvn> moon-child: many special cases. You have to add the timer when some other process wakes up. Have to account for the time run without timer. add timer on fork, ...
12:20:00 <clever> mrvn: what causes the wakeup?
12:21:00 <mrvn> do you have one task per core? Can you reshuffle so they are evenly distributed? Any of them pinned to a core?
12:21:00 <mrvn> clever: any interrupt. e.g. NIC getting data
12:21:00 <clever> smp LK, is something i understand less
12:21:00 <clever> lets say LK gets a NIC irq, and then decides to wake a thread that was waiting for data
12:21:00 <mrvn> or one core forking and tasks getting reshuffeled.
12:22:00 <clever> at the end of the irq handler, it will then consider context switching to that new thread, based on how much of a timeslice the previous thread had used
12:22:00 <clever> i'm fuzzy on if it always context switches, or sets a timer and doesnt
12:23:00 <clever> so the nic irq, is what triggers the context switch, and gets it out of a timer-free state
12:23:00 <mrvn> It should switch if the woken up task has a higher priority or larger time slice remaining.
12:23:00 <clever> and now 2 threads are runnable, so a timeslice irq is setup
12:23:00 <clever> i would assume it always has a large timeslice, if all slices default to the same
12:23:00 <clever> because it would have been sleeping, and has a fresh slice
12:23:00 <mrvn> clever: ahh, so you don't create a software timer for the time slice but just add that in hardcoded at the last moment
12:24:00 <clever> yeah, there was only 1 runnable thread, so no timer exists
12:24:00 <clever> the NIC/uart irq then breaks it out of that stale-mate
12:24:00 <mrvn> A sleeping process should only get a new timne slice if it slept long enough that it would have run again.
12:24:00 <clever> also depends on why it is sleeping
12:25:00 <mrvn> not really.
12:25:00 <clever> was it blocked on a fifo? or sleeping a set time?
12:25:00 <clever> ah, you mean about sharing cpu evenly, rather if a timer should exist
12:25:00 <mrvn> then it runs on the remaining time slice if the sleep was short or a fresh one if the sleep was long enough to round-robin at least once.
12:25:00 <mrvn> yeah
12:26:00 <mrvn> Otherwise you get the old unix behavior where tasks get more CPU time when you enter keys every now and then because the keyboard interrupt refreshes your time slice.
12:26:00 <clever> that actually sounds like a bug i get when the mouse all the time
12:27:00 <clever> if i'm dragging an icon, and its at the edge and causing scrolling, its rather slow
12:27:00 <clever> if i wiggle the mouse around, within the trigger, it scrolls faster
12:27:00 <clever> because its scrolling both on mouse-move, and on timer
12:27:00 <epony> that's the UI, not the mouse doing it
12:27:00 <mrvn> If you have dynamic priorities then calling "yield();" just before your timeslice is up can also screw with that.
12:27:00 <clever> epony: id say its a bug in the UI, doing 1 tick of scrolling, every time an event happens
12:28:00 <mrvn> clever: ahh, I think that faster scrolling is a feature by now.
12:28:00 <clever> and the mouse is able to span events faster then the configured timer
12:28:00 <clever> spam*
12:28:00 <mrvn> Might have started as a bug of exactly that nature but I've seen that in a lot of apps.
12:29:00 <mrvn> usefull feature.
12:29:00 <clever> mrvn: https://media.discordapp.net/attachments/686426076993683503/1065608935760998520/unknown_8.png
12:30:00 <epony> https://en.wikipedia.org/wiki/Scheduling_(computing)#Windows
12:30:00 <mrvn> https://qifi.org/ usefull
12:30:00 <bslsk05> qifi.org: pure JS WiFi QR Code Generator
12:30:00 <clever> mrvn: ah nice, i had trouble finding such a site before
12:30:00 <clever> the last hit i found in google, was uterly stupid
12:31:00 <clever> no matter what type of qrcode you try to generate, its always a tiny-url back to their domain
12:31:00 <clever> so they can track every single use
12:31:00 <clever> and if you need the qrcode to get on the wifi, good luck :P
12:31:00 <mrvn> " Don't trust your browser either? Just pipe the string WIFI:S:<SSID>;T:<WPA|WEP|>;P:<password>;; through the QR code generator of your choice after reading the documentation. "
12:32:00 <clever> [nix-shell:~]$ echo 'WIFI:S:name;T:WPA;P:password;;' | qrencode -o wifi-test.png
12:32:00 <clever> thats what ive used in the past
12:32:00 <clever> HIDDEN:true was also mentioned
13:03:00 <dinkelhacker> Any idea why arm called the control register for the EL1 physical timer CNTP_CTL_EL0 o.O?
13:04:00 <dinkelhacker> Shouldn't that be ...EL1
13:08:00 * clever pulls up the 8000 page doc
13:09:00 <GeDaMo> The last version I saw was 11K :P
13:09:00 <dinkelhacker> I have it open and don't get it^^
13:09:00 <clever> GeDaMo: the armv8 docs?
13:09:00 <clever> i think i'm on a 2020 version
13:09:00 <GeDaMo> Yeah
13:10:00 <GeDaMo> Mine is dated 2022
13:10:00 <dinkelhacker> Mine has 11952 (Arm Architecture Reference Manual for A-profile)
13:10:00 <GeDaMo> DDI0487_I
13:10:00 <clever> lets see, CNTP_CTL_EL0, counter-timer physical timer control register, "control register for the EL1 physical timer"!?
13:10:00 <clever> GeDaMo: ah, i have DDI0487F_b_armv8_arm.pdf
13:12:00 <GeDaMo> Looks like I is still the latest
13:13:00 <dinkelhacker> clever: right, so why is it called EL0?
13:13:00 <zid> GeDaMo showing off again
13:14:00 <clever> GeDaMo: what was the link? the search on arm.com is being stupid for me
13:14:00 <clever> dinkelhacker: ok, thats weird, there is no EL1, EL2, or EL3 version of that specific reg!
13:14:00 <clever> there is only EL0!!
13:14:00 <GeDaMo> https://developer.arm.com/documentation/ddi0487/ia/
13:14:00 <bslsk05> developer.arm.com: Documentation – Arm Developer
13:15:00 <clever> ah, 68mb, thats better
13:15:00 <zid> 8.25 byts, nice!
13:15:00 <zid> 8.5 I can count.
13:15:00 <mrvn> It's called _EL0 because it's readable from EL0?
13:16:00 <dinkelhacker> Yeah maybe... according to the pseudo code in the spec it is
13:16:00 <mrvn> by the way: What does DDI0487F stand for?
13:17:00 <clever> i think the F at the end, is a revision for the doc
13:17:00 <clever> since GeDaMo has the I version
13:17:00 <mrvn> 0487 looks like a running number for docs
13:17:00 <clever> no clue what the rest are, some kind of id#
13:17:00 <clever> yeah
13:17:00 <mrvn> Distributed Document Id? *wild guess*
13:17:00 <clever> DDI0500J_cortex_a53_trm.pdf is the docs for a specific armv8 core
13:18:00 <clever> you can also see, its after the number for v8 in general
13:18:00 <mrvn> or Distribution ...
13:18:00 <GeDaMo> Maybe developer
13:18:00 <mrvn> also plausible
14:02:00 <mrvn> building Linux CONFIG_DEBUG_INFOS enabled: -rwxrwxr-x 1 brederlo users 521M Jan 19 10:12 vmlinux
14:02:00 <mrvn> I don't think I will use that as default.
14:16:00 <heat> lol
14:16:00 <heat> yes
14:16:00 <heat> you're not supposed to use debug info in linux except for debugging
14:21:00 <sham1> One wonder what use debug info would have beyond debugging
14:22:00 <clever> sham1: you might want to pre-build with debug info, so when you do later get a backtrace, you can debug it without having to reproduce
14:23:00 <heat> sham1, backtracing
14:23:00 <clever> the symbol table can give functions, but ive had issues before, where i wanted line numbers
14:23:00 <sham1> I class that under (very crude) debugging, but fair enough
14:23:00 <heat> not only debugging e.g profiling too, tracing
14:23:00 <heat> but since dwarf sucks linux developed their own format
14:24:00 <heat> ORC. it's essentially just a struct {where is sp, where is bp;} for every IP in the kernel :)
14:25:00 <sham1> That's… a lot
14:25:00 <sham1> Although it is indeed simpler than DWARF
14:25:00 <clever> wasnt it dwarf, where its basically a bytecode, that returns that data, when given an IP?
14:25:00 <clever> and then the compiler generates switch, if, and lut's?
14:26:00 <sham1> If so then I'm not surprised that JITs don't bother generating that
14:26:00 <heat> dwarf is a lot more complex
14:26:00 <heat> it needs a full interpreter and shit
14:26:00 <sham1> Debug information for JIT compiled code is its own can of worms
14:27:00 <heat> which in theory would be fine except that it's slow as balls and error prone. slow as balls doesn't really belong to a linux profiling code path
14:27:00 <sham1> Especially trying to make it so that an attached debugger can make use of it
14:28:00 <clever> while nix lacks JIT, it does have exceptions
14:28:00 <clever> basically, an exception within the internal language, is just thrown as a c++ exception, but the "run function" function, catches it, adds to the guest stack, then re-throws
14:29:00 <clever> so its unwinding the host stack in chunks, one guest stack frame at a time
14:29:00 <sham1> Well nix is mostly used for config, is it not? Not sure a JIT compiler would add much
14:29:00 <clever> sham1: but it is a turing complete functional programming language
14:29:00 <clever> and the module system can wind up producing a backtrace 100's of calls deep
14:30:00 <sham1> Right, but I still don't know whether it'd need a JIT most of the time. The implementation being an interpreter should be rine
14:30:00 <clever> sham1: when evaluating 100 machines in nixops, it can take 5+ mins, and over 20gig of ram....
14:31:00 <sham1> Although does it at least compile down to even a bytecode? Because if not then that's just bleh
14:32:00 <clever> sham1: its currently just an AST, a giant tree of structs, with function pointers everywhere
14:32:00 <sham1> Ooh
14:32:00 <sham1> No wonder then
14:33:00 <clever> any given value, can either be a concrete type (string, int, list, set, others), or a thunk (a function pointer and some args)
14:33:00 <clever> forceValue turns thunks into concrete types, by editing the struct in-place
14:33:00 <sham1> Yeah, tree-walking famously isn't all that good for performance
14:33:00 <clever> and then recursion runs thru the entire ast, to spit out the final derivation
14:34:00 <clever> and lazyness lets it ignore leaves that it doesnt need
14:34:00 <clever> { a = f 1; b = f 2; c = f 3; }, a set is strict on the keys, but lazy on the values
14:34:00 <sham1> Like from what I've understood, Guix benefits greatly from the fact that Guile actually compiles both to a bytecode and JITs hot code
14:35:00 <sham1> I feel like a similar benefit could be seen in Nix
14:35:00 <clever> so if you are using listToAttrs, or mapAttrs, or "foo${n}" = f n;, it must evaluate every key
14:35:00 <clever> before it can query for a specific key
14:35:00 <sham1> Eww
14:35:00 <sham1> Sounds like JS
14:36:00 <mrvn> Isn't there a target to split the vmlinux into the kernel and debug infos in the format gdb expects (BUILD ID thingy)? I don't mind having 500MB debug infos on the build server but a 500MB kernel for netboot would be bad.
14:36:00 <sham1> Dynamically computing keys like that isn't exactly great. Eval is another
14:36:00 <clever> mrvn: the above vmlinux file, is the ELF build, there should also be a zImage or similar, that i would expect to be smaller
14:36:00 <mrvn> heat: CONFIG_DEBUG_INFOS adds DWARF stuff to the kernel.
14:36:00 <heat> i know
14:37:00 <sham1> Well Fedora for example manages to split the vmlinuz into debuginfo, as does Debian, so I'd suppose so
14:37:00 <clever> sham1: yeah, thats why you need to be aware of this cost, and try to avoid dynamic keys depending on too much state
14:38:00 <clever> if you want good performance
14:39:00 <sham1> Is there a reason why nix doesn't have a compilation step to linearize the tree?
14:39:00 <sham1> Would also allow for other optimization
14:39:00 <clever> sham1: things like overlays can mutate the ast at almost any point
14:39:00 <sham1> Or is it just them not bothering
14:40:00 <clever> and if your modifying an overlay, thats going to add a compile cost every time you edit it
14:40:00 <mrvn> heat: -rw-rw-r-- 1 brederlo users 5.8M Jan 19 10:13 arch/x86/boot/vmlinux.bin
14:40:00 <mrvn> -rw-rw-r-- 1 brederlo users 5.8M Jan 19 10:13 arch/x86/boot/bzImage
14:40:00 <mrvn> (if you build the later)
14:40:00 <sham1> And I'll assume that overlays cannot be determined in a nice manner without running the program? Great
14:40:00 <clever> sham1: another large complexity is the module framework, which is mostly implemented in nix, not c++
14:42:00 <clever> the c++ part, is the builtins.genericClosure function, a way to walk a web of nodes, and generate a list of energy node in the web
14:42:00 <clever> you give it a starting set (modules), and a function to get more (for example, reading .imports from a module)
14:42:00 <clever> and it will then recursively run that function, until it has visited every module, and built up a list of all of them
14:43:00 <clever> then entirely in nix, you have to import every module, find the .options, and merge those trees recursively
14:43:00 <clever> then in a second pass, find the .config of every module, and merge those, based on the rules defined in .options
14:45:00 <clever> and that is heavily doing dynamic keys, and entire dynamic trees
14:49:00 <clever> sham1: another issue, in the case of deploying 100 machines with nixops, each one has different modules loaded, so you cant just pre-compile a single machine sub-tree, and reuse it
14:50:00 <clever> sham1: i feel like you would need to partially compile every file seperately, then have a kind of LTO pass to optimize it further
14:50:00 <clever> with the lack of `do` blocks haskell has, i have a hard time picturing what i would even put into an llvm-ir codeblock
15:12:00 <ddevault> what the heck am I missing with these IRQs
15:20:00 <zid> a mask bit somewhere
15:20:00 <ddevault> oh my god
15:21:00 <ddevault> the pl011 manual is fucking stupid
15:21:00 <ddevault> >On a write of 1 to the particular bit, it sets the corresponding mask of that interrupt. A write of 0 clears the corresponding mask.
15:21:00 <ddevault> 1 /enables/ the interrupt
15:21:00 <zid> yea
15:21:00 <zid> actually you'd assume 1 disables from how it's written
15:22:00 <zid> masked interrupts = non-firing
15:22:00 <ddevault> "sets the mask" to me sounds like it masks the interrupt
15:22:00 <ddevault> "clear the mask" sounds like it unmasks the interrupt
15:22:00 <zid> yes
15:22:00 <zid> and 1 sets the mask bit
15:22:00 <zid> so 1 = disable
15:22:00 <ddevault> wrong
15:22:00 <ddevault> 1 enables it
15:23:00 <ddevault> hence my confusion
15:23:00 <zid> Not according to what they wrote :P
15:23:00 <ddevault> yep
15:23:00 <ddevault> which is why I was confused.
15:23:00 <ddevault> another page has the correct description
15:23:00 <ddevault> >You can enable or disable the individual interrupts by changing the mask bits in the UARTIMSC register. Setting the appropriate mask bit HIGH enables the interrupt.
15:23:00 <ddevault> correct: https://developer.arm.com/documentation/ddi0183/f/programmer-s-model/interrupts
15:23:00 <bslsk05> developer.arm.com: Documentation – Arm Developer
15:23:00 <ddevault> incorrect: https://developer.arm.com/documentation/ddi0183/f/programmer-s-model/register-descriptions/interrupt-mask-set-clear-register--uartimsc
15:23:00 <bslsk05> developer.arm.com: Documentation – Arm Developer
15:24:00 <rwxr-xr-x> Yoo
15:24:00 <rwxr-xr-x> How is everyone?
15:25:00 <zid> isn't it a pl011 btw
15:25:00 <zid> I get like no results for pl101
15:26:00 <ddevault> yes? I called it a pl011
15:26:00 <zid> oh hmm where did I get 101 from
15:26:00 <zid> maybe a different day it came out in a typofest, or I just remembered it badly
15:27:00 <zid> but yea, 1 is definitely enable
15:27:00 <zid> I checked the source for 2 drivers
15:28:00 <zid> and yea your incorrect page is the first result on google for uartimsc, whoopsie
15:29:00 <ddevault> yeah
15:29:00 <ddevault> my driver started working when I changed it to 1
15:29:00 <zid> haha
15:29:00 <zid> http://patches.linaro.org/project/other-unknown/patch/1376406755-23703-1-git-send-email-andre.przywara@linaro.org/
15:29:00 <bslsk05> patches.linaro.org: PL011: fix reverse logic for interrupt mask register - Patchwork
15:29:00 <zid> :D
15:29:00 <ddevault> but I was tearing my hair out because the docs are wrong
15:29:00 <ddevault> lol
15:29:00 <zid> You can enable or disable the individual interrupts by changing
15:29:00 <zid> on page 3-17. Setting the appropriate mask bit HIGH enables the
15:29:00 <zid> the mask bits in the Interrupt Mask Set/Clear Register, UARTIMSC
15:29:00 <zid> interrupt.
15:30:00 <ddevault> yeah I quoted this above
15:30:00 <zid> so they're using the word mask wrong, but they're using it wrong *consistently* at least
15:30:00 <zid> so it's still possible to write a working driver
15:30:00 <zid> they meant 'enabled' everywhere they wrote 'masked' basically
15:31:00 <ddevault> okay good
15:31:00 <ddevault> my interrupts do work
15:31:00 <sham1> What I don't get is why they'd use mask like that
15:31:00 <sham1> Everywhere else it means to disable the interrupt
15:31:00 <zid> cus they're dumbos
15:31:00 <zid> "Enable the reversal of the inverse of the mask of the interrupt disable enable register bit"
15:38:00 <mrvn> clever: you can use continuation-passing-style for most functional languages very easily. Everything is a function that ends by calling another function tail recursively. results are build up in the env/stack object that you pass around.
15:39:00 <sham1> There's also ANF, which has the benefit of not being as funky as CPS
15:39:00 <mrvn> ddevault: Your confusion is about how you interpret "mask". It's mask, not maskED. So the IRQ fires if IRQ & MASK != 0.
15:39:00 <ddevault> kk
15:40:00 <ddevault> that makes more sense, thanks
15:40:00 <mrvn> Iirc x86 works the other way around. You have a mask of IRQs that are blocked, i.e. masked.
15:41:00 <mrvn> sham1: Flughafen Antofagasta?
15:42:00 <sham1> Wot?
15:42:00 <mrvn> ANF, it's the airport in Antofagasta. Wherever that is.
15:42:00 <mrvn> https://en.wikipedia.org/wiki/A-normal_form ?
15:43:00 <sham1> Yeah, A-normal form
15:44:00 <mrvn> I don't think it makes a difference for "do" blocks. They become a function taking a unit/void parameter either way.
15:45:00 <mrvn> ANF seems to be just extending CPS to functions with multiple parameters.
15:46:00 <mrvn> but the wikipedia article is rather sparse on A-normal form. Might be wrong.
15:47:00 <sham1> ANF differs from CPS in that it's in direct style, as opposed to CPS which by definition is not.
15:48:00 <mrvn> what's direct style?
15:48:00 <sham1> So for example, in CPS the Wikipedia example of f(g(x), h(y)) is g_cnt(x, (v0 -> h_cnt(y, v1 -> f_cnt(v0, v1, rest_of_program))))
15:50:00 <mrvn> sham1: or v0/v1 are stored in ENV and not passed to f_cnt. At least v0 not anyway.
15:51:00 <mrvn> sham1: the CPS we used in out compiler course only allowed one argument per function.
15:51:00 <sham1> Well we can make it into a tuple, but the point remains
15:51:00 <sham1> Basically direct style doesn't have that kind of control inversion
15:52:00 <zid> are you talking about compiler nonsense
15:52:00 <sham1> Yes
15:52:00 <mrvn> We compiled ocaml and there every function is curried so: f(v0, v1) is actually (f v0) v1
15:52:00 <zid> disgusting
15:53:00 <mrvn> sham1: so what you are saying is that ANF doesn't have a continuation?
15:53:00 <sham1> Yeah, but that'd most likely be a front-end thing, while this CPS would be an IR and thus wouldn't necessarily need the currying. But one can still imagine it being in place
15:53:00 <zid> oh at least we're getting curry
15:53:00 <sham1> Oh, ANF does have a continuation. It's just that it doesn't reify it the same way
15:54:00 <mrvn> Sometimes you need it. We started with just always having it and never went on to optimizing calls with multiple args.
15:55:00 <mrvn> zid: functional programming is fun, and you get food.
15:56:00 <mrvn> isn't ANF also a static single assignment form?
15:56:00 <mrvn> (as is cps)
15:56:00 <sham1> Yeah, they're all technically equivalent
15:57:00 <sham1> They all enforce an evaluation order as well, of course
15:57:00 <mrvn> Or maybe not exactly. In CPS the merging of two branches is done at runtime due to the tail calls being done and isn't an explicit node in the ast
15:58:00 <sham1> CPS is convenient for certain things. For example you can get call/cc for free. The problem usually is that you want to have your activation frames in a stack, and to do that with CPS you have to "un-CPS" it back into direct style. You also lose call/cc
15:58:00 <mrvn> sham1: *hand wave* there is no stack.
15:59:00 <mrvn> " SSA is formally equivalent to a well-behaved subset of CPS excluding non-local control flow, which does not occur when CPS is used as intermediate representation."
15:59:00 <sham1> Right. But for some things like compatibility, it's nice to have the stack there even if I can heap-allocate and GC the activation records technically
16:00:00 <mrvn> Doing FFI calls without stack is a pain. For speed reasons you bets keep some dummy stacks around that you reuse for FFI calls so you don't have to allocate huge blobs of memory on every FFI call.
16:00:00 <mrvn> s/bets/best/
16:04:00 <sham1> I've actually read "Compiling with continuations", "compiling without continuations" and the third paper in the series, "compiling with or without continuations, whatever". It's neat how many ways there are to represent a computation
16:05:00 <sham1> I personally prefer ANF as my λ-calculus for representing programs. Easier for me to reason about and arguably easier to compile
16:06:00 <sham1> Although SSA isn't all that bad, if you happen to be C or similar
16:10:00 <mrvn> yeah, it's generally SSA style stuff for imperative languages and continuations in functional languages in compilers.
16:11:00 <mrvn> Although I wonder how the increased use of lambdas in c++ would benefit from CPS.
19:20:00 <heat> my cat took my chair
19:21:00 <heat> no irc 4 me
19:22:00 <sham1> :(
19:24:00 <zid> thanks cat
19:29:00 <gog> kitty
20:07:00 <kaichiuchi> hi
20:10:00 * geist waves
20:11:00 <gog> hi
20:12:00 <geist> hi!
20:13:00 <geist> i should figure out how to manually use the qemu balloon device
20:13:00 <kaichiuchi> i've been running freebsd on a separate partition
20:13:00 <kaichiuchi> and I have to say, it works pretty well on the desktop minus the fact netflix will not work
20:14:00 <geist> yeah, it's a nice system
20:14:00 <geist> haven't used it in a desktop like situation in a while but i still have a fondness for freebsd
20:14:00 <kaichiuchi> what kills me is people don't really care about BSD it seems
20:15:00 <kaichiuchi> a lot of companies do, but that's all it seems to be for
20:15:00 <geist> that wasn't always the case, but i've generally seen things erode in the last 10-15 years
20:15:00 <geist> tis a shame, but linux got the mindshare and then somewhat took off with it
20:16:00 <geist> side note i read a thing the other day that AIX was finally officially stopped, the last proprietary big iron unix
20:16:00 <kaichiuchi> I just don't get how linux took over honestly
20:16:00 <kaichiuchi> BSD was around long before
20:16:00 <gog> the lawsuit
20:16:00 <geist> oh i'm sure entire books have been written on the topic, but i suspect it was a bunch of smaller factors, no one thing
20:17:00 <kaichiuchi> the sco vs at&t thing you mean got?
20:17:00 <geist> that was the first shoe yeah, let some space
20:17:00 <kaichiuchi> gog
20:17:00 <gog> the lawsuit was among the first things
20:17:00 <geist> though in my experience linux didn't start really getting serious until the early 2000s
20:17:00 <gog> no, the at&t vs csu berkeley
20:17:00 <gog> linus wrote linux to be something that could replace bsd unix on the 386
20:18:00 <gog> before the lawsuit
20:18:00 <gog> then it got noticed when people were concerned about the legal future of bsd
20:18:00 <kaichiuchi> I was shocked to find that NVIDIA provides official BSD drivers
20:19:00 <geist> i also suspect there was some general cultural issues at play there for a long time
20:19:00 <kaichiuchi> ZFS is too cool to not use *BSD for a NAS though
20:19:00 <geist> though i have no experience with dealing with the BSD(s) dev team(s) in the 2000s i think i've heard they were pretty conservative and hard to deal with
20:19:00 <gog> there's also that
20:20:00 <geist> not that linux isn't, but its a bit more wild west and what's just fine for lot sof folks
20:20:00 <kaichiuchi> well, in my experience a lot of people in the unix world are conservative
20:20:00 <kaichiuchi> that's what drives me mad, really
20:20:00 <gog> linux is by far my least favorite open source kernel and OS but it's got the most support for things
20:20:00 <geist> but i do remember in the mid 2000s, especially for these new ARM cores that were just starting to get powerful enough to seriously run a multiple-address-space system (ie, 920t, and definitely arm1136) it was still somewhat open whether or not netbsd or linux or whatnot was going to be what folks ran on them
20:21:00 <geist> and aside from darwin, a bunch of companies essentially simultaneously voted about 2007-2010 and then i think that's when the ball really got rolling in that space
20:21:00 <geist> and one can argue in the end all that matters is arm
20:22:00 <kaichiuchi> the only two things I'm missing in freebsd desktop land are a native discord client and DRM for amazon video/netflix
20:22:00 <geist> (not really) but it's i'd say at least half of linux's success
20:22:00 <kaichiuchi> otherwise, absolutely everything else appears to work fine
20:23:00 <kaichiuchi> i dunno, it really blows because i've sorta fallen in love with bsd
20:24:00 <geist> i do assume you mean freebsd right?
20:24:00 <kaichiuchi> yeah
20:24:00 <geist> (being that there are multiple BSD OSes, etc)
20:26:00 <kaichiuchi> the thing for me is, it's not just a kernel
20:27:00 <kaichiuchi> it's a whole goddamn ecosystem
20:27:00 <kaichiuchi> and it's great
20:27:00 <kaichiuchi> i'm kinda fanboying a little bit, but
20:27:00 <geist> yep, i like that too
20:33:00 <sham1> Linux is the Windows of free software. CMW
20:33:00 <sham1> CMV*
20:54:00 <brynet> kaichiuchi: chrome --app=https://discord.com/app
20:54:00 <bslsk05> discord.com: Discord
20:54:00 <brynet> I'm sorta joking, not joking.
20:54:00 <kaichiuchi> heh
20:54:00 <brynet> the desktop discord is basically just that, using electron right?
20:56:00 <brynet> also hi from the "other" bsd camp. o/
20:57:00 <kaichiuchi> essentially, yeah
20:57:00 <geist> yah i eventually decided that electron discord isn't really any different. i *think* there may be some advantages if you're streaming the desktop or whatnot
20:57:00 <geist> but other than that i think it's the same thing
20:59:00 <qookie> one thing is that you have global push-to-talk with the electron app
21:00:00 <brynet> yeah, been using the web version on openbsd for a few months, all the old instant messaging platforms are dead and people keep dropping from irc.
21:01:00 <geist> qookie: ah yeah that might be it
21:02:00 <brynet> I imagine that's important for people using it for gaming
21:03:00 <brynet> I know of at least one podcast that uses it now, bryan cantrills oxide and friends.
21:46:00 <mjg> yo check out find(1) manpage
21:46:00 <mjg> -type c
21:46:00 <mjg> File is of type c:
21:46:00 <mjg> [snip]
21:46:00 <mjg> D door (Solaris)
21:47:00 <mjg> on linux
21:47:00 <mjg> there you go heat
21:48:00 <mjg> kaichiuchi: does the discord client work under linux emul?
21:48:00 <kaichiuchi> good question I have no idea
21:48:00 <mjg> this can be a pretty seamless experience man
21:59:00 <kaichiuchi> maybe
21:59:00 <kaichiuchi> unrelated but I'm really tired of hearing people cry premature optimization for basically anything these days.
23:15:00 <mjg> kaichiuchi: dawg
23:16:00 <mjg> premature optimization is a knee jerk reaction to be called out on doing something stupid
23:21:00 <mjg> i mean claiming not doing the stupid is PO
23:38:00 <kaichiuchi> right