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

File Isolation: Investigate copying files on host OS to guest memory. #768

Open
n0toose opened this issue Sep 27, 2024 · 7 comments
Open
Labels
enhancement New feature or request File System

Comments

@n0toose
Copy link
Member

n0toose commented Sep 27, 2024

Requires #766
Related to #239

@n0toose n0toose added the enhancement New feature or request label Dec 16, 2024
@jounathaen
Copy link
Member

Can you elaborate a little on what you intend to do here?

@n0toose
Copy link
Member Author

n0toose commented Feb 7, 2025

Instead of accessing files directly on the host system, one could copy the files in the memory itself, and have the guest OS access the in-memory version of the file.

I am not sure if this is actually worth it right now.

@jounathaen
Copy link
Member

Isn't this the current behavior of Uhyve? Or do you want to do a pre-reading during the opening?

@n0toose
Copy link
Member Author

n0toose commented Feb 7, 2025

If I remember correctly, I got this idea for files that were explicitly mapped using --file-mapping. Instead of reading files during the virtual machine's lifetime, one could do this beforehand, perform operations to files that are "in-memory", and theoretically achieve speed improvements.

However, I am not sure if this idea would cause problems later down the line. Such an approach raises a few questions, i.e. "when do we 'sync' the file onto the filesystem", "what about the directories and the directories' contents" and "shouldn't we focus on other things instead first"?

@mkroening
Copy link
Member

mkroening commented Feb 7, 2025

How is this different from using Hermit's ramfs?

Edit: Ah, so this is basically a cache for files that should be persistent too?

@n0toose
Copy link
Member Author

n0toose commented Feb 7, 2025

Edit: Ah, so this is basically a cache for files that should be persistent too?

Basically-ish. The goal would be to spare the control transition of the user mode / kernel mode on the host by actually performing the write in the background, so that I/O operations do not block. After the file (stored in memory) is modified by the kernel, another thread could take over of the actual write operation on the host "asynchronously", without slowing down the unikernel's performance.

How is this different from using Hermit's ramfs?

A problem would be that Uhyve would not "know" where, memory-wise, these files should be stored, as Uhyve would not know where the ramfs is. However, if Uhyve were aware of the address space for ramfs and loaded the files onto there, what I am describing would be, in theory, possible. Perhaps a second memory could work?

Unlike the FUSE driver, Uhyve's file access layer does not really have a concept of "nodes" (a "meta-filesystem" that makes "Hermit" aware of a "structure", see: #839 - can't come up with a better description right now) - I am not sure if this is a blocker.

@n0toose
Copy link
Member Author

n0toose commented Feb 7, 2025

Anyways, this idea spawned from a discussion with @jounathaen from ages ago, but I really do not have a concrete idea as to how I'd go on about with implementing this myself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request File System
Projects
None yet
Development

No branches or pull requests

3 participants