klange changed the topic of #osdev to: Operating System Development || Don't ask to ask---just ask! || For 3+ LoC, use a pastebin (for example https://gist.github.com/) || Stats + Old logs: http://osdev-logs.qzx.com New Logs: https://libera.irclog.whitequark.org/osdev || Visit https://wiki.osdev.org and https://forum.osdev.org || Books: https://wiki.osdev.org/Books
<mrvn> https://www.youtube.com/watch?v=i0RkEs3Xwf0 (just because you are talking about claims)
<bslsk05> ​'Is Poland's tap water really protected by clams?' by Tom Scott (00:04:31)
<mrvn> mjg_: what serious functional language sucks perf wise?
[itchyjunk] has quit [Ping timeout: 276 seconds]
[itchyjunk] has joined #osdev
Burgundy has left #osdev [#osdev]
<mjg_> mrvn: according the guy guy common suckage point everywhere is mutability, e.g. in qsort
vdamewood has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
<Ellenor> mutable data should be locked, even if you aren't on a multiprocessor
<Mondenkind> I mean yeah mutability sucks for optimisation
<Mondenkind> the problem is that computers are still worse than humans at optimisation in many cases. So we end up in this weird limbo-land with junk like c
<heat> in many cases? how many cases?
<heat> the compiler is infinitely better at optimizing than I am
<Ellenor> have you eve carried on a conversation across two or more different platforms
<heat> no
gog has joined #osdev
zoey has quit [Remote host closed the connection]
heat_ has joined #osdev
heat has quit [Read error: Connection reset by peer]
heat_ is now known as heat
zhiayang has quit [Quit: oof.]
zhiayang has joined #osdev
dude12312414 has quit [Quit: THE RAM IS TOO DAMN HIGH]
<mjg_> Ellenor: except in fp langs data normally is not mutable
<mjg_> hence things like qsort end up doing metric fuckton of copies
<Ellenor> functional pure?
<heat> bbbbut it's cleaaaaaaaaan
dude12312414 has joined #osdev
dude12312414 has quit [Remote host closed the connection]
gog has quit [Ping timeout: 246 seconds]
dutch has quit [Quit: WeeChat 3.7]
dutch has joined #osdev
Starfoxxes has quit [Ping timeout: 276 seconds]
<bslsk05> ​twitter: <RichFelker> So today #musl discovered a longstanding 🤦🤦🤦 bug in Linux's ELF loader...
<heat> wake up honey, new linux kernel bug
<bslsk05> ​elixir.bootlin.com: binfmt_elf.c - fs/binfmt_elf.c - Linux source code (v6.0.7) - Bootlin
<bslsk05> ​elixir.bootlin.com: binfmt_elf.c - fs/binfmt_elf.c - Linux source code (v6.0.7) - Bootlin
<heat> find the differencez
CYKS has quit [Remote host closed the connection]
<mjg_> code duplication never hurt anyone
<mjg_> fun fact, linux had a memory leak in fork error handling for over 10 years
linear_cannon has joined #osdev
Starfoxxes has joined #osdev
<mjg_> in this episode of old geezers: forward progress guarantee is for suckers
<mjg_> just restart iteration from scratch on EAGAIN-like condition
<mjg_> every single time
<heat> link
smeso has quit [Quit: smeso]
<bslsk05> ​cgit.freebsd.org: ffs_vfsops.c « ffs « ufs « sys - src - FreeBSD source tree
<mjg_> in this case: is the vnodel ock held by someone?
<mjg_> see
<mjg_> MNT_VNODE_FOREACH_ALL_ABORT(mp, mvp);
<heat> ah
<heat> heh
<mjg_> i mean clearly it is very pragamtic bro
<mjg_> liek
<heat> is this a problem in practice?
<mjg_> no possible way this is not thought out
<mjg_> personally i have not ran into *this* bit, but it most definitely is a problem
<heat> letting filesystems implement fs sync is definitely an idea
<mjg_> i can tell you one funzyi ran into
<mjg_> ufs has numerous loops of similar fuckage
<mjg_> so
<heat> why is the bsd vfs a disaster
<heat> why do filesystems implement sooo much??
<mjg_> you boot a > 100 thread box, mount a ufs filesystem and do a no-op build
<mjg_> as in it is fully built and it finds out there is nothing to do
<mjg_> there is a fucking relocking armageddon for minutes
<mjg_> once it's all fully cached it of course is a matter of seconds
<heat> having a relocking pattern is definitely a sign you did it wrong
<mjg_> agreed
<mjg_> tell that to geezers
<heat> mjg_: you did it wrong geezer
<mjg_> OH
<mjg_> did i mention ufs is crap
<mjg_> just like most of the old unix codebase
<heat> ufs is the ideal filesystem
<heat> when men were men and used blocks and block groups and indirect blocks
smeso has joined #osdev
<heat> need more space? indirect those indirects
<mjg_> hue
zaquest has quit [Remote host closed the connection]
<mjg_> so apparently openbs procedure is to do mandatory pre-commit reviews
<heat> ok heat@
<heat> openbs is a good name
<CompanionCube> heat: also if you use 'soft' updates then you're a snowflake
<mjg_> :)
<mjg_> softflake
<mjg_> slab: Fix typo
<mjg_> OK mjg@
<CompanionCube> god did not put fsck into this world to be avoided!
<heat> 100
<mjg_> if develoeprs don't want their kernel to crash why there is a panic func included
<heat> fsck is for men who fuck
<mjg_> checkmate
<mjg_> commit 355fe9a66e1e9a6ebe2cf76f08ba8812d13095d8
<mjg_> revert requested by mjg@
<bslsk05> ​github.com: ansi · openbsd/src@a877a4f · GitHub
<heat> really good commit message
<mjg_> can you copy paste
<mjg_> as a rule i don't browse their fucking repo
<mjg_> if not logn anyway
<heat> ansi
sympt has quit [Read error: Connection reset by peer]
<mjg_> lol that was a copy
<mjg_> nice
<mjg_> may i suggst you prefix quotes with somethin', like >
<heat> this one wasn't even ok'd
<heat> :(((
<mjg_> no?
<mjg_> shit
<mjg_> retroOK mjg@
<mjg_> also signing off on the commit message for sure
<mjg_> at least it is related to what the person is doing
sympt7 has joined #osdev
<mjg_> > Update main.c
<heat> is Reviewed-by too formal for openbsd
<mjg_> 's what i roll with
<mjg_> heat: too greppable i suspect
<mjg_> imagine some idiot doing one per line
<mjg_> heat: haiku is getting a new beta build soon, updating from the 2021 state
<mjg_> gonna bench it
<mjg_> and compare vs openyx
<heat> the best bit
<heat> there are multiple commits with just "ansi"
<heat> by the same guy
<mjg_> well at least consistent
<heat> at least they're removing K&R declarations
<heat> good shit, great progress
<mjg_> probably newer compiler fails to grok them
<mjg_> with some opts
<mjg_> i bet you did not remove any k&r from onyx
<mjg_> you fuck
<CompanionCube> also what did request reverting
<mjg_> CompanionCube: i requested a revert from onyx!
<CompanionCube> ah
<heat> nope, tr still has k&r declarations
<mjg_> socket/accept4: Remove leftover debug printfs
<heat> mjg_, I removed k&r from the tr I stole from them
<mjg_> ye?
<mjg_> - scoped_lock g{entropy_lock};
<mjg_> + scoped_mutex g{entropy_lock};
<heat> should've named it ansi
<mjg_> what's this motherfucker
<mjg_> in that commit
<heat> ok heat@
<mjg_> this would never pass openbsd muster
<heat> i sneak changes over seemingly innocent commits
<mjg_> you got a contract with nsa?
<heat> yes
<heat> im introducing exploits on myself
<heat> self sabotage
<mjg_> makes sense
<mjg_> # Note: This is slow, but it's needed...
<mjg_> # TODO: How can we access C structs from assembly safely?
<heat> you should've asked for a kasan revert for openbsd feature parity
<mjg_> i thought i did, checky our email!
<heat> WE FUCKING CANT
<mjg_> anyway
<mjg_> yes you can mofo
<mjg_> see genassym in bsd land
<heat> oh sure, fuck off, i can do that if I do two compiler passes and shit
<heat> that's not the point
<mjg_> :]
<heat> it's ugly and bad
<mjg_> right
<mjg_> better to add a func call
<heat> that should be moved to c++ anywya
<mjg_> are you an offspring of a unix geezer by any chance
<heat> sadly no
<bslsk05> ​github.com: Onyx/usercopy.cpp at master · heatd/Onyx · GitHub
<heat> way cleaner
<heat> also enjoy that beautiful asm goto
wand has quit [Ping timeout: 255 seconds]
<mjg_> you got funny prios there mate
<mjg_> smap patchable at boot
<mjg_> as in smap even supported to begin with
<mjg_> with netbsd-esque scalability
<mjg_> xor %rax, %rax
<mjg_> oh no
<heat> what
<mjg_> xor %eax,%eax
<heat> bruh
<heat> is that, how you would say it, highly pessimal
<mjg_> agner fog would be disappoint
<mjg_> this just happens to be a known tidbit
<heat> also what's the problem with smap, it's really useful
<heat> and trivial to support
<mjg_> i mean hotpatching smap is a little bit of an effort
<mjg_> unless you already had the infra
<heat> i like to make way more effort than I should on things that I shouldn't
<heat> you know that, flamegraphs and all
<mjg_> well it is #osdev
zhiayang_ has joined #osdev
<mjg_> for real tho, i'm gonna try to bench haiku vs onyx
<mjg_> given what they did i suspect you are going to win very easily though
zhiayang has quit [Ping timeout: 260 seconds]
zhiayang_ is now known as zhiayang
<mjg_> in the open3 test
<bslsk05> ​github.com: Onyx/ktrace.cpp at 7f1e5fa92733a6e58a49d983a15e1e1f899ddbda · heatd/Onyx · GitHub
<heat> look at that
<heat> I even nop-patch effectively
<heat> there's no memset 0x90 here
<mjg_> you sure you do best possible job here
wand has joined #osdev
<mjg_> people tend to inject the 5 byte or whatever it was nopsled no matter what
<heat> that loop is a bit sus but the noping, yeah I think so
<mjg_> even though some asm goto jumps get away with fewer
<heat> wdym?
<mjg_> wait, you don't even do multibyte nops?
<heat> i do
<heat> __PASTE(__PASTE(nop_, N)
<bslsk05> ​github.com: Onyx/ktrace.cpp at 7f1e5fa92733a6e58a49d983a15e1e1f899ddbda · heatd/Onyx · GitHub
zaquest has joined #osdev
<mjg_> oh i see, nicely obfuscated
<heat> yeah
<heat> really great macro'ing
<mjg_> totes check your heritage
<heat> what's the c preprocessor for if not being abused
<mjg_> you sure your bio dad is the same person who raised you
<heat> lmao
<mjg_> and not osme unix geezer
<mjg_> you are defo coming from the gene pool
<mjg_> just sayin
<heat> you know, i really like that piece of code
<heat> really clever
<heat> which is exactly how code should be
<heat> clever and convoluted
<mjg_> i settle for convoluted
<heat> sounds like you want templates there
<heat> but im not that guy
<heat> i'm all for build speed
<mjg_> c++
<mjg_> build speed
<mjg_> you high on fentany
<mjg_> l
<heat> actually my c++ builds very quickly
<heat> which is why I abuse the cpp
<bslsk05> ​cs.opensource.google <no title>
<heat> now this is a proper c++ solution
<heat> templates and spans and static asserts and traits and auto and header-only!
<heat> i don't do that because I write C in C++
<heat> if you think my C++ builds slow you should try out actual userspace C++
<heat> 40s build time on the latest and greatest
<heat> ...for a single file
<mjg_> dude i compile clang itself a lot
<mjg_> PAIN is about the right descripton
<heat> llvm isn't even that bad
<heat> it's just a lot of code
<mjg_> strace what the dfucking compiler is doing
<mjg_> seriusly, strace compiling helloworld.c
<mjg_> *insane*
<bslsk05> ​github.com: workerd/urlpattern.c++ at main · cloudflare/workerd · GitHub
<heat> look at this, wayyyy worse
<heat> it's like a template per line
<heat> this particular project had a file with 12KLoC that took 40 fucking seconds to compile AT BEST
<mjg_> :[
<heat> i had to compile it with a CPU that throttled to 400MHz under load because dell fucked up the ACPI tables
<mjg_> you have not listened to Can't hurt me by goggins
<mjg_> did ya
<heat> so see, heavy C++ is fun
<heat> don't judge my CPP fuckery
<heat> no
<mjg_> do it
<heat> aw it's a whole book
<mjg_> leme give you an advice based on the book
<mjg_> do smething which sucks and post on twitter with a hashtag #SUCKSBRO
<heat> @dell your computers suck bro #SUCKSBRO
<heat> did you actually read that shit
<mjg_> read?
<mjg_> hell no
<mjg_> was an entertaining listen
<heat> did you AUDIBLE DOT COM that shit
<mjg_> note i explicitly recommended *lstening*
<mjg_> for real though, the advice is 80% garbage, but it is a fun experience
<bslsk05> ​'The Angriest I've Ever Been (Artosis Clips)' by Artosis Clips (00:10:01)
<mjg_> not goggins
<heat> is this a heated gamer moment
<mjg_> the guy is a known rager
<mjg_> but there is some charm to it
<mjg_> rolls with the classic of "i'm losing because my opponent is bad"
srjek_ has quit [Ping timeout: 272 seconds]
smach has joined #osdev
smach has quit [Client Quit]
smach has joined #osdev
[itchyjunk] has quit [Remote host closed the connection]
smach has quit [Remote host closed the connection]
<kazinsal> power outaaaaaage
<kazinsal> I was gonna actually do stuff tonight but nope
<heat> i wrote a linux tonigh
<heat> t
<heat> versus me writing the usual budget iberian linux
zhiayang_ has joined #osdev
zhiayang has quit [Ping timeout: 260 seconds]
zhiayang_ is now known as zhiayang
vdamewood has joined #osdev
vinleod has joined #osdev
vdamewood has quit [Ping timeout: 246 seconds]
heat has quit [Ping timeout: 255 seconds]
netbsduser has quit [Quit: Leaving]
<poisone> baptineria
bradd has quit [Remote host closed the connection]
zhiayang_ has joined #osdev
bradd has joined #osdev
ThinkT510 has quit [Quit: WeeChat 3.7.1]
zhiayang has quit [Ping timeout: 260 seconds]
zhiayang_ is now known as zhiayang
ThinkT510 has joined #osdev
<geist> kazinsal: yeah tons of outages all over the sound right now
<geist> the island and most of seattle center was in this epic rain shadow most of the day
wgrant has quit [Read error: Software caused connection abort]
wgrant has joined #osdev
Burgundy has joined #osdev
zhiayang has quit [Ping timeout: 260 seconds]
zhiayang has joined #osdev
wootehfoot has joined #osdev
ThinkT510 has quit [Ping timeout: 260 seconds]
ThinkT510 has joined #osdev
potash has joined #osdev
gog has joined #osdev
GeDaMo has joined #osdev
Burgundy has quit [Ping timeout: 248 seconds]
dutch has quit [Quit: WeeChat 3.7]
spikeheron has joined #osdev
Burgundy has joined #osdev
ThinkT510 has quit [Ping timeout: 260 seconds]
ThinkT510 has joined #osdev
bradd has quit [Ping timeout: 248 seconds]
romzx has quit [Ping timeout: 272 seconds]
GeDaMo has quit [Ping timeout: 260 seconds]
GeDaMo has joined #osdev
elastic_dog is now known as Guest1674
elastic_dog has joined #osdev
poisone has quit [Remote host closed the connection]
poisone has joined #osdev
srjek_ has joined #osdev
vinleod is now known as vdamewood
Burgundy has left #osdev [#osdev]
wolfshappen has quit [Ping timeout: 255 seconds]
wolfshappen has joined #osdev
theWeaver is now known as ioPan
GeDaMo has quit [Ping timeout: 260 seconds]
GeDaMo has joined #osdev
heat has joined #osdev
<mrvn> geist: isn't rain in seattle kind of the norm?
[itchyjunk] has joined #osdev
nanovad has quit [Ping timeout: 255 seconds]
srjek|home has joined #osdev
srjek_ has quit [Ping timeout: 260 seconds]
wand has quit [Ping timeout: 255 seconds]
nanovad has joined #osdev
gildasio1 has quit [Remote host closed the connection]
gxt has quit [Remote host closed the connection]
gildasio1 has joined #osdev
gxt has joined #osdev
<heat> geist, o geist o geist, do you have ppc64 hardware?
Burgundy has joined #osdev
wand has joined #osdev
bauen1 has quit [Ping timeout: 272 seconds]
jafarlihi has joined #osdev
<jafarlihi> First part of my C compiler is done: https://github.com/jafarlihi/clex
<bslsk05> ​jafarlihi/clex - clex is a simple lexer generator for C (0 forks/2 stargazers/MIT)
<zid> needs a couple more linebreaks and some consts but looks okay
<zid> and a void or two
<zid> do you really need all those globals in fa.c?
<heat> why do you keep popping and and advertising your random projects
<jafarlihi> Pipe operator calls reToNFA recursively so I externalized the state
<heat> it's mildly annoying
<zid> to the global state
<zid> not the file
<jafarlihi> zid: What's file state?
<zid> look at line 45 to 54
<zid> those are all global, *every file* can see them
eschaton has quit [Quit: ZNC 1.8.x-git-34-0db5c235 - https://znc.in]
<jafarlihi> How do I make it a file state?
<zid> if you put static before them all, only that file can see them
<jafarlihi> Oh
<jafarlihi> Right, thanks
<zid> and deleteKinds and clex are both marked as taking an unspecified number of arguments, rather than no arguments
<zid> use (void) not ()
eschaton has joined #osdev
<heat> i think () is changing its meaning for the next std? something like that
<zid> a lot of your functions take char * inputs but never modify the string being pointed at, so a const keyword would be good too
<heat> >C
<heat> >const correctness
<heat> pick one
<zid> works better than C++'s
<heat> C programs have between 0 and 0.3 const correctness
<zid> lex() should just be a siwtch or lookup table
<bslsk05> ​github.com: Onyx/acpi.cpp at master · heatd/Onyx · GitHub
<heat> case in point
<heat> C++ rejects implicit string literal -> char * casts so... yeah
<zid> so do I
<heat> YOU KNOW THE RULES, AND SO DO I
JerryXiao has quit [Ping timeout: 240 seconds]
<zid> clex() can return.. nothing, is supposed to return a Token
<zid> drawNFA prints a Node *nfa using %d
<zid> twice, ->to is also printed using %d
<zid> sign comparison bug on fa.c:383
* zid goes back to his book
<jafarlihi> zid: What is sign comparison bug?
<zid> < expects both sides to have the same signedness
<heat> there's a type width bug too
<heat> 4GB strings go brrrrrrr
<jafarlihi> heat: What is type width bug?
<heat> sizeof(int) != sizeof(strlen's return type)
<jafarlihi> So I should use size_t instead of int?
<heat> yes
romzx has joined #osdev
<mrvn> .oO(in 32bit ocaml strings are limited to 16MB)
<mrvn> maximum size the GC can deal with. Bigger things need external C storage.
<mrvn> i.e. indirection
poisone has quit [Remote host closed the connection]
jafarlihi has quit [Quit: WeeChat 3.7.1]
wolfshappen has quit [Quit: later]
<sham1> How can the GC only deal up to 16 MiB
<heat> because that's all the memory you'll ever need
<GeDaMo> Maybe uses a byte for tagging?
JerryXiao has joined #osdev
<sham1> Well the tag shouldn't matter for the size of the actual object, the size ought to be a separate field in the object header
poisone has joined #osdev
[_] has joined #osdev
bauen1 has joined #osdev
[itchyjunk] has quit [Ping timeout: 260 seconds]
[_] is now known as [itchyjunk]
tacco has joined #osdev
srjek_ has joined #osdev
srjek|home has quit [Ping timeout: 260 seconds]
bauen1 has quit [Ping timeout: 260 seconds]
bauen1 has joined #osdev
<zid> oh ben eater is back
<mrvn> heat: every value has the size of (void*) with th lowest bist being a tag. Blocks have a header of 1 value with GC data containing the block size, a few coloring bits and tags. 22bit are block size meaning 16MB maximum.
<mrvn> With just 32bit for the object header there just isn't that much space for the block size. Using 2 words for the object header would use more memory for everything while basically nobody has strings over 16MB. For large blobs of data you use BigArray.
<mrvn> BigArray is reference counted and allows slicing. Bascially a std::shared_ptr.
xenos1984 has quit [Ping timeout: 246 seconds]
xenos1984 has joined #osdev
eschaton has quit [Ping timeout: 260 seconds]
eschaton_ has joined #osdev
selve has quit [Remote host closed the connection]
selve has joined #osdev
selve has quit [Remote host closed the connection]
selve has joined #osdev
raggi has quit [Quit: upgrades]
raggi has joined #osdev
raggi has quit [Client Quit]
raggi has joined #osdev
selve has quit [Remote host closed the connection]
selve has joined #osdev
selve has quit [Remote host closed the connection]
selve has joined #osdev
tacco_ has joined #osdev
tacco has quit [Ping timeout: 260 seconds]
bauen1 has quit [Ping timeout: 260 seconds]
bauen1 has joined #osdev
vdamewood has quit [Read error: Connection reset by peer]
vdamewood has joined #osdev
netbsduser has joined #osdev
xenos1984 has quit [Ping timeout: 246 seconds]
ZombieChicken has joined #osdev
<heat> mjg_, at what point do jmps become cheaper than a bunch of nops?
<heat> you mentioned that yesterday
<mjg_> what
<mjg_> they are never cheaper
<mjg_> i'm sayin depending on how far you have to jump from an asm goto
<mjg_> you may get away with a smaller nop sled
<mjg_> than 5 bytes
<mjg_> but for some reason people blindly patch it with 5
<heat> my code patched with all sorts of nop sizes
<GeDaMo> There are larger NOPs
<mjg_> of course, there is multibyte nops
<heat> for N bytes my code writes N/5 5-byte nops, (N%5)/4 4-byte nops, etc
<mjg_> but that is a waste if you get away with fewer nops
<bslsk05> ​stackoverflow.com: assembly - Long multi-byte NOPs: commonly understood macros or other notation - Stack Overflow
<Mondenkind> I mean
xenos1984 has joined #osdev
<Mondenkind> obviously sliding through a page of nops is not gonna be cheaper than a jump
<mjg_> what
<mjg_> is this some alternate reality leaking here
<heat> i think this is benchmark worthy
<heat> im curious
<mjg_> first and foremost the asm goto'ed region would be a cmp + conditional jump if it was not a bunch of nops
<mjg_> who claims that is fater than nops
<mjg_> faster
<heat> im not using asm goto
<Mondenkind> oh I thought y'all were talking about jumping over the nops
<Mondenkind> lol
<heat> i am too
poisone has quit [Remote host closed the connection]
gildasio1 has quit [Remote host closed the connection]
gildasio1 has joined #osdev
<geist> heat: re: ppc64 yes i do
<mrvn> mjg_: but doesn't that take n / nops-per-cycle time while a branch takes one?
<bslsk05> ​gist.github.com: nopies.cpp · GitHub
<mrvn> heat: what abvout nopslide/1 - 63?
<mrvn> For 11 is nop5, nop5, nop1 or nop5, nop1, nop5 better?
<heat> geist, does it run linux and are you willing to patch your kernel and build something for me
<heat> mrvn, /shrug
<geist> well, i have it, but i honestlyhaven't even fired it up in years
<geist> it is my old Powermac G5. dual 2.0 Ghz
<heat> ah, forget it then
GeDaMo has quit [Quit: You are becoming what we French call 'Le Fruitcake'.]
<heat> no need
<geist> it's in a box
<mrvn> heat: seeing as you have the benchmark tools installed could you run it?
<geist> kk, i also have a ppc32 somewhere. a mac mini G4
<heat> I think i've tested it enough, although not in the ideal situation
<heat> there's a funny linux elf interpreter loading bug
<mrvn> food, brb
<heat> they don't clear more than one bss
<heat> which is actually showing up in lld 15
poisone has joined #osdev
<heat> i have a linux kernel patch and im going to send it but this is intimidating
<zid> page of nops can be faster than a jmp
<zid> just depends whether the decoder gets to see it in advance or not
<zid> cus it'll optimize down into a bunch of nothing inbetween the ops on either side's uops
linear_cannon has quit [Ping timeout: 255 seconds]
<heat> a jmp is already faster at 64 bytes here
<zid> in a loop?
<heat> yes
<zid> I wonder if it has some kind of minimum block size or something
<heat> so 63 nop-bytes and a ret vs 1 32-bit jmp and 58 bytes and a ret
<zid> so that it can only turn 15 nops into 1 nop, or something
<zid> rather than infinite nops into no nops
bradd has joined #osdev
<heat> for all 0x90: nopslide/10 2.90 ns 2.82 ns 264834343
<heat> nopslide/512 63.0 ns 61.6 ns 11547872
<heat> nopslide/64 10.0 ns 9.87 ns 70475827
<heat> nopslide/4096 479 ns 458 ns 1386963
<heat> nopslide/32768 3921 ns 3899 ns 175492
<heat> nopslide/65536 9058 ns 9011 ns 85905
<mjg_> that's a 64 byte slide?
<mjg_> try just 5 kthx
<heat> i did 10
<heat> 10 is still faster when nopsliding
<zid> what are the columns
ZombieChicken has quit [Quit: WeeChat 3.6]
<heat> wall time cpu time loop iterations
<zid> average, best, rand()%MAX_INT
ZombieChicken has joined #osdev
<zid> oh reciprocal
<geist> oooh
<geist> heat is gonna patch linux heat is gonna patch linux!
<geist> <everyone runs to the screen to watch heat fight morpheus>
<heat> kees cook as morpheus
<zid> greg kh is the oracle
<mjg_> is viro agent smith?
<zid> no, that's google
<heat> who's matthew garrett
<heat> mjg_, you pick
<mjg_> cypher
<zid> I don't know matthew garrett
<zid> linus is trinity obvs, the hot one in the cat-suit
<heat> it's mjg
<heat> the real one
<mjg_> right in the heart
<heat> wdym it's you
<heat> not that freebsd poser
<heat> you know i really respect alan cox for writing code for two kernels
<zid> That's how he got his last name, alan fux
<zid> also why is everybody called al in the kernel world
<zid> or greg
<heat> shut up greg
<heat> why is everyone mjg
<heat> that's a better question
<kof123> cause theres already 2 matthew dillons
<mjg_> and why is mjg joel spolsky
<zid> I am Robert Sapolsky
<zid> I have a WAY better beard.
<geist> thing to do today: play with proxmox
<zid> wassat?
<geist> actually kinda looks neat, a much nicer VM solution than my cobbled together qemu starter scripts
<zid> wiki says they have three produts, email servers, some virutalization thing, and a backup thing
<mjg_> geist: that's a normie thing to do man
<geist> oh yeah?
<mjg_> ye man
<geist> but does it work well?
<mjg_> i hear it is great
<mjg_> never tried myself
<zid> It is a Debian-based Linux distribution with a modified Ubuntu LTS kernel[3] and allows deployment and management of virtual machines and containers
<zid> that's MEGA normie
<geist> oh i see. as in if it works well then that's too easy?
<mjg_> is not this #osdev
<geist> yes but lets you dev more!
<zid> We don't actually deploy anything here to machines
<zid> we make one machine barely work
<heat> qmeu-system-x86_64 beeeeeeeeeeeest
<zid> in a very specific hardware config, for one small task
<mjg_> geist: if i wanted it easy i would program in html!
<heat> if you wrote a bunch of scripts to do something, never drop them
<heat> especially for something better
<geist> okay here's my challenge then to posix hobby os people: stand up a Mastodon instance on your OS
<heat> hear that openbsd
<mjg_> loud and clear
<zid> If it's to do with web I bet it needs 84939 random deps
<mjg_> or shit did i reveal something :S
<mjg_> oh shit*
<zid> if it's not written in a language I've never heard of I'd be surprised
<geist> i actually have no idea what mastodon is written in, good question
<zid> Written inRuby on Rails, JavaScript (React.js, Redux)
<zid> see, it's a web thing, so it's written in slow bad languages with no types :P
<geist> so that means it should be easy tos tand up on your os, just port ruby!
<zid> Only web people care about web things, so they write their backends in web languges too
<geist> which are generally fairly abstracted from the core os
<zid> C developers are too busy leaving root exploits in fundamental pieces of core software like openssl
<mrvn> heat: unless I'm mistaken a nopslide/10 is just 2 nops.
<geist> side note: last night i think i finally grokked linux's PCID implementation
<geist> it's pretty bizarro, but makes sense.
<geist> but i *also* see why AMD's new INVLPGB/TLBSYNC thing is an issue for linux. it's fundamentally a different solution than linux's PCID implementation, so would require alot of work
<mrvn> geist: what does linux do?
<geist> notably: linux's PCID implementation does not attept to permanently or semi-permanently assign a PCID to a process. it simply cycles through literally PCID 1-7 on each core, and then each core tracks up to the last 6 contexts it has loaded, opportunistically reusing them if it can
<geist> the idea being that 6 is a good number for cache line locality of the array of N entries per cpu, and really realistically storing more than 6 contexts of TLBs is diminishing returns
<geist> but that means that at any given point in time any given cpu has a completely different notion of what PCID is assigned to what address space, so things like AMD's TLBSYNC cross-process shootdown is fundamentally incompatible
<mrvn> geist: 1-7 on each core or a set of different 7 IDs per core?
<geist> 1-7 on each core
<geist> as in each core independently assigns a rotating set of PCIDs as context switches happen, and look in the last 6 to see if it can reuse it
<geist> (or if it's been shot-down by another cpu because of a generation counter getting rolled on the aspace)
<geist> ie if the cpu has remembered that i had previously used PCID 3 at generation Y for aspace X
<geist> when it goes to reload aspace X if it's genertion is Y+1, it fully invalidates the aspace when it reloads it
<mrvn> yeah, you would need to notice if the aspace changed between running a thread.
<mrvn> so if a process is running on 2 threads that requires an IPI on aspace change, right?
<geist> right. thats to avoid keeping you from having to IPI to *all* cores all the time. you still only cross IPI to cores that are known to be running a process, ad there the receiving cpu can look in its list of 6 processes and figure out which PCID it has
<mrvn> as it's unlikely they have the same PCID
<geist> right, you still do the IPI, because you know it's there. on cpu A where you original the TLB shootdown you might be using PCID 2 for exampe, and you know cpu B has it loaded too, so you send an IPI to it
<geist> cpu B which is using PCID 3 for the same aspace then says 'yep i'm running this' and does a local shootdown
<mrvn> which also means you have a race because the other core might just be scheduling at the same time.
<mrvn> must be done carefull
<geist> for all the cpus that arently runnig it, cpu A will bump the generation counter, so the next time those cpus context swich if they noticed the aspace's gen counter has been rolled they do a total PCID TLB dump
<geist> so you roll the gen counter first before sending the IPI, which solves the race
<mrvn> geist: the other core then needs to first switch and then check the generation counter
<mrvn> and all of iti atomic
<geist> nah, it's not that difficult
<geist> it only needs to dump the TLB if the aspace is in the last 6 it had loaded, if it's not in that list there's nothing to dump
<geist> but if it's within the last 6 then as it loads it it marks it as active, then does the atomic check, etc. there are 2 or 3 pieces of atomic stuff here that if you do them in the wrong order worst case you do a full TLB invalidate of a PCID you dont need to
<geist> but yeah, it's a little subtle i guess
<geist> anyway the only real global atomic state here is per aspace there's still an atomic bitmap of which cpus have the aspace active at that instance
<geist> everything else is per cpu, which is pretty slick
<mrvn> I would have stored the last PCID + generation in the task struct and if task->pcid_generation != core->pcid_generation or aspace->generation != task->aspace_generation then you can't reuse the pcid.
<geist> 6 PCIDs was chosen because the array of state there to store the last 6 aspaces on the cpu fits just within a cache line
<geist> that's a problem because there are multiple cpus
<geist> so you'd need per task an array of for *every cpu*
<mrvn> geist: you set generation=0 when you migrate a task
<geist> but yes it's a fundamental inversion of the whole thing: instead of assigning a PCID to an aspace globally, you do it per cpu and jut use it as a little cache tag
<geist> downside is algorithms like ARMS ASID or the AMD PCID solution that allows for cheap cross-cpu invalidates
<geist> fundamentally requires that the same IDs be used across all cpus
<geist> so you need a fundamentally different solution, generally involving some sort of semi dynamic assignment/reassignment of IDs to processes as it comes up
<mrvn> geist: the assertion that more than 6 PCIDs have a diminishing return seems also turned around. Would be better to say that with more than 6 PCIDs the probability any cache entries of the old PCID remain is approaching 0
<geist> sure
<geist> so the diminishing return is you dont see any real wins in real world benchmarks
<mrvn> it's not like using more PCIDs costs you anything
<geist> it does: because there are places where you have to do an O(N) search through an array, per cpu, of the last N pcids you had
<geist> so you dont want that array to get too big because at some point that cost dominates things
bauen1 has quit [Ping timeout: 260 seconds]
<mrvn> geist: with the inversion, sure. I ment in the hardware
poisone has quit [Remote host closed the connection]
<geist> right. the main observation at the time the patch went in is 12 bits is not enough to do a static assignment
<geist> and even if you do a dynamic assignment, large machines would be hitting it
<mrvn> A cacheline is 64 byte, so 6 PCIDs means 10 byte per ID. What do they store there?
bauen1 has joined #osdev
<geist> you're free to look at the source code at this point
<geist> the details are available
<mrvn> .oO(But are they understandable :)
<geist> i understood them
<mrvn> well, you are geist so that doesn't mean much. :)
<mrvn> I allways hate trying to grock linux arch specific code.
<geist> anyway t as something lke a PCID id + the last gen counter it saved + a pointer to the 'mm struct' which i think is linux's equivalent to a aspace
<geist> this patch was actually pretty easy to read. they even left a large block of comments and whatnot
<geist> this data is packed in fairly tight with bitfields and whatnot to try to keep it small
<geist> becauase yes i know you're doig math right now and jst bout to point out that that's > 10 bytes
<mrvn> Must be. pointer would be 8 byte otherwise leaving only 2 for a generation.
<mrvn> I always want to write: struct { Bla *ptr : 40; int x : 24; };
<mrvn> or Bla *ptr : 40 : 2; saying to discard the lower 2 bit too
<geist> this is not the important detail, mrvn
<mrvn> no, sorry for going off-topic. :)
<geist> dont fixate on the minutae. just accept that tricks were done to make it compact, and yo ucan look at the source if you want
<geist> the overall trick is the per cpu assignment
<mrvn> prio to remove TLB shootdowns that looks like a nice trick.
<mrvn> s/remove/remote/
<geist> but now i see the issue with trivially extending to the AMD TLBSYNC solution, which is fundamentally the same thnig as the ARM one
<geist> now you have to have two completely differnet mechanisms to assign PCIDs to aspaces and/or cpus
<geist> that's one thing to do it at the arch level, sicne the code is not shared there
<mrvn> geist: if every core would use a disjunct PCID range (assuming you have enough) you could still to remote shootdowns.
<geist> and then if you do the PCID assignment per aspace thing, you're back to 12 bits not being enough
<geist> perhaps, but now every core has to k now about the assigment space of all the other cores
<geist> and then that becomes a scaling issue
<geist> trying to avoid that is basically mandatory for somehting like linux
<mrvn> 12 bits total, 3 bits for the 6 IDs of a core, 9 bits for cores. So up to 512 cores. More if you pack it better.
<geist> plus as someone has pointed out, there are already 256 or 512 cpu systems, etc, and there are only 4096 entries in the PCID space. so at 512 cpus you only have 8 bits
<geist> and then KPTI requires that you assign 2 per process
<geist> but again the problem there is in order to do a TLB shootdown across cpus you'd have to know what IDs are being assigned on every other cpu in the system
<geist> and on a 512 cpu machine that's up to 512 TLBSYNCs per sync, etc. in this case you have no won at all, it's much slower than a cross IPI to just cpus that have it currenlty mapped
<mrvn> wich would turn into a uint16_t pcid[512]; and be rather large.
<geist> yah
<mrvn> more with a generation.
<geist> and then you've ffectively capped max cpus to 512 right ow with no good solution past that
<mrvn> With 512 cores you also have to consider at which point an IPI to all is better than individual cores.
<mrvn> How does that actually work on x86? Do you pass a pointer to a bitmask?
<geist> yah and note it's an IPI to cpus that have it mapped, not an IPI to all cores (unless it's a massively multithreaded process that's simultaneously running on all cores)
<geist> which part? the sending of the IPI?
<mrvn> yes
<geist> they have some api thats' like `mp_sync_task(cpu bitmask, ...)`
<mrvn> Say I need to IPI 100 cores. Do I do 100 calls?
poisone has joined #osdev
<geist> how that internally works on whatever version of whatever APIC is currently in existance i dont remember
<geist> internally it might be a O(popcount(bitmask)) operation
<mrvn> Ahh, you ment the APIC has an mp_sync_task call?
<geist> it ight, but worst case it doesn't
<geist> like, say, GICv3: you're basically stuck individually firing for every bit in your bitmask
<geist> since ther'es no good way to represent in hardware a bitmap of all the cores when the number of cores can be larger than a word
<mrvn> I looked at that a bit for the GIC. I was just wondering how x86 did it.
<geist> i think it's probably the same, but honestly i dont remember what the current APICs do
<mrvn> x86 likes to pass descriptors to opcodes pointing at structures larger than a word.
<geist> i think xAPIC and x2APIC changed the mechanism, much like how GICv2 changed with GICv3 so it could address more cpus
<geist> yeah but the IPI is not part of x86 instruction set per se, it's part of the local APIC, which is accessed via mmio (or MSRs)
<geist> so its functionally similar to GIC in that it's a piece of hardware
<geist> 'externa;' peripheral
<geist> but yeah a descriptor with a N bit mask would be lovely in this case
* mrvn needs to find some cork, copper pipe and bowls for https://www.grand-illusions.com/Files/123268/Img/01/steam-powered-top-2.jpg
<geist> i think the general observation is *generally* one does not run massively parallel processes like that on linux at least, or at least that's not necessarily the best scalable solution past a certain point
<geist> but then i just made that up. i have no real idea
<geist> i frequently see rustc processes using 3200% cpu on my machine or something
<mrvn> geist: The only people I know that go for 64-512 core systems run computing clusters where they run a single process with MPI on 4000 cores or similar.
<geist> mrvn: oooh what does it do, spin around?
<geist> yah most of the 512 sized machines i know about run lots of VMs
<geist> ie, the biggest intel box you can get is i think 486 or some number like that
<mrvn> geist: yep. Under the cork the copper pipe must be bend clockwise (or anti-clockwise) to give a rotational effect
<geist> though i think newer AMD systems might approach that now?
<mrvn> Yeah, VM hosters would be the other group. I don't really deal with that side.-
<geist> 448 i think now that i think about it: quad socket 112 thread intel machine
<geist> but yeah generally you carve that machine up into a bunch of VMs or a bunch of containers each running smaller things
<mrvn> The contraption is a variant of the old put-put boat. You fill the pipe with water. It evaporates and pushes out the water from the pipe, then it cools down and condenses pulling water back in and repeats. Pushing out is more directional so you get a rotational effect.
<geist> cute!
<geist> now i kinda want something like that
bauen1 has quit [Ping timeout: 248 seconds]
<geist> tell me how it works
<mrvn> I want to put some figurines on the outside of the cork so you get a shadow puppet show.
<geist> i suddenly remember that i used to have one of those desktop rock waterfall things
<geist> was kinda nice except over time it tended to splash everywhere
<mrvn> geist: a rock sitting in a lake with a fishtank pump pumping it to the top of the rock?
<mrvn> Do you know the japanese bamboo things? They have a bamboo flute on an axis that gets filled with water. At a certain level it tips over and empties and then swings back making a sound when it hits the endstop.
<geist> oh it was just a little desktop waterfall with 2 or 3 tiers and a bunch of pebbles you place
<geist> with some lights. was kinda pleasing. had it in college
<geist> i think the pump finally died and i tossed it
smach has joined #osdev
outfox has quit [Ping timeout: 255 seconds]
<mrvn> Every time I see "We value your privacy" I think "Yeah, sure you do. You are counting the dollars you get for selling it"
ioPan is now known as theWeaver
<mrvn> geist: You can buy the thing from Grand Illusions but I want to modify it.
<dh`> my grandparents had one of those things (the portable rock waterfall)
<dh`> no idea what happened to it
<mrvn> They are easy to build yourself too
<sham1> Technically that would count as valuing your privacy
outfox has joined #osdev
theWeaver has quit [Quit: WeeChat 3.5]
ChaosWitch has joined #osdev
ChaosWitch is now known as Stella
Stella is now known as Stella[OotC
Stella[OotC is now known as Stella[OotC]
<geist> yeah there are a bazillion of them on amazon i just checked
<geist> (the rock waterfalls)
<heat> you know something that died pretty quickly
<heat> gnu gold
<heat> i kinda want to help out
<heat> having only one good linker is worse than two good linkers
bauen1 has joined #osdev
<kazinsal> finally have power again
<kazinsal> gonna have to go through my fridge and chuck a bunch of stuff I bet, that was almost 18 hours
<heat> america freedom moment
bradd has quit [Ping timeout: 260 seconds]
bradd has joined #osdev
<kazinsal> canada, and a major power transformer exploded due to a tree bashing it in half
<heat> very cold nice people moment
<clever> kazinsal: did it actually explode? 90% of the time its just the fuse going off
<clever> the fuse on those things does sound like a gun
<kazinsal> yeah, it took part of the pole with it
<kazinsal> they had to replace the pole as well, so, extended outage
<kazinsal> the tree probably didn't help with that
<mrvn> heat: what makes a linker good?
<clever> ah, yeah, that sounds pretty big
<heat> mrvn, fast and featureful
<heat> ld.bfd is very clearly bad, ld.gold was shaping up well (and was defaulted to ld on a bunch of distros) but then google moved to llvm
<heat> and now ld.lld is far superior to anything else
<heat> mold is fast but not featureful, also no linker script support, etc
<clever> a lot of baremetal things i do rely on linker scripts to work at all
<geist> kazinsal: oh wow, 18 hours
<mrvn> My linker can link my hello-world and nothing else. Is it good or bad?
<heat> it's bad
<mjg_> negative heat
<heat> but it's also your linker which is cool
<heat> mjg_, negative heat = cold
<mjg_> except then you may try to claim you are cool
<mrvn> It kind of just dumps the compiler output into a binary.
<kazinsal> geist: yeah, we had some really bad winds here
<mrvn> mjg_: that's hot
<kazinsal> honestly the worst wasn't even the outage itself. the worst was the fire alarm running low on battery at 6am and just blaring itself to death for an hour and a half
<mjg_> :]
<mrvn> kazinsal: the fire alarm needs the power grid? Not enough battery to run for a year like everyone elses?
gxt has quit [Remote host closed the connection]
<geist> probably an older fire alarm that usea a 9v backup battery. all of mine do too
<geist> i think newer stuff (2010+) is generally mandated to have lithium backup batteries nowadays
gxt has joined #osdev
<kazinsal> it's an apartment building, so big centralized system with a landline for call-home
<kazinsal> I think the other issue may have been that the battery at the CO finally gave out so the landline went down
<geist> yah that's generally what happens here with internet and whatot. even if i run the cable modem off a generator or whatnot, my experience is the cable network usually goes down in an hour or two
<geist> probably some remote concentrator box that has a battery backup
<geist> also ugh: since macos 13 Ventura update both of my macs have a much less stable bluetooth connection to my mouse
<geist> seems it drops and comes back now like once an hour or so
<geist> wonder if they had a bluetooth stack rewrite or something
<kazinsal> yeah, it was different when every CO had a shitload of generator power because they all had rows and rows of 5ESSes in them
gxt has quit [Remote host closed the connection]
gxt has joined #osdev
<heat> mjg_, do you want to see great linux code
<bslsk05> ​elixir.bootlin.com: build.c - arch/x86/boot/tools/build.c - Linux source code (v6.0.7) - Bootlin
<heat> this whole file really is vintage unix geezery
bauen1 has quit [Ping timeout: 248 seconds]
bauen1 has joined #osdev
bradd has quit [Ping timeout: 260 seconds]
<mrvn> They retrofitted the fire alarms here so they have standalone units they screwed to the ceiling that runs off a battery.
<mrvn> Once a year the landlord comes and pushes the test button to make sure it still works.
wootehfoot has quit [Quit: Leaving]
<mrvn> And on the list of films that happened this year we now have: The Purge