qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] vfio: If DMA map returns ENOMEM wait and try ag


From: Sergio Lopez Pascual
Subject: Re: [Qemu-devel] [PATCH] vfio: If DMA map returns ENOMEM wait and try again
Date: Mon, 3 Apr 2017 18:07:01 +0200

On Mon, Apr 3, 2017 at 5:40 PM, Alex Williamson
<address@hidden> wrote:
>
> On Mon,  3 Apr 2017 10:58:22 +0200
> Sergio Lopez <address@hidden> wrote:
>
> > When quickly unmapping and mapping memory regions (as may happen in
> > address_space_update_topology), if running with a non-unlimited
> > RLIMIT_MEMLOCK, the kernel may return ENOMEM for a map request
> > because the previous unmap has been processed, but accounted yet.
> >
> > Probably this should be fixed in the kernel ensuring a deterministic
> > behavior for VFIO map and unmap operations. Until then, this works
> > around the issue, waiting 10ms and trying again.
>
> I think we need to know what that kernel fix is before adding arbitrary
> delays and retries in userspace code (Do we know why 10ms works?  Is
> it too long/short?).

AFAIK from userspace we can't know when a certain work scheduled in a
kernel workqueue has been completed. Calling usleep ensures the
process will yield, and 10ms looks enough time for a full world of
context switches, but I agree with you that's pretty arbitrary.

On the other hand, this code is only reached in a pretty exceptional
situation, which is not relevant from a performance point of view, and
there's already a workaround for a non-deterministic EBUSY while
mapping VGA ROM space.

There's the option of leaving this as is, and waiting for a fix in the
kernel, but I think I'd a good idea to work around the issue for older
kernels too.

Sergio.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]