[libvirt] [PATCH v4 11/14] qemu: Bump the memory locking limit for mdevs as well

Erik Skultety eskultet at redhat.com
Wed Mar 29 08:47:33 UTC 2017


On Wed, Mar 29, 2017 at 10:41:52AM +0200, Andrea Bolognani wrote:
> On Wed, 2017-03-22 at 16:27 +0100, Erik Skultety wrote:
> > Since mdevs are just another type of VFIO devices, we should increase
> > the memory locking limit the same way we do for VFIO PCI devices.
> >
> > Signed-off-by: Erik Skultety <eskultet at redhat.com>
> > ---
> >  src/qemu/qemu_domain.c | 9 +++++----
> >  1 file changed, 5 insertions(+), 4 deletions(-)
> >
> > diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
> > index d1ac1d641b..04e64b47ea 100644
> > --- a/src/qemu/qemu_domain.c
> > +++ b/src/qemu/qemu_domain.c
> > @@ -6347,11 +6347,12 @@ qemuDomainRequiresMemLock(virDomainDefPtr def)
> >          return true;
> >
> >      for (i = 0; i < def->nhostdevs; i++) {
> > -        virDomainHostdevDefPtr dev = def->hostdevs[i];
> > +        virDomainHostdevSubsysPtr subsys = &def->hostdevs[i]->source.subsys;
> >
> > -        if (dev->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
> > -            dev->source.subsys.type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI &&
> > -            dev->source.subsys.u.pci.backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO)
> > +        if (def->hostdevs[i]->mode == VIR_DOMAIN_HOSTDEV_MODE_SUBSYS &&
> > +            (subsys->type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV ||
> > +             (subsys->type == VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI &&
> > +              subsys->u.pci.backend == VIR_DOMAIN_HOSTDEV_PCI_BACKEND_VFIO)))
> >              return true;
> >      }
>
> Now that we have test suite coverage for the calculation of
> memory locking limits (qemumemlocktest), it would be neat
> if you could add test cases for mdevs as well.

I'll look into that, thanks for raising this up.

>
> Maybe the comment above the loop (which has been moved to
> the qemuDomainGetMemLockLimitBytes() function now) could be
> updated to mention mdev-specific information, if any?
>

None that I'm aware of at the moment, but I'll discuss this with Alex just to be
sure.

Erik

> --
> Andrea Bolognani / Red Hat / Virtualization




More information about the libvir-list mailing list