On Tue, Sep 03, 2019 at 10:09:48PM +0200, Eric Farman wrote:
When starting a domain, we use the presence of a vfio-pci or
mdev hostdev to determine if the memlock maximum needs to be
increased. But if we hotplug either of these devices, only the
vfio-pci path gets that love. This means that attaching a, say,
vfio-ccw device will appear to succeed but the device may be
unusable as the guest may see I/O errors on long CCW chains.
The host, meanwhile, would be flooded with these messages:
vfio_pin_page_external: Task qemu-system-s39 (11584) RLIMIT_MEMLOCK (65536) exceeded
Let's adjust the maximum memlock value in the mdev hotplug path,
so that the domain has the same value as if it were started with
one or more mdev devices in its configuration.
(Note: I started trying to refactor qemuDomainAdjustMaxMemLockHostdev()
to address the "A better way to handle this would be nice" comment,
but the result was getting way too involved for the problem I was
trying to fix. Maybe another day.)
This paragraph doesn't belong into the commit message, I'll remove it
before pushing.
Otherwise looks good.
Reviewed-by: Pavel Hrdina <phrdina(a)redhat.com>