diff --git a/src/Makefile.am b/src/Makefile.am index a40e63fe65..982f63d84d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -252,7 +252,8 @@ DOMAIN_CONF_SOURCES = \ conf/domain_conf.c conf/domain_conf.h \ conf/domain_audit.c conf/domain_audit.h \ conf/domain_nwfilter.c conf/domain_nwfilter.h \ - conf/snapshot_conf.c conf/snapshot_conf.h + conf/snapshot_conf.c conf/snapshot_conf.h \ + conf/numatune_conf.c conf/numatune_conf.h OBJECT_EVENT_SOURCES = \ conf/object_event.c conf/object_event.h \ diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 037db424b6..f0f762cb1e 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -36,6 +36,7 @@ # include "virhash.h" # include "virsocketaddr.h" # include "nwfilter_params.h" +# include "numatune_conf.h" # include "virnetdevmacvlan.h" # include "virsysinfo.h" # include "virnetdevvportprofile.h" @@ -46,7 +47,6 @@ # include "device_conf.h" # include "virbitmap.h" # include "virstoragefile.h" -# include "virnuma.h" # include "virseclabel.h" /* forward declarations of all device types, required by diff --git a/src/conf/numatune_conf.c b/src/conf/numatune_conf.c new file mode 100644 index 0000000000..e9be040a49 --- /dev/null +++ b/src/conf/numatune_conf.c @@ -0,0 +1,37 @@ +/* + * numatune_conf.c + * + * Copyright (C) 2014 Red Hat, Inc. + * + * 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 + * . + * + * Author: Martin Kletzander + */ + +#include + +#include "numatune_conf.h" + +VIR_ENUM_IMPL(virDomainNumatuneMemMode, + VIR_DOMAIN_NUMATUNE_MEM_LAST, + "strict", + "preferred", + "interleave"); + +VIR_ENUM_IMPL(virNumaTuneMemPlacementMode, + VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_LAST, + "default", + "static", + "auto"); diff --git a/src/conf/numatune_conf.h b/src/conf/numatune_conf.h new file mode 100644 index 0000000000..6bdfdc085d --- /dev/null +++ b/src/conf/numatune_conf.h @@ -0,0 +1,54 @@ +/* + * numatune_conf.h + * + * Copyright (C) 2014 Red Hat, Inc. + * + * 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 + * . + * + * Author: Martin Kletzander + */ + +#ifndef __NUMATUNE_CONF_H__ +# define __NUMATUNE_CONF_H__ + +# include "internal.h" +# include "virutil.h" +# include "virbitmap.h" + +typedef enum { + VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_DEFAULT = 0, + VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_STATIC, + VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_AUTO, + + VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_LAST +} virDomainNumaTuneMemPlacementMode; + +VIR_ENUM_DECL(virNumaTuneMemPlacementMode) + +VIR_ENUM_DECL(virDomainNumatuneMemMode) + +typedef struct _virNumaTuneDef virNumaTuneDef; +typedef virNumaTuneDef *virNumaTuneDefPtr; +struct _virNumaTuneDef { + struct { + virBitmapPtr nodemask; + int mode; /* enum virDomainNumatuneMemMode */ + int placement_mode; /* enum virNumaTuneMemPlacementMode */ + } memory; /* pinning for all the memory */ + + /* Future NUMA tuning related stuff should go here. */ +}; + +#endif /* __NUMATUNE_CONF_H__ */ diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index a184268bc6..7e0f90ba45 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -606,6 +606,13 @@ virNodeDeviceObjRemove; virNodeDeviceObjUnlock; +# conf/numatune_conf.h +virDomainNumatuneMemModeTypeFromString; +virDomainNumatuneMemModeTypeToString; +virNumaTuneMemPlacementModeTypeFromString; +virNumaTuneMemPlacementModeTypeToString; + + # conf/nwfilter_conf.h virNWFilterCallbackDriversLock; virNWFilterCallbackDriversUnlock; @@ -1680,8 +1687,6 @@ virNodeSuspendGetTargetMask; # util/virnuma.h -virDomainNumatuneMemModeTypeFromString; -virDomainNumatuneMemModeTypeToString; virNumaGetAutoPlacementAdvice; virNumaGetDistances; virNumaGetMaxNode; @@ -1691,8 +1696,7 @@ virNumaGetPages; virNumaIsAvailable; virNumaNodeIsAvailable; virNumaSetupMemoryPolicy; -virNumaTuneMemPlacementModeTypeFromString; -virNumaTuneMemPlacementModeTypeToString; + # util/virobject.h virClassForObject; diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 8271e28141..c5fef53249 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -37,6 +37,7 @@ #include "vircommand.h" #include "virbitmap.h" #include "virnodesuspend.h" +#include "virnuma.h" #include "qemu_monitor.h" #include "virstring.h" #include "qemu_hostdev.h" diff --git a/src/util/virnuma.c b/src/util/virnuma.c index 207b8043f5..de3f86a0c0 100644 --- a/src/util/virnuma.c +++ b/src/util/virnuma.c @@ -1,7 +1,7 @@ /* * virnuma.c: helper APIs for managing numa * - * Copyright (C) 2011-2013 Red Hat, Inc. + * Copyright (C) 2011-2014 Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -51,17 +51,6 @@ VIR_LOG_INIT("util.numa"); -VIR_ENUM_IMPL(virDomainNumatuneMemMode, - VIR_DOMAIN_NUMATUNE_MEM_LAST, - "strict", - "preferred", - "interleave"); - -VIR_ENUM_IMPL(virNumaTuneMemPlacementMode, - VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_LAST, - "default", - "static", - "auto"); #if HAVE_NUMAD char * diff --git a/src/util/virnuma.h b/src/util/virnuma.h index fbeb7a9559..21e8125e45 100644 --- a/src/util/virnuma.h +++ b/src/util/virnuma.h @@ -1,7 +1,7 @@ /* * virnuma.h: helper APIs for managing numa * - * Copyright (C) 2011-2013 Red Hat, Inc. + * Copyright (C) 2011-2014 Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -23,32 +23,10 @@ # define __VIR_NUMA_H__ # include "internal.h" +# include "numatune_conf.h" # include "virbitmap.h" # include "virutil.h" -typedef enum { - VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_DEFAULT = 0, - VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_STATIC, - VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_AUTO, - - VIR_NUMA_TUNE_MEM_PLACEMENT_MODE_LAST -} virNumaTuneMemPlacementMode; - -VIR_ENUM_DECL(virNumaTuneMemPlacementMode) - -VIR_ENUM_DECL(virDomainNumatuneMemMode) - -typedef struct _virNumaTuneDef virNumaTuneDef; -typedef virNumaTuneDef *virNumaTuneDefPtr; -struct _virNumaTuneDef { - struct { - virBitmapPtr nodemask; - int mode; - int placement_mode; /* enum virNumaTuneMemPlacementMode */ - } memory; - - /* Future NUMA tuning related stuff should go here. */ -}; char *virNumaGetAutoPlacementAdvice(unsigned short vcups, unsigned long long balloon);