Skip to content
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

Be able to mmap outside the Lwt monad #53

Open
dinosaure opened this issue Oct 19, 2022 · 3 comments · May be fixed by #55
Open

Be able to mmap outside the Lwt monad #53

dinosaure opened this issue Oct 19, 2022 · 3 comments · May be fixed by #55

Comments

@dinosaure
Copy link
Member

It may be interesting to implement the mmap syscall. We don't really need anything very complex and it could just be a simple read() outside the Lwt monad in the first place.

val mmap : t -> off:int64 -> sectors:int64 -> (Cstruct.t list, error) result

It might be interesting to have such access for reading. The proposed interface counts in "sectors". For example off = 1L really means off = 1L * sector_size.

/cc @mirage/core

@reynir
Copy link
Member

reynir commented Nov 7, 2024

In robur-coop/miou#42 you link to https://www.remlab.net/op/nonblock.shtml. Also reading the solo5 source code the hvt tender does not return from block operation hypercalls until finished. With that in mind I think it could make sense to expose a direct read variant (for maybe just one sector?)

Considering it may make sense to use the mirage-block interface for "virtual" block devices (for example a network mounted block device) I think the mmap function should be optional somehow. But I think it would make sense to add to mirage-block-solo5 etc.

@samoht
Copy link
Member

samoht commented Nov 9, 2024

The semantics of operations on a mmaped region is very weird (in terms of consistency and asynchronous behavior). I'm not sure I'm very keen on exposing this in mirage directly.

@dinosaure
Copy link
Member Author

mmap is probably not the best example - because it refers to virtual memory. It's more about something like pread which must be aligned on the page size. The fact is we should not poll (it just degrades performances for nothing) when it's about reading or writing into a block device - but we must think about cooperative points afterwards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants