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

Decouple from smol async runtime #12

Open
sam-goodwin opened this issue Oct 17, 2024 · 3 comments
Open

Decouple from smol async runtime #12

sam-goodwin opened this issue Oct 17, 2024 · 3 comments

Comments

@sam-goodwin
Copy link

The ublk_wait_and_handle_ios function has a hard dependency on smol for its async runtime. Is this necessary or can libublk be implemented independently of any particular runtime? I'd like to use tokio or monoio for my runtime and would prefer to avoid bloating my binary.

pub fn ublk_wait_and_handle_ios(exe: &smol::LocalExecutor, q: &UblkQueue) {
    loop {
        while exe.try_tick() {}
        if q.flush_and_wake_io_tasks(|data, cqe, _| ublk_wake_task(data, cqe), 1)
            .is_err()
        {
            break;
        }
    }
    q.unregister_io_bufs();
}
@sam-goodwin
Copy link
Author

The UblkQueue also can't be shared across threads. Is there guidance on how to build a multi-threaded ublk device? Or is that explicitly not supported for a reason?

@ming1
Copy link
Collaborator

ming1 commented Oct 19, 2024

The ublk_wait_and_handle_ios function has a hard dependency on smol for its async runtime. Is this necessary or can libublk be implemented independently of any particular runtime? I'd like to use tokio or monoio for my runtime and would prefer to avoid bloating my binary.

I think that is definitely reasonable to not let libublk not bind with
smol, and so far looks it is just for example code.

I will think a bit and try to move it into the rublk code.

Then smol will become invisible for this library.

Thanks,

@ming1
Copy link
Collaborator

ming1 commented Oct 19, 2024

The UblkQueue also can't be shared across threads. Is there guidance on how to build a multi-threaded ublk device? Or is that explicitly not supported for a reason?

So far, UblkQueue can't cross threads, that is also what the ublk driver is implemented.

But we are considering to try to relax this limit, please see the following
discussion:

https://lore.kernel.org/linux-block/[email protected]/

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

No branches or pull requests

2 participants