Re: [PATCH v2 1/3] qemu: Extract logic to determine the mlock limit size for VFIO

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

 



On Mon, Nov 09, 2015 at 01:09:59PM -0500, John Ferlan wrote:
> 
> 
> On 11/09/2015 07:50 AM, Peter Krempa wrote:
> > New function qemuDomainGetMlockLimitBytes will now handle the
> > calculation so that it unifies the logic to one place and allows later
> > reuse.
> > ---
> >  src/qemu/qemu_command.c | 18 ++----------------
> >  src/qemu/qemu_domain.c  | 27 +++++++++++++++++++++++++++
> >  src/qemu/qemu_domain.h  |  2 ++
> >  src/qemu/qemu_hotplug.c | 17 ++---------------
> >  4 files changed, 33 insertions(+), 31 deletions(-)
> > 
> > diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
> > index 8824541..9acf8e4 100644
> > --- a/src/qemu/qemu_command.c
> > +++ b/src/qemu/qemu_command.c
> > @@ -11447,22 +11447,8 @@ qemuBuildCommandLine(virConnectPtr conn,
> >              goto error;
> >      }
> > 
> > -    if (mlock) {
> > -        unsigned long long memKB;
> > -
> > -        /* VFIO requires all of the guest's memory to be
> > -         * locked resident, plus some amount for IO
> > -         * space. Alex Williamson suggested adding 1GiB for IO
> > -         * space just to be safe (some finer tuning might be
> > -         * nice, though).
> > -         */
> > -        if (virMemoryLimitIsSet(def->mem.hard_limit))
> > -            memKB = def->mem.hard_limit;
> > -        else
> > -            memKB = virDomainDefGetMemoryActual(def) + 1024 * 1024;
> > -
> > -        virCommandSetMaxMemLock(cmd, memKB * 1024);
> > -    }
> > +    if (mlock)
> > +        virCommandSetMaxMemLock(cmd, qemuDomainGetMlockLimitBytes(def));
> > 
> >      if (virQEMUCapsGet(qemuCaps, QEMU_CAPS_MSG_TIMESTAMP) &&
> >          cfg->logTimestamp)
> > diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
> > index 890d8ed..a06624e 100644
> > --- a/src/qemu/qemu_domain.c
> > +++ b/src/qemu/qemu_domain.c
> > @@ -3616,3 +3616,30 @@ qemuDomainUpdateCurrentMemorySize(virQEMUDriverPtr driver,
> > 
> >      return 0;
> >  }
> > +
> > +
> > +/**
> > + * qemuDomainGetMlockLimitBytes:
> > + *
> > + * @def: domain definition
> > + *
> > + * Returns the size of the memory in bytes that needs to be set as
> > + * RLIMIT_MEMLOCK for purpose of VFIO device passthrough. In cases where
> > + * mem.hard_limit is set, the value is preferred,otherwise the value may depend
> > + * on the device or architecture.
> 
> 
> How about?
> 
> Returns the size of memory in bytes to allow a process (domain) to be
> locked into RAM (e.g setrlimit RLIMIT_MEMLOCK).

While this sentence is inaccurate,

> If a mem.hard_limit is
> set, then that value is preferred; otherwise, the value returned may
> depend upon the architecture or devices present, such as a VFIO
> passthrough device.
> 

this one looks better than the original and it has proper spacing after
the comma.

ACK with the second sentence used.

Jan

Attachment: signature.asc
Description: Digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]