libvirt/src/nodeinfo.h

78 lines
2.8 KiB
C
Raw Normal View History

2007-07-25 23:16:30 +00:00
/*
* nodeinfo.h: Helper routines for OS specific node information
2007-07-25 23:16:30 +00:00
*
* Copyright (C) 2006-2008, 2011-2012 Red Hat, Inc.
2007-07-25 23:16:30 +00:00
* Copyright (C) 2006 Daniel P. Berrange
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
2007-07-25 23:16:30 +00:00
*
* Author: Daniel P. Berrange <berrange@redhat.com>
*/
#ifndef __VIR_NODEINFO_H__
# define __VIR_NODEINFO_H__
2007-07-25 23:16:30 +00:00
# include "capabilities.h"
2007-07-25 23:16:30 +00:00
int nodeGetInfo(const char *sysfs_prefix, virNodeInfoPtr nodeinfo);
int nodeCapsInitNUMA(const char *sysfs_prefix, virCapsPtr caps);
2009-06-03 13:28:02 +00:00
int nodeGetCPUStats(int cpuNum,
virNodeCPUStatsPtr params,
int *nparams,
unsigned int flags);
int nodeGetMemoryStats(const char *sysfs_prefix,
int cellNum,
virNodeMemoryStatsPtr params,
int *nparams,
unsigned int flags);
int nodeGetCellsFreeMemory(unsigned long long *freeMems,
2009-06-03 13:28:02 +00:00
int startCell,
int maxCells);
int nodeGetMemory(unsigned long long *mem,
unsigned long long *freeMem);
2007-07-25 23:16:30 +00:00
virBitmapPtr nodeGetPresentCPUBitmap(const char *sysfs_prefix);
virBitmapPtr nodeGetOnlineCPUBitmap(const char *sysfs_prefix);
int nodeGetCPUCount(const char *sysfs_prefix);
nodeinfo: Fix output on PPC64 KVM hosts The nodeinfo is reporting incorrect number of cpus and incorrect host topology on PPC64 KVM hosts. The KVM hypervisor on PPC64 needs only the primary thread in a core to be online, and the secondaries offlined. While scheduling a guest in, the kvm scheduler wakes up the secondaries to run in guest context. The host scheduling of the guests happen at the core level(as only primary thread is online). The kvm scheduler exploits as many threads of the core as needed by guest. Further, starting POWER8, the processor allows splitting a physical core into multiple subcores with 2 or 4 threads each. Again, only the primary thread in a subcore is online in the host. The KVM-PPC scheduler allows guests to exploit all the offline threads in the subcore, by bringing them online when needed. (Kernel patches on split-core http://www.spinics.net/lists/kvm-ppc/msg09121.html) Recently with dynamic micro-threading changes in ppc-kvm, makes sure to utilize all the offline cpus across guests, and across guests with different cpu topologies. (https://www.mail-archive.com/kvm@vger.kernel.org/msg115978.html) Since the offline cpus are brought online in the guest context, it is safe to count them as online. Nodeinfo today discounts these offline cpus from cpu count/topology calclulation, and the nodeinfo output is not of any help and the host appears overcommited when it is actually not. The patch carefully counts those offline threads whose primary threads are online. The host topology displayed by the nodeinfo is also fixed when the host is in valid kvm state. Signed-off-by: Shivaprasad G Bhat <sbhat@linux.vnet.ibm.com> Signed-off-by: Andrea Bolognani <abologna@redhat.com>
2015-07-30 09:37:04 +00:00
int nodeGetThreadsPerSubcore(virArch arch);
int nodeGetMemoryParameters(virTypedParameterPtr params,
int *nparams,
unsigned int flags);
int nodeSetMemoryParameters(virTypedParameterPtr params,
int nparams,
unsigned int flags);
int nodeGetCPUMap(const char *sysfs_prefix,
unsigned char **cpumap,
unsigned int *online,
unsigned int flags);
int nodeGetFreePages(unsigned int npages,
unsigned int *pages,
int startCell,
unsigned int cellCount,
unsigned long long *counts);
int nodeAllocPages(unsigned int npages,
unsigned int *pageSizes,
unsigned long long *pageCounts,
int startCell,
unsigned int cellCount,
bool add);
2007-07-25 23:16:30 +00:00
#endif /* __VIR_NODEINFO_H__*/