sb0 changed the topic of #m-labs to: ARTIQ, Migen, MiSoC, Mixxeo & other M-Labs projects :: fka #milkymist :: Logs http://irclog.whitequark.org/m-labs
fengling has joined #m-labs
<sb0> cr1901_modern, so what is the decision regarding the xilinx settings file on windows?
_rht has joined #m-labs
evilspirit has joined #m-labs
mumptai has joined #m-labs
<cr1901_modern> sb0: The call is correct
<cr1901_modern> In addition, I also added something else as a separate patch >>
<cr1901_modern> Windows doesn't have a "set -e" like sh does. I added code for the generated batch file to fail gracefully if there's an error instead of continuing
<cr1901_modern> sb0: I'll prepare the patches. Forgot to do it earlier b/c trying to debug a reproducible crash on my MiSoC target
fengling has quit [Ping timeout: 240 seconds]
evilspirit has quit [Ping timeout: 260 seconds]
<mithro> sb0: How does the "mor1k" in use in misoc differ from the stock/upstream or1k?
sb0 has quit [Ping timeout: 248 seconds]
fengling has joined #m-labs
FabM has joined #m-labs
evilspirit has joined #m-labs
fengling has quit [Ping timeout: 240 seconds]
fengling has joined #m-labs
sb0 has joined #m-labs
mumptai has quit [Quit: Verlassend]
<sb0> it does not
<sb0> or well, misoc uses upstream mor1kx
<sb0> mor1kx is a complete reimplementation of or1k which unlike the original does not suck in any major way
sb0 has quit [Quit: Leaving]
evilspirit has quit [Ping timeout: 240 seconds]
evilspirit has joined #m-labs
evilspirit has quit [Ping timeout: 276 seconds]
fengling has quit [Ping timeout: 240 seconds]
fengling has joined #m-labs
<GitHub151> [artiq] sbourdeauducq pushed 1 new commit to master: https://git.io/vVQiE
<GitHub151> artiq/master 56af4e9 Sebastien Bourdeauducq: doc/installing: add note about example dependencies
sb0 has joined #m-labs
<larsc> have you seen j-core? any thoughts on it?
<rjo> larsc: got a link? is it java?
<bb-m-labs> build #327 of artiq-kc705-nist_clock is complete: Success [build successful] Build details are at http://buildbot.m-labs.hk/builders/artiq-kc705-nist_clock/builds/327
<larsc> rjo: sh architecture re-implementation
<larsc> saw a presentation by them last week
<larsc> their approach sounds interesting
<rjo> ah. SuperH yes. i remember seeing that as well.
<bb-m-labs> build #110 of artiq-win64-test is complete: Success [build successful] Build details are at http://buildbot.m-labs.hk/builders/artiq-win64-test/builds/110
<bb-m-labs> build #586 of artiq is complete: Success [build successful] Build details are at http://buildbot.m-labs.hk/builders/artiq/builds/586
<sb0> 52MHz on spartan6 isn't ridiculous like on virtex7, but not great either
_rht has quit [Quit: Connection closed for inactivity]
<sb0> threads (at least in python) are ridiculous, as always
<sb0> when a thread is blocking on recvfrom(), closing the socket from another thread does not cancel the operation
<sb0> and even if python gave us pthread_kill(), which is almost a reasonable API, that would not work on windows
<whitequark> you need to call shutdown first
<whitequark> killing threads is impossible.
<sb0> with pthread and signals, it works
<whitequark> no, it doesn't.
<sb0> it's a bit tricky, but doable
<whitequark> it might look like it works, but it cannot possibly work, and there doesn't exist an environment where it works
<whitequark> if you think it works, you're wrong
<sb0> what's the problem with it?
<whitequark> a thread owns resources and killing a thread will not release those
<sb0> if the thread installs a signal handler, it can release them
<larsc> it's still a bad concept
<whitequark> sb0: no, it cannot
<sb0> it can.
<whitequark> nope. there is an inherent race condition
fengling has quit [Ping timeout: 240 seconds]
<whitequark> a signal handler can always arrive in between acquiring a resource and recording it in some form of storage where the signal handler can release it
<whitequark> and if you block signals using pthread_sigmask, then we're back on square one
<whitequark> because it's basically the same as asking the thread nicely (by setting some flag), except nonportable and far more error prine
<whitequark> prone
<sb0> ok, yes there is the same issue as this idiotic asynchronous KeyboardError on python
<sb0> but you can interrupt system calls with pthread_kill
<sb0> *KeyboardInterrupt
<whitequark> KeyboardInterrupt actually sets that flag, it doesn't jump out of the signal handler
<whitequark> exactly because of what I elaborated above
<whitequark> it looks asynchronous to Python code though, so the problem is repeated
<whitequark> anyway, none of this is relevant in your case, simply call shutdown(O_RDWR)
<sb0> yes, shutdown() does something, thanks
<whitequark> Thread.kill is a """safe""" construct in, say, Java, because Java automatically inserts GC safepoints
<whitequark> and it actually sets a flag and polls it on every safepoint
<whitequark> much like Python, where there's an implicit safepoint after every instruction
<whitequark> it still breaks if you kill something while it's inside a mutex and there's nothing you can possibly do to fix that if you want a kill that actually kills the thread in all cases, by design
<sb0> so, shutdown() makes the thread recvfrom() fail, but it also does OSError: [Errno 107] Transport endpoint is not connected in the caller
<whitequark> yes, that's exactly what should happen
<whitequark> oh, you mean in the thread that calls shutdown?
<sb0> yes
<whitequark> sorry, SHUT_RDWR, not O_RDWR
<whitequark> and try SHUT_RD instead of RDWR
<sb0> yup, it's SHUT_*
<sb0> I already tried...
<sb0> I guess I could just ignore the OSError; after all, it's thread code in python, so of course it sucks
<whitequark> this all has nothing to do with python whatsoever
<whitequark> it's just unix
<sb0> it's a mess of different things. if udp worked with asyncio and windows, I would not have to use threads. if pthread_kill() was available, I could terminate the thread in another way.
<whitequark> no, you could not use pthread_kill safely
<whitequark> at best, it's just exchanging one problem for another, not even a smaller one
<sb0> hm, yes. would have worked in C though
<whitequark> huh
<whitequark> but it *does* make recvfrom fail
<sb0> yes
<whitequark> well. that's probably implementation-defined. how about using select before recvfrom then?
<sb0> on windows? :)
<whitequark> sure
<whitequark> WSASelect
<sb0> oh fuck
<whitequark> where do you think recvfrom comes from? Windows has a networking stack copied from BSD
<sb0> i'll just let the thread die.
<whitequark> I don't understand your problem
<whitequark> use select in the exact same way you've been using recvfrom just now
<whitequark> they're a part of the same API on Windows
<sb0> it's not mapped by Python
<whitequark> it does
<whitequark> this is WSASelect specifically
<whitequark> "Note that on Windows, it only works for sockets"
<sb0> it's remarkable how the relative obscurity of UDP makes its APIs full of shit
<sb0> recvfrom cannot be interrupted by shutdown/close in a clean manner, no asyncio implementation for windows, ... what else
<GitHub157> [artiq] sbourdeauducq pushed 2 new commits to master: https://git.io/vVQxT
<GitHub157> artiq/master 1690cb1 Sebastien Bourdeauducq: dashboard/moninj: remove debug prints
<GitHub157> artiq/master d9e918b Sebastien Bourdeauducq: dashboard/moninj: use thread instead of asyncio UDP (#39)
<whitequark> shutdown/close is just how sockets work... close doesn't interrupt TCP either
<bb-m-labs> build #328 of artiq-kc705-nist_clock is complete: Success [build successful] Build details are at http://buildbot.m-labs.hk/builders/artiq-kc705-nist_clock/builds/328
<cr1901_modern> Def very interested in seeing how this turns out
<larsc> in their presentation they also set they are going to make a ASIC
<bb-m-labs> build #111 of artiq-win64-test is complete: Success [build successful] Build details are at http://buildbot.m-labs.hk/builders/artiq-win64-test/builds/111
<mithro> They lack a MMU currently
<cr1901_modern> Wonder how many arms and legs that will cost
<larsc> they said it is not that expensive if you are using a really old process
<larsc> don't remember the details, but I think it was less than 100k
<bb-m-labs> build #587 of artiq is complete: Success [build successful] Build details are at http://buildbot.m-labs.hk/builders/artiq/builds/587
<cr1901_modern> fair... I seem to recall a uni getting a RISC-V impl done in that ballpark
<sb0> I find shutdown() questionable (what are you going to do with a shut down socket except close it), but at least it interrupts recv() reliably
<mithro> larsc: Apparently the patents on the MMU expire this year
<sb0> or close() does. but i do remember not having issues with TCP.
<cr1901_modern> sb0: You can recv data from a shut down ssocket I think? Just can't send it
<cr1901_modern> I think I have thiss mixed up
<whitequark> shutdown() does interrupt recv(), of course
<whitequark> the reason shutdown() and close() are different is that when you close() a socket it may have data in the output buffer
<whitequark> well, send buffer
<mithro> FYI - I got misoc on http://openrisc.io/
<whitequark> or1ksim is an instruction accurate simulator with a lot of features including flexbile configuration and gdb debugging
<whitequark> >flexbile
<whitequark> also, no mention of clang?
<sb0> on windows, recvfrom raises OSError when another thread shutdows/closes the socket. on linux, it returns (b"", None)
<sb0> it would have been too easy if both platforms had the same behavior
<whitequark> this behavior is not specified in POSIX
<GitHub154> [artiq] sbourdeauducq pushed 1 new commit to master: https://git.io/vV7U3
<GitHub154> artiq/master dbba41b Sebastien Bourdeauducq: dashboard/moninj: fix windows problems
<cr1901_modern> And Winsock DEFINITELY doesn't return the same error codes/reasons as Linux/BSD, etc
<sb0> i don't care what the excuse it. i just notice it sucks.
<sb0> *is
<GitHub164> [artiq] sbourdeauducq pushed 1 new commit to master: https://git.io/vV7US
<GitHub164> artiq/master 7d590af Sebastien Bourdeauducq: dashboard/moninj: use ephemeral UDP port
evilspirit has joined #m-labs
<whitequark> "it sucks", also known as "i can't be bothered to learn how the API works"
<whitequark> next step is usually reinventing the API, badly
<sb0> absolutely. having to deal with different APIs on different OSes for no reason is a waste of time.
<sb0> yes, there is a xkcd comic about this
<cr1901_modern> Well, Windows has yet to finish evolving into a Unix
<whitequark> you mean devolving
<whitequark> Unix APIs are a collection of garbage even worse than WinAPI
<whitequark> and the socket ones in particular
<whitequark> well, not socket, file descriptor ones
<cr1901_modern> I would love to see something different. I'm not optimistic, but it would be interesting
<whitequark> it's not very hard to achieve, just run your software as a unikernel inside Xen
<sb0> okay, one good thing today
<sb0> git cherry-pick correctly handled file renamed across branches
key2 has joined #m-labs
<cr1901_modern> Hmmm, that would be one way to make unikernels more usable as desktop OSes :P. Each app is essentially its own OS
<larsc> one of the major problems with the Unix/Linux APIs is that there is no abstraction of events. E.g. you can wait on either a child process, a pthread condition or file IO, but not so that you wake up when either of the events happen
<GitHub135> [artiq] sbourdeauducq pushed 3 new commits to release-1: https://git.io/vV7TB
<GitHub135> artiq/release-1 e4833a3 Sebastien Bourdeauducq: dashboard/moninj: use thread instead of asyncio UDP (#39)
<GitHub135> artiq/release-1 a6c17d3 Sebastien Bourdeauducq: dashboard/moninj: fix windows problems
<GitHub135> artiq/release-1 e7d448e Sebastien Bourdeauducq: dashboard/moninj: use ephemeral UDP port
<larsc> Windows actually can do that
<whitequark> exactly
<whitequark> you can use epoll+signalfd+timerfd+eventfd
<whitequark> or, you can use kqueue, which has all that built in
<whitequark> or, you're on some OS which has neither, and then you're screwed
<whitequark> but not even any of those APIs allows you to wait on files being read from disk
<larsc> the problem with kqueue is that everything is a special case
<larsc> new type of a event? update kqueue ABI
<whitequark> this is especially moronic in case of FUSE, because FUSE inherently blocks a lot
<bb-m-labs> build #329 of artiq-kc705-nist_clock is complete: Success [build successful] Build details are at http://buildbot.m-labs.hk/builders/artiq-kc705-nist_clock/builds/329
<whitequark> yeah, WFMO and OVERLAPPED are a fairly elegant solution
<larsc> linux has overlapped support with AIO, but again you have a special API for sleeping and can't mix (you can get a eventfd though)
<whitequark> linux AIO doesn't really work
<larsc> better than posix AIO ;)
<whitequark> it's POSIX AIO, isn't it?
<whitequark> I mean, Linux does have kernel AIO, as opposed to some other platforms that emulate it using threads in glibc
<whitequark> but this kernel AIO is slightly less capable than even epoll
<whitequark> and it doesn't allow you to wait on FS all the like
<whitequark> there's also no equivalent to SEH, so I'm sure errors have to be propagated in some extra awkward way
<larsc> Linux AIO and POSIX AIO are a bit different, but you can use Linux AIO to implement POSIX AIO
<whitequark> I mean--when you're using Linux AIO, it looks like POSIX AIO to userspace, isn't it?
<larsc> no
<larsc> there is libaio
<whitequark> hm
<whitequark> oh, I see
<whitequark> so it's not actually even exposed in glibc? that's worse than I thought
<larsc> ues
<larsc> I think glibc even implements POSIX AIO with threads
<larsc> and blocking read()/writes()
<whitequark> yes, but I thought it used kernel AIO on Linux
<larsc> it might do these days
<bb-m-labs> build #112 of artiq-win64-test is complete: Success [build successful] Build details are at http://buildbot.m-labs.hk/builders/artiq-win64-test/builds/112
<larsc> not sure
<larsc> doing concurrent programming in userspace is always really annoying
<larsc> in the Linux kernel proper abstractions for all those things exist
<bb-m-labs> build #588 of artiq is complete: Success [build successful] Build details are at http://buildbot.m-labs.hk/builders/artiq/builds/588
<larsc> and things are pretty easy
<larsc> but in userspace it is one big mess
<whitequark> not necessarily, .net handles it pretty nicely
<whitequark> they have both asynchronous programming and lightweight threads (kernel threads with userspace scheduling)
<whitequark> the latter concept was even ported to linux, with fairly large performance gains, but never upstreamed AFAIK
<larsc> and even if you were to implement a proper framework with a good userspace ABI people would say you already have epoll() and friends just use that
<cr1901_modern> Why would you use lightweight threads, as opposed to, cooperative multitasking?
<whitequark> most unix people have not a shred of understanding of good API design
<whitequark> probably self-selection
<whitequark> cr1901_modern: external libraries, for one
<whitequark> cooperative multitasking has no advantages over lightweight threads and many drawbacks
<whitequark> most of which stem from the fact that lightweight threads are true kernel threads and cooperative threads / fibers are just a figment of imagination of some specific library
<whitequark> they break TLS, blocking system calls, various identifiers...
<whitequark> ... instrumentation such as performance counters, profilers, etc, etc
<cr1901_modern> Hmmm... *goes to learn more*
<larsc> so what's the difference between the LWT and a regular thread then?
<bb-m-labs> build #330 of artiq-kc705-nist_clock is complete: Success [build successful] Build details are at http://buildbot.m-labs.hk/builders/artiq-kc705-nist_clock/builds/330
<whitequark> larsc: scheduler
<cr1901_modern> I'm having trouble visualizing how they break TLS (unless you meant that TLS is essentially impossible b/c there's no place to actually properly store TLS)
<whitequark> you can create as many LWTs as you want without impacting scheduling time
<whitequark> the only resources they intrinsically consume is 1) kernel objects and 2) stacks
<whitequark> since stacks are lazily allocated, you get 4k+sizeof(kern_thread) per thread
<whitequark> cr1901_modern: TLS is an OS interface, if a library stores something in TLS it expects to get it back in the same logical thread then
<whitequark> cooperative threading libraries do an n:m mapping from cooperative to OS threads, with hilarious results
<bb-m-labs> build #113 of artiq-win64-test is complete: Success [build successful] Build details are at http://buildbot.m-labs.hk/builders/artiq-win64-test/builds/113
<larsc> so the LWTs are scheduled by userspace?
<whitequark> yes
<larsc> ok thanks
<bb-m-labs> build #589 of artiq is complete: Success [build successful] Build details are at http://buildbot.m-labs.hk/builders/artiq/builds/589
<cr1901_modern> whitequark: "with hilarious results"? You mean coop libraries attempt to store multiple coop threads "TLS" (quotes intentional) in the same OS-level TLS?
<whitequark> no
<whitequark> external libraries that are unaware of cooperative threading
<whitequark> they may use TLS even if they never use blocking syscalls. TLS has lots of uses. errno, for example
<cr1901_modern> Oh... I see o.0;
<whitequark> well, errno is unlikely to break, but other things well might
<cr1901_modern> Well, you have brought up some excellent points.
<cr1901_modern> Whatever replaces Unix, I do hope it at least inherits home directories and a way to prevent the PATH from blowing up
* cr1901_modern glares at Windows on the latter count
<whitequark> that's not an OS feature
<whitequark> well, neither of these is, largely
<cr1901_modern> UI feature?
<whitequark> the first is UI, the second is libc
<cr1901_modern> (My comment was inspired by the fact that I broke my Windows Path this morning and had to download a Path manager)
<larsc> errno is already broken ;)
<whitequark> well, yeah
<whitequark> the things I had in mind were more along the lines of, say, OpenGL contexts
<larsc> but to be fair it probably looked like a good idea 40 years ago
<whitequark> ... arguably, OpenGL is broken too
<cr1901_modern> I always wanted an error variable that returned 3 possible values
<whitequark> there shouldn't be any error variables.
<whitequark> there should be a return value, which indicates a success or an error. error_or<Error, Value> or something
fengling has joined #m-labs
<cr1901_modern> In GL, you call a function after getting the return value to get the error reason. Idk many C/C++ APIs that return structs with an embedded union to simulate variants.
<whitequark> yes, because it's very awkward in C, and also unsafe
<whitequark> yet another reason why C is a bad idea
<larsc> but it probably looked like a good idea 40 years ago ;)
<whitequark> MK is 43 years old, C is 44 years old
<whitequark> *ML is
<whitequark> so... no, I don't think that's a good excuse
<whitequark> and ML wasn't even particularly pioneering in that area
<cr1901_modern> And no doubt the concepts of ML predate high level langs
fengling has quit [Ping timeout: 240 seconds]
<cr1901_modern> I guess the Unix guys needed something that didn't suck as much as assembly language, but still left "little" (quotes intentional) to the imagination.
<sb0> whitequark, sooo...
<sb0> you like qt, right? :)
<whitequark> sure
<whitequark> do you have a particularly obscure bug?
<sb0> when the last row of a model is deleted, and selected, qt tries to select the next one when I call beginRemoveRows()
<sb0> but since it is the last one, there is no next one, and it calls my index() method with an invalid row number
<sb0> what should I return then?
<whitequark> oh, that's easy
<whitequark> QVariant()
<sb0> is it even supposed to do that?
<whitequark> mhm
<sb0> it's pretty nasty behavior to call index with row >= rowCount()
<sb0> unless my rowCount is broken. let me check...
<sb0> nope. Qt did call index with row == rowCount()
<whitequark> yes, it's supposed to do so
<whitequark> no, it's not documented properly in any places where I looked, which is bad
<whitequark> er, not sibling()
<sb0> so I give it a QtCore.QVariant() and it stfus?
<whitequark> wait, you say you call index()?
<whitequark> QVariant is for data()
<whitequark> for index() you need, hm
<whitequark> QModelIndex()
<whitequark> same idea
<whitequark> oh, yes, it is definitely valid to call .index() with invalid inputs
<whitequark> it is supposed to return an invalid index, which is what QModelIndex creates()
<sb0> no, Qt calls my index with those nasty inputs
<whitequark> yes
<sb0> and it crashes right now
<whitequark> it's valid to call your .index() with an invalid argument
<whitequark> and it should return an invalid index
<whitequark> this actually is documented
<sb0> okay, that works, and qt selects the row above instead
<whitequark> index()Given a model index for a parent item, this function allows views and delegates to access children of that item. If no valid child item - corresponding to the specified row, column, and parent model index, can be found, the function must return QModelIndex(), which is an invalid model index.
<sb0> qt is very annoying
<whitequark> no, you just can't be bothered to read the documentation
<whitequark> funny, given how much you insist I write it for ARTIQ...
<sb0> what purpose does calling index() with invalid inputs serve?
<whitequark> the purpose of defining calling index() with invalid inputs to return an invalid model index is that it's better than a crash or returning nonsense data
<sb0> qt knew that row was invalid. it called rowCount() just before.
* whitequark shrugs
<whitequark> if it's defined, it can be called
<GitHub102> [artiq] sbourdeauducq pushed 1 new commit to master: https://git.io/vV7Z1
<GitHub102> artiq/master 3134106 Sebastien Bourdeauducq: gui/models: handle Qt calling DictSyncTreeSepModel.index with garbage inputs. Closes #388
<GitHub26> [artiq] sbourdeauducq pushed 1 new commit to release-1: https://git.io/vV7ZD
<GitHub26> artiq/release-1 9361900 Sebastien Bourdeauducq: gui/models: handle Qt calling DictSyncTreeSepModel.index with garbage inputs. Closes #388
<sb0> if this were artiq, 1) i would have tried to avoid calling user code with deliberately wrong inputs 2) if that could not be avoided, there should have been a big fat warning in the docs "artiq _will_ call your code with garbage, and you must handle it"
<whitequark> yeah, and it's clearly documented to do so
<whitequark> have you read the model/view programming guide before doing model/view programming?
<sb0> I don't call this little phrase a "big fat warning"
<sb0> and MVC doesn't necessarily implies all those nasty qt idiosyncrasies
<whitequark> hm?
<whitequark> Qt has an explanation of how specifically to use its model/view classes
<whitequark> if you haven't read it, you have no moral right to complain when the API doesn't work as you expect
<bb-m-labs> build #331 of artiq-kc705-nist_clock is complete: Success [build successful] Build details are at http://buildbot.m-labs.hk/builders/artiq-kc705-nist_clock/builds/331
<sb0> yes, I will read the brainfuck programming language guide too, then write artiq in it, without complaining
<sb0> or intel x86 assembly manuals. or acpi aml.
<whitequark> so you did not read it.
<sb0> I would not have been able to do anything if I didn't. that's not my point.
<whitequark> your point is a false equivalence between a 16kword article and a nine-volume manual
<sb0> my point is many parts, like this calling user code with garbage inputs or the whole parent() thing, are idiosyncratic and prone to errors
<bb-m-labs> build #114 of artiq-win64-test is complete: Success [build successful] Build details are at http://buildbot.m-labs.hk/builders/artiq-win64-test/builds/114
sb0 has quit [Quit: Leaving]
<bb-m-labs> build #590 of artiq is complete: Success [build successful] Build details are at http://buildbot.m-labs.hk/builders/artiq/builds/590
_rht has joined #m-labs
fengling has joined #m-labs
fengling has quit [Ping timeout: 240 seconds]
key2 has quit [Ping timeout: 260 seconds]
FabM has quit [Quit: ChatZilla 0.9.92 [Firefox 45.0.1/20160315153207]]
FabM has joined #m-labs
fengling has joined #m-labs
fengling has quit [Ping timeout: 240 seconds]
ylamarre has joined #m-labs
sb0 has joined #m-labs
evilspirit has quit [Ping timeout: 268 seconds]
rohitksingh has joined #m-labs
siruf has quit [Ping timeout: 244 seconds]
siruf has joined #m-labs
siruf has joined #m-labs
siruf has quit [Remote host closed the connection]
siruf has joined #m-labs
fengling has joined #m-labs
fengling has quit [Ping timeout: 240 seconds]
evilspirit has joined #m-labs
fengling has joined #m-labs
evilspirit has quit [Ping timeout: 250 seconds]
fengling has quit [Ping timeout: 240 seconds]
sandeepkr__ has quit [Ping timeout: 246 seconds]
mumptai has joined #m-labs
mumptai has quit [Quit: Verlassend]
rohitksingh has quit [Quit: Leaving.]
_rht has quit [Quit: Connection closed for inactivity]
ylamarre has quit [Quit: ylamarre]
ionzee has quit [Read error: Connection reset by peer]