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

libvfio-user responds with duplicated FD in get_region_info when sparse maps is used #711

Open
tmakatos opened this issue Sep 19, 2022 · 2 comments
Labels
api-change bug Something isn't working

Comments

@tmakatos
Copy link
Member

In dev_get_caps:

        for (i = 0; i < nr_mmap_areas; i++) {
            struct iovec *iov = &vfu_reg->mmap_areas[i];

            vfu_log(vfu_ctx, LOG_DEBUG, "%s: area %d [%p, %p)", __func__,
            i, iov->iov_base, iov_end(iov));
            (*fds)[i] = vfu_reg->fd;
            sparse->areas[i].offset = (uintptr_t)iov->iov_base;
            sparse->areas[i].size = iov->iov_len;
        } 

If we use more than one sparse mmap in a device region, libvifo-user duplicates the FD for each sparse map. However, QEMU only expectes one FD which is also what the spec mandates (there's only one FD in VFIO as well). We should either fix libvfio-user or change the spec to allow multiple FDs to be returned.

@tmakatos tmakatos added the bug Something isn't working label Sep 19, 2022
@jlevon
Copy link
Collaborator

jlevon commented Oct 3, 2022

Presumably this isn't breaking now just because we don't have > 1 sparse area?

@tmakatos
Copy link
Member Author

tmakatos commented Oct 4, 2022

Presumably this isn't breaking now just because we don't have > 1 sparse area?

Yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-change bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants