Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
soc:2010:peper:journal:week10 [2010/07/26 15:44] peper |
soc:2010:peper:journal:week10 [2010/07/31 15:13] (current) peper |
||
|---|---|---|---|
| Line 3: | Line 3: | ||
| ==== drivers in userspace ==== | ==== drivers in userspace ==== | ||
| + | === The big issue === | ||
| There is one thing that keeps bugging me in the [[http://git.etherboot.org/?p=people/peper/gpxe.git;a=shortlog;h=refs/heads/drivers|drivers branch]] - UIO-DMA and malloc. | There is one thing that keeps bugging me in the [[http://git.etherboot.org/?p=people/peper/gpxe.git;a=shortlog;h=refs/heads/drivers|drivers branch]] - UIO-DMA and malloc. | ||
| UIO-DMA does the DMA mappings on a per device basis (as does kernel). I am | UIO-DMA does the DMA mappings on a per device basis (as does kernel). I am | ||
| Line 16: | Line 17: | ||
| around that I have added an option to use the last device setup with | around that I have added an option to use the last device setup with | ||
| UIO-DMA for the mappings and introduced a UIO-DMA malloc_backend - [[http://git.etherboot.org/?p=people/peper/gpxe.git;a=commitdiff;h=14009a8a96431cecd089c70d6ac44bfe75244497|here]] and [[ http://git.etherboot.org/?p=people/peper/gpxe.git;a=commitdiff;h=941ffdafdac66bcbca04fbac1668a4b944c7c18a|here]]. | UIO-DMA for the mappings and introduced a UIO-DMA malloc_backend - [[http://git.etherboot.org/?p=people/peper/gpxe.git;a=commitdiff;h=14009a8a96431cecd089c70d6ac44bfe75244497|here]] and [[ http://git.etherboot.org/?p=people/peper/gpxe.git;a=commitdiff;h=941ffdafdac66bcbca04fbac1668a4b944c7c18a|here]]. | ||
| - | The reason I use tables (and not single api) for the backends | + | The reason I use the tables API (and not single API) for the backends |
| is that it needs to be able to fallback so that using the tap driver | is that it needs to be able to fallback so that using the tap driver | ||
| - | is still possible w/o the modules. | + | is still possible without the UIO-DMA modules being loaded and initialized). |
| I don't really like the solution and I am starting to think that doing | I don't really like the solution and I am starting to think that doing | ||
| Line 28: | Line 29: | ||
| code size. | code size. | ||
| - | Or I could make the malloc | + | Or I could make the malloc backend a single API (no need for fallback any more) and implement it in userspace like that: |
| - | backend a single api (no need for fallback any more) and for userspace | + | * in a __init_fn provide the malloc pool by mmap()ing a chunk of memory (like linux_umalloc does) - let's call it A |
| - | on init mmap a chunk of memory (like linux_umalloc does) and then | + | * if an lpci device is going to be used: |
| - | during lpci init allocate the same amount with UIO-DMA, copy the old | + | * allocate the same amount of memory as for A from UIO-DMA - let's call the new chunk B |
| - | memory over, unmap the old chunk and remap the newly allocated chunk | + | * copy A over to B |
| - | in that place. | + | * munmap() A (this isn't really needed as mremap() can take care of that) |
| - | I like the last option most cause it uses the current malloc() | + | * mremap() B to the now free location of A |
| - | implementation, works for tap and doesn't feel so hackish. I am going to implement that soonish unless other ideas arise :) | + | |
| + | I like the last option most cause it uses the current malloc() implementation, works for tap and doesn't feel so hackish (just sophisticated ;). I am going to implement that soonish unless other ideas arise. | ||
| + | |||
| + | == Update == | ||
| + | |||
| + | "Sophisticated" didn't really work for Josh, but I have come up with something different. I have introduced separate memery pools for normal and DMA memory allocation with an API for switching the latter. | ||
| + | See [[http://git.etherboot.org/?p=people/peper/gpxe.git&a=search&h=refs/heads/drivers&st=commit&s=[malloc]+Introduce+memory+pools+and+hide+internal+API|[malloc] Introduce memory pools and hide internal API]] | ||
| + | |||
| + | === Smaller issues === | ||
| + | |||
| + | * currently ''gpxe.linux'' binary doesn't contain the ''tap'' driver - easily fixable | ||
| + | * out/in* segfault in userspace if ''iopl()'' wasn't called - will probably have to check whether the ioports were initialized on each call | ||
| + | |||
| + | == Update == | ||
| + | |||
| + | These have been fixed. Moreover, slighty related to the first one, I have come up with a [[http://git.etherboot.org/?p=people/peper/gpxe.git;a=shortlog;h=refs/heads/buildall|buildall branch]], | ||
| + | which allows building alldrivers builds on all supported arch/platform combinations and also adds a everything target that takes advantage of that and builds everything that I could think of. Should come in handy for testing patches. | ||
| + | The changes are mostly trivial, but if you want to refresh your make-foo have a look at [[http://git.etherboot.org/?p=people/peper/gpxe.git&a=search&h=refs/heads/buildall&st=commit&s=[build]+Properly+handle+multiple+goals+per+BIN+directory|[build] Properly handle multiple goals per BIN directory]]. | ||
| + | |||
| + | |||
| + | === Update === | ||
| + | |||
| + | I have updated pretty much every commit in the [[http://git.etherboot.org/?p=people/peper/gpxe.git;a=shortlog;h=refs/heads/drivers|drivers branch]], adding comments and doing cleanup. | ||