#tyndur · 2010-01-27

146 Nachrichten · Seite 1 von 1 · Original-CSV herunterladen

  1. kwolfMoin
  2. FreakyPenguinMoin
  3. kwolfping pc[away]
  4. pc[away]pong kwolf
  5. kwolfI've noticed that with the current synchronous interfaces and our agreement to forbid threads, we actually have a problem ;-)
  6. kwolfWe can have one of them, but both together mean that we completely block a device while its processing a request
  7. pcmattmanHmm, yes: that might be problematic
  8. 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
  9. 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?
  10. 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
  11. 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
  12. pcmattmanI guess mainly because it's easier to do hackish testing with the Pedigree driver interface ;)
  13. kwolfWhat are we missing to allow hackish testing? ;-)
  14. FreakyPenguin*g*
  15. pcmattmanAs for your original question: wouldn't it be difficult to allow asynchronous behaviour and forbid threads? :)
  16. kwolfAs for the CDI locks, I was thinking of opt-in multithreading for drivers, too
  17. FreakyPenguinHm sounds reasonable, yes
  18. kwolfAnd yes, I think async wouldn't be as nice to handle, but you might have been of a different opinion
  19. kwolfAnd I didn't want to influence your answer ;-)
  20. kwolfMultithreading not in the sense that drivers could spawn threads, but that the CDI implementaiton is allowed to run multiple threads
  21. pcmattmanRight, that's how I thought you defined threads
  22. pcmattmanIn which case I would say remove threads and allow asynchronous calls to drivers
  23. pcmattmanI know that's not what you wanted to hear, but it's what I think makes the interface more accessible
  24. kwolfIt's really a hard thing to estimate what effect it would have on drivers
  25. kwolfBasically, I want to keep writing drivers as simple as possible, while still not limiting them too much
  26. kwolfHm, what exactly do you mean by "more accessible"?
  27. 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
  28. 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
  29. pcmattmanIt does however mean driver writers need to write code which locks global structures when they're used and all that
  30. kwolfHm, what you describe is basically threading, no?
  31. pcmattmanFor one definition of threading
  32. pcmattmanIt might be coming from a completely different process context, but I guess it's still a thread
  33. 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
  34. kwolfAt least that's how I understand it
  35. pcmattmanWell, I think it should be possible for multiple contexts to call upon a driver
  36. kwolfThe context usually doesn't make a difference in kernel space, does it?
  37. pcmattmanIn Pedigree for example you can have many threads all calling into the same device driver
  38. pcmattman(system calls are pre-emptable by the scheduler)
  39. kwolfWell, yes
  40. kwolfYou're confusing me
  41. kwolfAre we actually talking about the same thing, just with different names?
  42. pcmattmanPossibly
  43. kwolfBecause this is exactly my definition of the threading solution, whereas you said "remove threads"
  44. pcmattmanWell, the CDI implementation doesn't create threads, which is how you defined it earlier
  45. kwolfThe Pedigree kernel is the CDI implementation
  46. pcmattman"run multiple threads" interpreted as "create multiple threads"
  47. pcmattmanNo, the CDI implementation is the CDI module which sits between the kernel and CDI drivers
  48. pcmattmanThe interface != the kernel
  49. kwolfIt implements the interface by means of the kernel, so the kernel is part of the implementation ;-)
  50. kwolfOkay, I'll s/CDI implementation/OS/ then. Better this way?
  51. pcmattmanWell in that case my mention of "remove threads" is the opposite of what I want ;)
  52. kwolfRight, so I guess we actually mean the same
  53. 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?
  54. pcmattmanYeah, sounds good
  55. pcmattmanI'm not 100% certain if the driver should call a CDI function to lock the resource or if the OS should decide though
  56. kwolfHow could the OS decide that?
  57. pcmattmanWell, s/OS/CDI implementation/
  58. kwolfSame question
  59. pcmattmanA driver might call cdi_mutex_lock(&driver->mutex) because it knows it's about to touch a global structure
  60. pcmattmanThe OS wouldn't know that the global structure needs locking
  61. pcmattmanCDI implementation rather
  62. kwolfRight, as I understand it this means that the driver need to lock
  63. 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)?
  64. 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)
  65. pcmattmanOr should it be on the other side?
  66. 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.
  67. kwolfTheir performance will probably suffer, but a simple working driver is better than no driver at all
  68. 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.
  69. pcmattmanThat works
  70. pcmattmanI was afraid to suggest a "global lock" idea, so I'm glad you did for me :)
  71. kwolfHeh, I'm always good for suggesting ugly things ;-)
  72. kwolfHave you already had a look at my mem.h mail?
  73. pcmattmanI have, and I have replied
  74. pcmattmanI thought you had already received it and ignored it ;)
  75. kwolfI'm talking about my reply to your reply to my original mail ;-)
  76. kwolfAt least there isn't another reply to this one yet on list.tyndur.org
  77. pcmattmankwolf: Ah, I found the reply
  78. 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. ;-)
  79. 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 :)
  80. kwolfSorry, I'll try to keep my next patch series on qemu-devel smaller ;-)
  81. pcmattmanIt's those guys with the 30-odd patch series which could _easily_ be merged into 3 or 4 larger patches
  82. pcmattmanIf I saw a 30 patch series for Pedigree I'd just ignore it ;)
  83. kwolfHeh, I was just going to say "yes, the Pedigree repository looks like you merge everything together" ;-)
  84. kwolfI mean, merging is always easy - git will do it for you. Reviewing a monster patch isn't as easy, though.
  85. pcmattmanTrue
  86. pcmattmanI try to split work into smallish patches, but I still don't commit for every little change to each file
  87. pcmattmanI know that's not really what qemu-devel is like, but exaggeration is fun ;)
  88. pcmattmanWell, each was a milestone in the development
  89. pcmattmanThen a few while I was fixing it ;)
  90. pcmattmanRight, replied to your mail
  91. pcmattmanI'm off to sleep now, so I'll read your reply in the morning
  92. kwolfOk, good night
  93. quokwow a backlog for me to read
  94. quokmoin, btw :)
  95. XanClicMoin, quok
  96. kwolfMoin quok
  97. kwolfquok: Still reading the backlog or are you in silent agreement?
  98. quokkwolf: just got out of a meeting at work, so now time to read the backlog
  99. kwolfThat's the advantage of conference calls: You can read the backlog during the call. ;-)
  100. FreakyPenguin*g*
  101. quokunfortunately this one wasn't a conf call
  102. quokanyway... I think the above conversation has confused me
  103. kwolfAnything else would have been surprising, because we were confused as well ;-)
  104. kwolfBut you're still confused in the end?
  105. quokI want to be able to run each driver in a separate thread, but I don't need multiple threads for the same driver :)
  106. quokyes, still confused :)
  107. kwolfYou do need multiple threads for the same driver if you only have synchronous functions
  108. quokno you don't, you can just let the driver block! :)
  109. 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
  110. kwolfWell, I can, but performance suffers
  111. quokactually my original idea for device drivers in quokos was fully asynchronous drivers, each running in a separate thread
  112. quokbut drivers themselves didn't need to be multi-threaded
  113. kwolfI'm not sure if asynchronous drivers are easier to do
  114. kwolfYour definition of asynchronous functions is the same as mine, btw? ;-)
  115. quoksomething with callbacks? :)
  116. kwolfShould be near enough then ;-)
  117. kwolfMatt seemed to understand something completely different
  118. 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!" ;)
  119. kwolfRight, I'm afraid of ending up with something like qcow2 which is AIO hell
  120. quokand I don't want to end up with something like UDI ;)
  121. kwolfI've not seen much from UDI except this meta-meta-meta programming stuff
  122. kwolfBut from what I've heard how it works I'd expect it's the same kind of thing
  123. kwolfI'm still undecided what the solution to our problem is, though. Maybe it ends up being the callbacks.
  124. quokooh, a new thread for every request! ;)
  125. quokI'm joking, of course
  126. kwolfHeh ;-)
  127. kwolfCDI, now with built in stress test for your scheduler ;-)
  128. kwolfAnd memory management. And everything.
  129. kwolfBut, well, I guess UDI beats it. It has a stress test for your brain.
  130. FreakyPenguin*g*
  131. taljethre
  132. FreakyPenguinwz
  133. XanClicwb
  134. taljethHeh, different amount of i18n ;-)
  135. FreakyPenguinAh that's #tyndur... ;-)
  136. taljethI think it's okay, quok hasn't had his German lesson for today yet ;-)
  137. FreakyPenguinHope that isn't too much for him. *g*
  138. quok:P
  139. quoktrying to code when you are constantly sneezing and your eyes are watering isn't fun
  140. taljethWhat code? Hm, at this time probably still at work?
  141. quokactually I left work early today
  142. quokworking on some quokos code right now
  143. taljethStill MM?
  144. quoknah, bootloader type code
  145. taljethgn8
  146. FreakyPenguingn8