-
Notifications
You must be signed in to change notification settings - Fork 255
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
libc: add support for AIO #5302
Comments
I replaced the commit for async jobs by my initial proposal commit a6aced7 that keeps the semantic as tight as possible: onl one new API function |
I finished the first review - please address my inline comments. Note, I made remarks about coding style issues but only once. Please lookout for further similar errors by yourself. |
I cleaned up my branches https://github.com/chelmuth/genode/commits/kqueue and https://github.com/chelmuth/genode/commits/aio. |
Make the Sync object accessible outside of Vfs_plugin for use in AIO. Issue genodelabs#5302
Make the Sync object accessible outside of Vfs_plugin implementation, e.g., for use in AIO. Issue genodelabs#5302
@chelmuth please give my atopia/genode/tree/aio-rebased branch a spin |
Make the Sync object accessible outside of Vfs_plugin implementation, e.g., for use in AIO. Issue genodelabs#5302
Please see my new aio branch that includes all your changes plus some minor adjustments (libc port-hash update, indentation fixes). Commit 4ed972c is special as it proposes to change the signatures of I also noticed aio.cc suffers from indentation levels above 4, which could be addressed in a fixup in my opinion. |
Unless I have a fundamental misunderstanding about the monitor mechanism, each Job will remain in the Job registry and will be run over and over again until it returns a As for the second idea: Why do you think that AIO does not have a seek pos?
I read that as meaning that an aio write needs to seek to |
Now that I quoted it, it seems that I would need to check |
Thanks for the little fixes! |
The last sentence of the quoted paragraph from https://pubs.opengroup.org/onlinepubs/9799919799/functions/aio_write.html reads like follows.
Blending this with Unfortunately, I entirely missed the fact that the VFS API still depends on the seek position stored in the VFS handle for implementing a |
Yes, I remember that the file offset is unspecified, but honestly I've just relied on the seek mechanism internally (basically thinking that just because it is unspecified after queueing an async op does not mean that I can't use it internally from within the subsystem). However - you are raising a valid point w.r.t. the order of operations. Although my understanding is that the monitor will run the Jobs in the order they were queued, for example async writes could still be interleaved if there is a partial write, then the job returns as incomplete, then the next async job on the same file runs with another partial write etc. I'll also think about what the requirements and guarantees really should be and then we can discuss offline! |
…nc_write" See genodelabs#5302 (comment) for a discussion of the proposal. This reverts commit 4ed972c.
This tries to solve the problems around multiple queued async writes to the same file for the non-append case, but still needs confirmation and testing. The append-case will work fine when async_write() is called from a synchronous write operation (because that blocks until the write is completed) but will likely end up with reordering or even intertwined writes for async writes to files opened with O_APPEND> POSIX.1-2024 2.8.2 Asynchronous I/O states: "If O_APPEND is set for the file descriptor, or if aio_fildes is associated with a device that is incapable of seeking, write operations append to the file in the same order as the calls were made, with the following exception: under implementation-defined circumstances, such as operation on a multi-processor or when requests of differing priorities are submitted at the same time, the ordering restriction may be relaxed." We could try to do a full write in the append case (just like with O_NONBLOCK), but in that case we would change the normal, synchronous case for a very slight improvment: Since under the hood the Job Registry reverses the order of all incomplete jobs after each run, such a reordering is even likely and by Posix' "relaxed" ordering, doing to do async writes to O_APPEND files doesn't seem like such a great idea anyway. To recap: the current code might even end up with interleaved writes for async writes to a file opened with O_APPEND. This could be mitigated by attempting to write out the write request in full, which would lead to possibly reordered but at least not interleaved writes to O_APPEND files. We currently don't do this, because it would change the write approach for synchronous writes to O_APPEND files as well, which seems like the much saner case, and thus it does not seem like a good tradeoff. Issue genodelabs#5302
Add support for the AIO(4) asynchronous IO facility.
The text was updated successfully, but these errors were encountered: