#tyndur · 2010-01-27
146 Nachrichten · Seite 1 von 1 · Original-CSV herunterladen
- kwolfMoin
- FreakyPenguinMoin
- kwolfping pc[away]
- pc[away]pong kwolf
- kwolfI've noticed that with the current synchronous interfaces and our agreement to forbid threads, we actually have a problem ;-)
- kwolfWe can have one of them, but both together mean that we completely block a device while its processing a request
- pcmattmanHmm, yes: that might be problematic
- pcmattmanAlso, I should probably mention that I now have the SATA specification so if I end up being able to write a SATA driver I'll be porting it to CDI
- kwolfIt might not be relevant for our current basic drivers, but it limits possible performance, so we need to decide which option we want to take. What's your preference?
- pcmattmanPerhaps we might need to add in locking of some sort to CDI drivers, implemented by the host - that'd be the best performance route
- kwolfpcmattman: Nice. I'm just wondering why you take the pain of porting it and don't do SATA as a CDI driver in Pedigree in the first place
- pcmattmanI guess mainly because it's easier to do hackish testing with the Pedigree driver interface ;)
- kwolfWhat are we missing to allow hackish testing? ;-)
- FreakyPenguin*g*
- pcmattmanAs for your original question: wouldn't it be difficult to allow asynchronous behaviour and forbid threads? :)
- kwolfAs for the CDI locks, I was thinking of opt-in multithreading for drivers, too
- FreakyPenguinHm sounds reasonable, yes
- kwolfAnd yes, I think async wouldn't be as nice to handle, but you might have been of a different opinion
- kwolfAnd I didn't want to influence your answer ;-)
- kwolfMultithreading not in the sense that drivers could spawn threads, but that the CDI implementaiton is allowed to run multiple threads
- pcmattmanRight, that's how I thought you defined threads
- pcmattmanIn which case I would say remove threads and allow asynchronous calls to drivers
- pcmattmanI know that's not what you wanted to hear, but it's what I think makes the interface more accessible
- kwolfIt's really a hard thing to estimate what effect it would have on drivers
- kwolfBasically, I want to keep writing drivers as simple as possible, while still not limiting them too much
- kwolfHm, what exactly do you mean by "more accessible"?
- pcmattmanWell, the implementation doesn't need to worry about enforcing locking, just providing something like a mutex implementation in the interface if they feel locking is an issue
- pcmattmanIf they don't need locking that can be a no-op - it leaves the choice up to the OS developer rather than enforcing a CDI design choice on them
- pcmattmanIt does however mean driver writers need to write code which locks global structures when they're used and all that
- kwolfHm, what you describe is basically threading, no?
- pcmattmanFor one definition of threading
- pcmattmanIt might be coming from a completely different process context, but I guess it's still a thread
- kwolfThe async model would mean that you don't need locks because threading is forbidden, but each function like send_packet gets a callback as an additional parameter
- kwolfAt least that's how I understand it
- pcmattmanWell, I think it should be possible for multiple contexts to call upon a driver
- kwolfThe context usually doesn't make a difference in kernel space, does it?
- pcmattmanIn Pedigree for example you can have many threads all calling into the same device driver
- pcmattman(system calls are pre-emptable by the scheduler)
- kwolfWell, yes
- kwolfYou're confusing me
- kwolfAre we actually talking about the same thing, just with different names?
- pcmattmanPossibly
- kwolfBecause this is exactly my definition of the threading solution, whereas you said "remove threads"
- pcmattmanWell, the CDI implementation doesn't create threads, which is how you defined it earlier
- kwolfThe Pedigree kernel is the CDI implementation
- pcmattman"run multiple threads" interpreted as "create multiple threads"
- pcmattmanNo, the CDI implementation is the CDI module which sits between the kernel and CDI drivers
- pcmattmanThe interface != the kernel
- kwolfIt implements the interface by means of the kernel, so the kernel is part of the implementation ;-)
- kwolfOkay, I'll s/CDI implementation/OS/ then. Better this way?
- pcmattmanWell in that case my mention of "remove threads" is the opposite of what I want ;)
- kwolfRight, so I guess we actually mean the same
- kwolfpcmattman: Are you okay with making this kind of threading opt-in? Like adding a field cdi_driver.threadsafe and if it's not set, the CDI implementation must lock the device before calling into the driver if the OS uses threads?
- pcmattmanYeah, sounds good
- pcmattmanI'm not 100% certain if the driver should call a CDI function to lock the resource or if the OS should decide though
- kwolfHow could the OS decide that?
- pcmattmanWell, s/OS/CDI implementation/
- kwolfSame question
- pcmattmanA driver might call cdi_mutex_lock(&driver->mutex) because it knows it's about to touch a global structure
- pcmattmanThe OS wouldn't know that the global structure needs locking
- pcmattmanCDI implementation rather
- kwolfRight, as I understand it this means that the driver need to lock
- pcmattmanSo the question is: is the threading opt-in to be an opt-in provided by the CDI implementation (eg, turning cdi_mutex_lock into a no-op)?
- pcmattman(that would mean drivers would need to be fully aware of potential locking, but the OS developer could ignore the lock requests if they wanted)
- pcmattmanOr should it be on the other side?
- kwolfWhat I was thinking about is that driver can completely ignore the whole issue and get a global lock from the CDI implementation if needed.
- kwolfTheir performance will probably suffer, but a simple working driver is better than no driver at all
- kwolfWhat the CDI implementation actually is doing with lock requests, is up to the OS anyway. If the OS uses threads, it should probably do locking. If not, make it a no-op.
- pcmattmanThat works
- pcmattmanI was afraid to suggest a "global lock" idea, so I'm glad you did for me :)
- kwolfHeh, I'm always good for suggesting ugly things ;-)
- kwolfHave you already had a look at my mem.h mail?
- pcmattmanI have, and I have replied
- pcmattmanI thought you had already received it and ignored it ;)
- kwolfI'm talking about my reply to your reply to my original mail ;-)
- kwolfAt least there isn't another reply to this one yet on list.tyndur.org
- pcmattmankwolf: Ah, I found the reply
- kwolfYou still don't use mail folders and threading (yay, in a third meaning!)? At some point you'll need to organise your mails better. ;-)
- pcmattmanI'd like to auto-archive all the QEMU-devel mails so I don't get excited when I wake up and have 150 emails :)
- kwolfSorry, I'll try to keep my next patch series on qemu-devel smaller ;-)
- pcmattmanIt's those guys with the 30-odd patch series which could _easily_ be merged into 3 or 4 larger patches
- pcmattmanIf I saw a 30 patch series for Pedigree I'd just ignore it ;)
- kwolfHeh, I was just going to say "yes, the Pedigree repository looks like you merge everything together" ;-)
- kwolfI mean, merging is always easy - git will do it for you. Reviewing a monster patch isn't as easy, though.
- pcmattmanTrue
- pcmattmanI try to split work into smallish patches, but I still don't commit for every little change to each file
- pcmattmanI know that's not really what qemu-devel is like, but exaggeration is fun ;)
- pcmattmanWell, each was a milestone in the development
- pcmattmanThen a few while I was fixing it ;)
- pcmattmanRight, replied to your mail
- pcmattmanI'm off to sleep now, so I'll read your reply in the morning
- kwolfOk, good night
- quokwow a backlog for me to read
- quokmoin, btw :)
- XanClicMoin, quok
- kwolfMoin quok
- kwolfquok: Still reading the backlog or are you in silent agreement?
- quokkwolf: just got out of a meeting at work, so now time to read the backlog
- kwolfThat's the advantage of conference calls: You can read the backlog during the call. ;-)
- FreakyPenguin*g*
- quokunfortunately this one wasn't a conf call
- quokanyway... I think the above conversation has confused me
- kwolfAnything else would have been surprising, because we were confused as well ;-)
- kwolfBut you're still confused in the end?
- quokI want to be able to run each driver in a separate thread, but I don't need multiple threads for the same driver :)
- quokyes, still confused :)
- kwolfYou do need multiple threads for the same driver if you only have synchronous functions
- quokno you don't, you can just let the driver block! :)
- kwolfAs an example, I can't be in send_packet() until the network card signals back that the packet has actually be sent, before I queue the next one
- kwolfWell, I can, but performance suffers
- quokactually my original idea for device drivers in quokos was fully asynchronous drivers, each running in a separate thread
- quokbut drivers themselves didn't need to be multi-threaded
- kwolfI'm not sure if asynchronous drivers are easier to do
- kwolfYour definition of asynchronous functions is the same as mine, btw? ;-)
- quoksomething with callbacks? :)
- kwolfShould be near enough then ;-)
- kwolfMatt seemed to understand something completely different
- quokthe synchronous model makes driver writing easier though. All this locking and such will confuse people. Too many people have trouble making it past "Hello OS World!" ;)
- kwolfRight, I'm afraid of ending up with something like qcow2 which is AIO hell
- quokand I don't want to end up with something like UDI ;)
- kwolfI've not seen much from UDI except this meta-meta-meta programming stuff
- kwolfBut from what I've heard how it works I'd expect it's the same kind of thing
- kwolfI'm still undecided what the solution to our problem is, though. Maybe it ends up being the callbacks.
- quokooh, a new thread for every request! ;)
- quokI'm joking, of course
- kwolfHeh ;-)
- kwolfCDI, now with built in stress test for your scheduler ;-)
- kwolfAnd memory management. And everything.
- kwolfBut, well, I guess UDI beats it. It has a stress test for your brain.
- FreakyPenguin*g*
- taljethre
- FreakyPenguinwz
- XanClicwb
- taljethHeh, different amount of i18n ;-)
- FreakyPenguinAh that's #tyndur... ;-)
- taljethI think it's okay, quok hasn't had his German lesson for today yet ;-)
- FreakyPenguinHope that isn't too much for him. *g*
- quok:P
- quoktrying to code when you are constantly sneezing and your eyes are watering isn't fun
- taljethWhat code? Hm, at this time probably still at work?
- quokactually I left work early today
- quokworking on some quokos code right now
- taljethStill MM?
- quoknah, bootloader type code
- taljethgn8
- FreakyPenguingn8