1. 21 12月, 2012 4 次提交
  2. 19 12月, 2012 2 次提交
  3. 29 11月, 2012 1 次提交
    • O
      node_memory: Do not fail if there is parameter unsupported · ebdbe25a
      Osier Yang 提交于
      It makes no sense to fail the whole getting command if there is
      a parameter unsupported by the kernel. This patch fixes it by
      omitting the unsupported parameter for getMemoryParameters.
      
      And for setMemoryParameters, this checks if there is an unsupported
      parameter up front of the setting, and just returns failure if not
      all parameters are supported.
      ebdbe25a
  4. 17 11月, 2012 2 次提交
    • E
      nodeinfo: port nodecpumap to RHEL5 · 9504ae5b
      Eric Blake 提交于
      Prior to this patch, 'virsh nodecpumap' on older kernels reported:
      error: Unable to get cpu map
      error: out of memory
      
      * src/nodeinfo.c (linuxParseCPUmax): Don't overwrite error.
      (nodeGetCPUBitmap): Provide backup implementation.
      9504ae5b
    • E
      nodeinfo: support kernels that lack socket information · 47976b48
      Eric Blake 提交于
      On RHEL 5, I was getting a segfault trying to start libvirtd,
      because we were failing virNodeParseSocket but not checking
      for errors, and then calling CPU_SET(-1, &sock_map) as a result.
      But if you don't have a topology/physical_package_id file,
      then you can just assume that the cpu belongs to socket 0.
      
      * src/nodeinfo.c (virNodeGetCpuValue): Change bool into
      default_value.
      (virNodeParseSocket): Allow for default value when file is missing,
      different from fatal error on reading file.
      (virNodeParseNode): Update call sites to fail on error.
      47976b48
  5. 15 11月, 2012 1 次提交
  6. 13 11月, 2012 1 次提交
    • P
      nodeinfo: Add check and workaround to guarantee valid cpu topologies · 9576afd1
      Peter Krempa 提交于
      Lately there were a few reports of the output of the virsh nodeinfo
      command being inaccurate. This patch tries to avoid that by checking if
      the topology actually makes sense. If it doesn't we then report a
      synthetic topology that indicates to the user that the host capabilities
      should be checked for the actual topology.
      9576afd1
  7. 02 11月, 2012 2 次提交
    • D
      Remove spurious whitespace between function name & open brackets · 1c04f999
      Daniel P. Berrange 提交于
      The libvirt coding standard is to use 'function(...args...)'
      instead of 'function (...args...)'. A non-trivial number of
      places did not follow this rule and are fixed in this patch.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      1c04f999
    • E
      cpumap: optimize for clients that don't need online count · 3d0130cb
      Eric Blake 提交于
      It turns out that calling virNodeGetCPUMap(conn, NULL, NULL, 0)
      is both useful, and with Viktor's patches, common enough to
      optimize.  Since this interface hasn't been released yet, we
      can change the RPC call.
      
      A bit more background on the optimization - learning the cpu count
      is a single file read (/sys/devices/system/cpu/possible), but
      learning the number of online cpus can possibly trigger a file
      read per cpu, depending on the age of the kernel, and all wasted
      if the caller passed NULL for both arguments.
      
      * src/nodeinfo.c (nodeGetCPUMap): Avoid bitmap when not needed.
      * src/remote/remote_protocol.x (remote_node_get_cpu_map_args):
      Supply two separate flags for needed arguments.
      * src/remote/remote_driver.c (remoteNodeGetCPUMap): Update
      caller.
      * daemon/remote.c (remoteDispatchNodeGetCPUMap): Likewise.
      * src/remote_protocol-structs: Regenerate.
      3d0130cb
  8. 30 10月, 2012 1 次提交
    • E
      build: place attributes in correct location · c047f547
      Eric Blake 提交于
      Ever since commit eefb881d, ATTRIBUTE_NONNULL has normally been a
      no-op under gcc (since it tends to cause more bugs than it cures
      given gcc's current lame implementation of the attribute).  However,
      the macro is still useful to Coverity and other static-analysis
      tools, but only if we use it correctly.  Coverity follows gcc's lead
      in accepting function declarations with attributes at the end, but
      function bodies must attach attributes to the return type.  That is,
      these are valid:
      
      void foo(void *arg) ATTRIBUTE_NONNULL(1);
      void ATTRIBUTE_NONNULL(1) foo(void *arg);
      void ATTRIBUTE_NONNULL(1) foo(void *arg) {}
      
      but this is not:
      
      void foo(void *arg) ATTRIBUTE_NONNULL(1) {}
      
      even though you don't get a compile failure until you do static
      analysis.  Bug introduced in commit 80533ca2, with these symptoms:
      
      nodeinfo.c:206: error: expected ',' or ';' before '{' token
      cc1: warning: unrecognized command line option "-Wno-suggest-attribute=const"
      cc1: warning: unrecognized command line option "-Wno-suggest-attribute=pure"
      make[3]: *** [libvirt_driver_la-nodeinfo.lo] Error 1
      
      * src/nodeinfo.c (virNodeParseNode): Fix syntax error when
      non-null attribute is in use.
      c047f547
  9. 27 10月, 2012 1 次提交
    • E
      cpustat: fix regression when cpus are offline · 4fbf322f
      Eric Blake 提交于
      It turns out that the cpuacct results properly account for offline
      cpus, and always returns results for every possible cpu, not just
      the online ones.  So there is no need to check the map of online
      cpus in the first place, merely only a need to know the maximum
      possible cpu.  Meanwhile, virNodeGetCPUBitmap had a subtle change
      from returning the maximum id to instead returning the width of
      the bitmap (one larger than the maximum id) in commit 2f4c5338,
      which made this code encounter some off-by-one logic leading to
      bad error messages when a cpu was offline:
      
      $ virsh cpu-stats dom
      error: Failed to virDomainGetCPUStats()
      
      error: An error occurred, but the cause is unknown
      
      Cleaning this up unraveled a chain of other unused variables.
      
      * src/qemu/qemu_driver.c (qemuDomainGetPercpuStats): Drop
      pointless check for cpumap changes, and use correct number of
      cpus.  Simplify signature.
      (qemuDomainGetCPUStats): Adjust caller.
      * src/nodeinfo.h (nodeGetCPUCount): New prototype.
      (nodeGetCPUBitmap): Drop unused parameter.
      * src/nodeinfo.c (nodeGetCPUBitmap): Likewise.
      (nodeGetCPUMap): Adjust caller.
      (nodeGetCPUCount): New function.
      * src/libvirt_private.syms (nodeinfo.h): Export it.
      4fbf322f
  10. 26 10月, 2012 2 次提交
    • V
      virNodeGetCPUMap: Implement support function in nodeinfo · d34439c9
      Viktor Mihajlovski 提交于
      Added an implemention of virNodeGetCPUMap to nodeinfo.c,
      (nodeGetCPUMap) which can be used by all drivers for a Linux
      hypervisor host.
      Signed-off-by: NViktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
      d34439c9
    • E
      nodeinfo: improve probing node cpu bitmap · 2f4c5338
      Eric Blake 提交于
      Callers should not need to know what the name of the file to
      be read in the Linux-specific version of nodeGetCPUmap;
      furthermore, qemu cares about online cpus, not present cpus,
      when determining which cpus to skip.
      
      While at it, I fixed the fact that we were computing the maximum
      online cpu id by doing a slow iteration, when what we really want
      to know is the max available cpu.
      
      * src/nodeinfo.h (nodeGetCPUmap): Rename...
      (nodeGetCPUBitmap): ...and simplify signature.
      * src/nodeinfo.c (linuxParseCPUmax): New function.
      (linuxParseCPUmap): Simplify and alter signature.
      (nodeGetCPUBitmap): Change implementation.
      * src/libvirt_private.syms (nodeinfo.h): Reflect rename.
      * src/qemu/qemu_driver.c (qemuDomainGetPercpuStats): Update
      caller.
      2f4c5338
  11. 15 10月, 2012 1 次提交
    • O
      node_memory: Add new parameter field to tune the new sysfs knob · f81f0f2f
      Osier Yang 提交于
      Upstream kernel introduced new sysfs knob "merge_across_nodes" to
      specify if pages from different numa nodes can be merged. When set
      to 0, only pages which physically reside in the memory area of
      same NUMA node can be merged. When set to 1, pages from all nodes
      can be merged.
      
      This patch supports the tuning by adding new param field
      "shm_merge_across_nodes".
      f81f0f2f
  12. 09 10月, 2012 1 次提交
  13. 28 9月, 2012 1 次提交
  14. 21 9月, 2012 1 次提交
  15. 19 9月, 2012 1 次提交
  16. 18 9月, 2012 2 次提交
  17. 17 9月, 2012 1 次提交
    • O
      node_memory: Implement the internal APIs · aaa8ab3e
      Osier Yang 提交于
      Only implemented for linux platform.
      
      * src/nodeinfo.h: (Declare node{Get,Set}MemoryParameters)
      * src/nodeinfo.c: (Implement node{Get,Set}MemoryParameters)
      * src/libvirt_private.syms: (Export those two new internal APIs to
        private symbols)
      aaa8ab3e
  18. 22 8月, 2012 1 次提交
    • E
      build: work with glibc that lacks CPU_COUNT · 0d03735f
      Eric Blake 提交于
      Building on RHEL 5 warned:
      
      nodeinfo.c: 305: warning: implicit declaration of function 'CPU_COUNT'
      
      This extension macro in <sched.h> was not added until later glibc.
      
      * src/nodeinfo.c (CPU_COUNT): Add fallback implementation.
      0d03735f
  19. 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
  20. 20 7月, 2012 1 次提交
  21. 19 7月, 2012 1 次提交
    • E
      nodeinfo: deal with offline cpus in a node · 03e0ec10
      Eric Blake 提交于
      Commit 80533ca2 forgot to think about offline cpus.  When a node
      cpu is offline, then its topology/ subdirectory is not present,
      leading to spurious error messages leaked to the user such as:
      
      libvir:  error : cannot open /home/dummy/libvirt/tests/nodeinfodata/linux-nodeinfo-sysfs-test-6/node/node0/cpu7/topology/physical_package_id: No such file or directory
      
      Fix that, as well as test it; the test data is gathered from a
      machine with one NUMA node, hyperthreading, and with 2 of the
      8 cpus offline.
      
      * src/nodeinfo.c (virNodeParseNode): Don't parse topology of
      offline cpus.
      * tests/nodeinfotest.c (mymain): Run new test.
      * tests/nodeinfodata/linux-nodeinfo-sysfs-test-6*: New data.
      03e0ec10
  22. 11 7月, 2012 1 次提交
    • P
      nodeinfo: Fix gathering of nodeinfo data structure · 80533ca2
      Peter Krempa 提交于
      This patch changes the way data to fill the nodeinfo structure are
      gathered. We've gathere the test data by iterating processors an sockets
      separately from nodes. The reported data was based solely on information
      about core id. Problems arise when eg cores in mulit-processor machines
      don't have same id's on both processors or maybe one physical processor
      contains more NUMA nodes.
      
      This patch changes the approach how we detect processors and nodes. Now
      we start at enumerating nodes and for each node processors, sockets and
      threads are enumerated separately. This approach provides acurate data
      that comply to docs about the nodeinfo structure. This also enables to
      get rid of hacks: see commits 10d9038b,
      ac9dd4a6. (Those changes in nodeinfo.c
      are efectively reverted by this patch).
      
      This patch also changes output of one of the tests, as the processor
      topology is now acquired more precisely.
      80533ca2
  23. 25 6月, 2012 2 次提交
  24. 28 5月, 2012 1 次提交
    • D
      Santize the reporting of VIR_ERR_INVALID_ERROR · d91f3ef4
      Daniel P. Berrange 提交于
      To ensure consistent error reporting of invalid arguments,
      provide a number of predefined helper methods & macros.
      
       - An arg which must not be NULL:
      
         virCheckNonNullArgReturn(argname, retvalue)
         virCheckNonNullArgGoto(argname, label)
      
       - An arg which must be NULL
      
         virCheckNullArgGoto(argname, label)
      
       - An arg which must be positive (ie 1 or greater)
      
         virCheckPositiveArgGoto(argname, label)
      
       - An arg which must not be 0
      
         virCheckNonZeroArgGoto(argname, label)
      
       - An arg which must be zero
      
         virCheckZeroArgGoto(argname, label)
      
       - An arg which must not be negative (ie 0 or greater)
      
         virCheckNonNegativeArgGoto(argname, label)
      
      * src/libvirt.c, src/libvirt-qemu.c,
        src/nodeinfo.c, src/datatypes.c: Update to use
        virCheckXXXX macros
      * po/POTFILES.in: Add libvirt-qemu.c and virterror_internal.h
      * src/internal.h: Define macros for checking invalid args
      * src/util/virterror_internal.h: Define macros for reporting
        invalid args
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      d91f3ef4
  25. 15 5月, 2012 3 次提交
    • O
      nodeinfo: Get the correct CPU number on AMD Magny Cours platform · 10d9038b
      Osier Yang 提交于
      "Instead of developing one CPU with 12 cores, the Magny Cours is
      actually two 6 core “Bulldozer” CPUs combined in to one package"
      
      I.e, each package has two NUMA nodes, and the two numa nodes share
      the same core ID set (0-6), which means parsing the cores number
      from sysfs doesn't work in this case.
      
      And the wrong CPU number could cause three problems for libvirt:
      
      1) performance lost
      
        A domain without "cpuset" or "placement='auto'" (to drive numad)
      specified will be only pinned to part of the CPUs.
      
      2) domain can be started
      
        If a domain uses numad, and the advisory nodeset returned from
      numad contains node which exceeds the range of wrong total CPU
      number. The domain will fail to start, as the bitmask passed to
      sched_setaffinity could be fully filled with zero.
      
      3) wrong CPU number affects lots of stuffs.
      
        E.g. for command "virsh vcpuinfo", "virsh vcpupin", it will always
      output with the truncated CPU list.
      
      For more details:
      
      https://www.redhat.com/archives/libvir-list/2012-May/msg00607.html
      
      This patch is to fix the problem by parsing /proc/cpuinfo to get
      the value of field "cpu cores", and use it as nodeinfo->cores if
      it's greater than the cores number from sysfs.
      10d9038b
    • E
      nodeinfo: avoid probing host filesystem during test · 2b366b46
      Eric Blake 提交于
      We had previously weakened our nodeinfotest in order to ignore parsed
      node values, because the parse function was mistakenly relying on
      host files.  A better fix is to avoid using the numactl library, but
      to instead parse the same files that numactl would read, all while
      allowing the files to be relative to our choice of directory.
      
      * src/nodeinfo.c (CPU_SYS_PATH, NODE_SYS_PATH): Replace with...
      (SYSFS_SYSTEM_PATH): ...parent directory.
      (linuxNodeInfoCPUPopulate): Check NUMA nodes from requested
      directory (by inlining numactl code).
      (nodeGetCPUmap, nodeGetMemoryStats): Adjust macro use.
      * tests/nodeinfotest.c (linuxTestCompareFiles, linuxTestNodeInfo):
      Update test to match.
      2b366b46
    • E
      nodeinfo: drop static variable · 88f12a36
      Eric Blake 提交于
      We were wasting time to malloc a copy of a constant string, then
      copy it into static storage, for every call to nodeGetInfo.  At
      least we were lucky that it was a constant source, and thus not
      subject to even worse issues with one thread clobbering the static
      storage while another was using it.  This gets rid of the waste,
      by passing the string through the stack instead, as well as renaming
      internal functions to better match our conventions.
      
      * src/nodeinfo.c (sysfs_path): Delete.
      (get_cpu_value, count_thread_siblings, parse_socket): Add
      parameter, and rename...
      (virNodeGetCpuValue, virNodeCountThreadSiblings)
      (virNodeParseSocket): ... into a common namespace.
      (cpu_online, parse_core): Inline into callers.
      (linuxNodeInfoCPUPopulate): Update caller.
      (nodeGetInfo): Drop a useless malloc.
      88f12a36
  26. 04 5月, 2012 1 次提交
    • O
      Coverity: Fix resource leak in nodeinfo.c · 739cfc31
      Osier Yang 提交于
      Error: RESOURCE_LEAK:
      /builddir/build/BUILD/libvirt-0.9.10/src/nodeinfo.c:629: alloc_fn: Calling allocation function "fopen".
      /builddir/build/BUILD/libvirt-0.9.10/src/nodeinfo.c:629: var_assign: Assigning: "cpuinfo" =  storage returned from "fopen("/proc/cpuinfo", "r")".
      /builddir/build/BUILD/libvirt-0.9.10/src/nodeinfo.c:638: leaked_storage: Variable "cpuinfo" going out of scope leaks the storage it points to.
      739cfc31
  27. 24 4月, 2012 1 次提交
  28. 10 4月, 2012 1 次提交
    • E
      build: avoid s390 compiler warnings · 9011a494
      Eric Blake 提交于
      I noticed these compiler warnings when building for the s390 architecture.
      
      * src/node_device/node_device_udev.c (udevDeviceMonitorStartup):
      Mark unused variable.
      * src/nodeinfo.c (linuxNodeInfoCPUPopulate): Avoid unused variable.
      9011a494
  29. 30 3月, 2012 1 次提交