1. 17 7月, 2014 1 次提交
    • M
      qemu: leave restricting cpuset.mems after initialization · 7e72ac78
      Martin Kletzander 提交于
      When domain is started with numatune memory mode strict and the
      nodeset does not include host NUMA node with DMA and DMA32 zones, KVM
      initialization fails.  This is because cgroup restrict even kernel
      allocations.  We are already doing numa_set_membind() which does the
      same thing, only it does not restrict kernel allocations.
      
      This patch leaves the userspace numa_set_membind() in place and moves
      the cpuset.mems setting after the point where monitor comes up, but
      before vcpu and emulator sub-groups are created.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      7e72ac78
  2. 09 7月, 2014 1 次提交
  3. 24 7月, 2013 1 次提交
  4. 30 4月, 2013 2 次提交
    • L
      qemu: put usb cgroup setup in common function · 811143c0
      Laine Stump 提交于
      The USB-specific cgroup setup had been inserted inline in
      qemuDomainAttachHostUsbDevice and qemuSetupCgroup, but now there is a
      common cgroup setup function called for all hostdevs, so it makes sens
      to put the usb-specific setup there and just rely on that function
      being called.
      
      The one thing I'm uncertain of here (and a reason for not pushing
      until after release) is that previously hostdev->missing was checked
      only when starting a domain (and cgroup setup for the device skipped
      if missing was true), but with this consolidation, it is now checked
      in the case of hotplug as well. I don't know if this will have any
      practical effect (does it make sense to hotplug a "missing" usb
      device?)
      811143c0
    • L
      qemu: add vfio devices to cgroup ACL when appropriate · 6e13860c
      Laine Stump 提交于
      PCIO device assignment using VFIO requires read/write access by the
      qemu process to /dev/vfio/vfio, and /dev/vfio/nn, where "nn" is the
      VFIO group number that the assigned device belongs to (and can be
      found with the function virPCIDeviceGetVFIOGroupDev)
      
      /dev/vfio/vfio can be accessible to any guest without danger
      (according to vfio developers), so it is added to the static ACL.
      
      The group device must be dynamically added to the cgroup ACL for each
      vfio hostdev in two places:
      
      1) for any devices in the persistent config when the domain is started
         (done during qemuSetupCgroup())
      
      2) at device attach time for any hotplug devices (done in
         qemuDomainAttachHostDevice)
      
      The group device must be removed from the ACL when a device it
      "hot-unplugged" (in qemuDomainDetachHostDevice())
      
      Note that USB devices are already doing their own cgroup setup and
      teardown in the hostdev-usb specific function. I chose to make the new
      functions generic and call them in a common location though. We can
      then move the USB-specific code (which is duplicated in two locations)
      to this single location. I'll be posting a followup patch to do that.
      6e13860c
  5. 16 4月, 2013 2 次提交
    • D
      Change default cgroup layout for QEMU/LXC and honour XML config · db44eb1b
      Daniel P. Berrange 提交于
      Historically QEMU/LXC guests have been placed in a cgroup layout
      that is
      
         $LOCATION-OF-LIBVIRTD/libvirt/{qemu,lxc}/$VMNAME
      
      This is bad for a number of reasons
      
       - The cgroup hierarchy gets very deep which seriously
         impacts kernel performance due to cgroups scalability
         limitations.
      
       - It is hard to setup cgroup policies which apply across
         services and virtual machines, since all VMs are underneath
         the libvirtd service.
      
      To address this the default cgroup location is changed to
      be
      
          /system/$VMNAME.{lxc,qemu}.libvirt
      
      This puts virtual machines at the same level in the hierarchy
      as system services, allowing consistent policy to be setup
      across all of them.
      
      This also honours the new resource partition location from the
      XML configuration, for example
      
        <resource>
          <partition>/virtualmachines/production</partitions>
        </resource>
      
      will result in the VM being placed at
      
          /virtualmachines/production/$VMNAME.{lxc,qemu}.libvirt
      
      NB, with the exception of the default, /system, path which
      is intended to always exist, libvirt will not attempt to
      auto-create the partitions in the XML. It is the responsibility
      of the admin/app to configure the partitions. Later libvirt
      APIs will provide a way todo this.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      db44eb1b
    • D
      Store a virCgroupPtr instance in qemuDomainObjPrivatePtr · 632f78ca
      Daniel P. Berrange 提交于
      Instead of calling virCgroupForDomain every time we need
      the virCgrouPtr instance, just do it once at Vm startup
      and cache a reference to the object in qemuDomainObjPrivatePtr
      until shutdown of the VM. Removing the virCgroupPtr from
      the QEMU driver state also means we don't have stale mount
      info, if someone mounts the cgroups filesystem after libvirtd
      has been started
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      632f78ca
  6. 06 2月, 2013 1 次提交
  7. 21 12月, 2012 1 次提交
  8. 29 11月, 2012 1 次提交
  9. 24 10月, 2012 1 次提交
    • O
      qemu: Keep the affinity when creating cgroup for emulator thread · bb81021b
      Osier Yang 提交于
      When the cpu placement model is "auto", it sets the affinity for
      domain process with the advisory nodeset from numad, however,
      creating cgroup for the domain process (called emulator thread
      in some contexts) later overrides that with pinning it to all
      available pCPUs.
      
      How to reproduce:
      
        * Configure the domain with "auto" placement for <vcpu>, e.g.
          <vcpu placement='auto'>4</vcpu>
        * % virsh start dom
        * % cat /proc/$dompid/status
      
      Though the emulator cgroup cause conflicts, but we can't simply
      prohibit creating it, as other tunables are still useful, such
      as "emulator_period", which is used by API
      virDomainSetSchedulerParameter. So this patch doesn't prohibit
      creating the emulator cgroup, but inherit the nodeset from numad,
      and reset the affinity for domain process.
      
      * src/qemu/qemu_cgroup.h: Modify definition of qemuSetupCgroupForEmulator
                                to accept the passed nodenet
      * src/qemu/qemu_cgroup.c: Set the affinity with the passed nodeset
      bb81021b
  10. 20 10月, 2012 1 次提交
    • E
      blockjob: remove unused parameters after previous patch · 67aea3fb
      Eric Blake 提交于
      Minor cleanup made possible by previous simplifications.
      
      * src/qemu/qemu_cgroup.h (qemuSetupDiskCgroup)
      (qemuTeardownDiskCgroup): Alter signature.
      * src/qemu/qemu_cgroup.c (qemuSetupDiskCgroup)
      (qemuTeardownDiskCgroup, qemuSetupCgroup): Update all uses.
      * src/qemu/qemu_hotplug.c (qemuDomainDetachPciDiskDevice)
      (qemuDomainDetachDiskDevice): Likewise.
      * src/qemu/qemu_driver.c (qemuDomainAttachDeviceDiskLive)
      (qemuDomainChangeDiskMediaLive)
      (qemuDomainSnapshotCreateSingleDiskActive)
      (qemuDomainSnapshotUndoSingleDiskActive): Likewise.
      67aea3fb
  11. 17 10月, 2012 1 次提交
    • M
      qemu: Pin the emulator when only cpuset is specified · ba63d8f7
      Martin Kletzander 提交于
      According to our recent changes (clarifications), we should be pinning
      qemu's emulator processes using the <vcpu> 'cpuset' attribute in case
      there is no <emulatorpin> specified.  This however doesn't work
      entirely as expected and this patch should resolve all the remaining
      issues.
      ba63d8f7
  12. 21 9月, 2012 1 次提交
  13. 18 9月, 2012 1 次提交
  14. 22 8月, 2012 3 次提交
  15. 23 7月, 2012 1 次提交
    • O
      Desert the FSF address in copyright · f9ce7dad
      Osier Yang 提交于
      Per the FSF address could be changed from time to time, and GNU
      recommends the following now: (http://www.gnu.org/licenses/gpl-howto.html)
      
        You should have received a copy of the GNU General Public License
        along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
      
      This patch removes the explicit FSF address, and uses above instead
      (of course, with inserting 'Lesser' before 'General').
      
      Except a bunch of files for security driver, all others are changed
      automatically, the copyright for securify files are not complete,
      that's why to do it manually:
      
        src/security/security_selinux.h
        src/security/security_driver.h
        src/security/security_selinux.c
        src/security/security_apparmor.h
        src/security/security_apparmor.c
        src/security/security_driver.c
      f9ce7dad
  16. 15 5月, 2012 1 次提交
  17. 21 7月, 2011 1 次提交
  18. 04 5月, 2011 1 次提交
    • E
      qemu: update qemuCgroupControllerActive signature · 29e131de
      Eric Blake 提交于
      Clang warned about a dead assignment.  In the process, I noticed
      that we are only using the function for a bool value.  I audited
      all other callers in qemu_{migration,cgroup,driver,hotplug), and
      all were making the call in a bool context.
      
      Also, do bounds checking on the argument.
      
      * src/qemu/qemu_cgroup.c (qemuSetupCgroup): Delete dead
      assignment.
      (qemuCgroupControllerActive): Change return type to bool.
      * src/qemu/qemu_cgroup.h (qemuCgroupControllerActive): Likewise.
      29e131de
  19. 25 2月, 2011 1 次提交
    • E
      audit: prepare qemu for listing vm in cgroup audits · b4d3434f
      Eric Blake 提交于
      * src/qemu/qemu_cgroup.h (struct qemuCgroupData): New helper type.
      (qemuSetupDiskPathAllow, qemuSetupChardevCgroup)
      (qemuTeardownDiskPathDeny): Drop unneeded prototypes.
      (qemuSetupDiskCgroup, qemuTeardownDiskCgroup): Adjust prototype.
      * src/qemu/qemu_cgroup.c
      (qemuSetupDiskPathAllow, qemuSetupChardevCgroup)
      (qemuTeardownDiskPathDeny): Mark static and use new type.
      (qemuSetupHostUsbDeviceCgroup): Use new type.
      (qemuSetupDiskCgroup): Alter signature.
      (qemuSetupCgroup): Adjust caller.
      * src/qemu/qemu_hotplug.c (qemuDomainAttachHostUsbDevice)
      (qemuDomainDetachPciDiskDevice, qemuDomainDetachSCSIDiskDevice):
      Likewise.
      * src/qemu/qemu_driver.c (qemudDomainAttachDevice)
      (qemuDomainUpdateDeviceFlags): Likewise.
      b4d3434f
  20. 17 12月, 2010 1 次提交
    • D
      Move QEMU cgroup helper code out of the QEMU driver · 52271cfc
      Daniel P. Berrange 提交于
      The QEMU driver file is far too large. Move all the cgroup
      helper code out into a separate file. No functional change.
      
      * src/qemu/qemu_cgroup.c, src/qemu/qemu_cgroup.h,
        src/Makefile.am: Add cgroup helper file
      * src/qemu/qemu_driver.c: Delete cgroup code
      52271cfc