numa_conf.h 5.0 KB
Newer Older
1
/*
2
 * numa_conf.h
3
 *
4
 * Copyright (C) 2014-2015 Red Hat, Inc.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
 *
 * 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/>.
 *
 * Author: Martin Kletzander <mkletzan@redhat.com>
 */

23 24
#ifndef __NUMA_CONF_H__
# define __NUMA_CONF_H__
25

26 27
# include <libxml/xpath.h>

28 29 30
# include "internal.h"
# include "virutil.h"
# include "virbitmap.h"
31 32 33
# include "virbuffer.h"


34 35
typedef struct _virDomainNuma virDomainNuma;
typedef virDomainNuma *virDomainNumaPtr;
36 37

typedef enum {
38 39 40
    VIR_DOMAIN_NUMATUNE_PLACEMENT_DEFAULT = 0,
    VIR_DOMAIN_NUMATUNE_PLACEMENT_STATIC,
    VIR_DOMAIN_NUMATUNE_PLACEMENT_AUTO,
41

42 43
    VIR_DOMAIN_NUMATUNE_PLACEMENT_LAST
} virDomainNumatunePlacement;
44

45
VIR_ENUM_DECL(virDomainNumatunePlacement)
46 47
VIR_ENUM_DECL(virDomainNumatuneMemMode)

48 49 50 51 52 53 54 55 56
typedef enum {
    VIR_NUMA_MEM_ACCESS_DEFAULT,
    VIR_NUMA_MEM_ACCESS_SHARED,
    VIR_NUMA_MEM_ACCESS_PRIVATE,

    VIR_NUMA_MEM_ACCESS_LAST
} virNumaMemAccess;

VIR_ENUM_DECL(virNumaMemAccess)
57

58
virDomainNumaPtr virDomainNumaNew(void);
59
void virDomainNumaFree(virDomainNumaPtr numa);
60 61 62 63

/*
 * XML Parse/Format functions
 */
64
int virDomainNumatuneParseXML(virDomainNumaPtr numa,
65 66
                              bool placement_static,
                              xmlXPathContextPtr ctxt)
67
    ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3);
68

69
int virDomainNumatuneFormatXML(virBufferPtr buf, virDomainNumaPtr numatune)
70 71 72 73 74
    ATTRIBUTE_NONNULL(1);

/*
 * Getters
 */
75 76 77
int virDomainNumatuneGetMode(virDomainNumaPtr numatune,
                             int cellid,
                             virDomainNumatuneMemMode *mode);
78

79
virBitmapPtr virDomainNumatuneGetNodeset(virDomainNumaPtr numatune,
80 81
                                         virBitmapPtr auto_nodeset,
                                         int cellid);
82

83
int virDomainNumatuneMaybeGetNodeset(virDomainNumaPtr numatune,
84 85 86 87
                                     virBitmapPtr auto_nodeset,
                                     virBitmapPtr *retNodeset,
                                     int cellid);

88
size_t virDomainNumaGetNodeCount(virDomainNumaPtr numa)
89
    ATTRIBUTE_NONNULL(1);
90
virBitmapPtr virDomainNumaGetNodeCpumask(virDomainNumaPtr numa,
91 92
                                         size_t node)
    ATTRIBUTE_NONNULL(1);
93
virNumaMemAccess virDomainNumaGetNodeMemoryAccessMode(virDomainNumaPtr numa,
94 95
                                                      size_t node)
    ATTRIBUTE_NONNULL(1);
96
unsigned long long virDomainNumaGetNodeMemorySize(virDomainNumaPtr numa,
97 98
                                                  size_t node)
    ATTRIBUTE_NONNULL(1);
99 100
unsigned long long virDomainNumaGetMemorySize(virDomainNumaPtr numa)
    ATTRIBUTE_NONNULL(1);
101

102 103 104
/*
 * Formatters
 */
105
char *virDomainNumatuneFormatNodeset(virDomainNumaPtr numatune,
106 107
                                     virBitmapPtr auto_nodeset,
                                     int cellid);
108

109
int virDomainNumatuneMaybeFormatNodeset(virDomainNumaPtr numatune,
110
                                        virBitmapPtr auto_nodeset,
111 112
                                        char **mask,
                                        int cellid);
113 114 115 116

/*
 * Setters
 */
117
int virDomainNumatuneSet(virDomainNumaPtr numa,
118 119 120 121
                         bool placement_static,
                         int placement,
                         int mode,
                         virBitmapPtr nodeset)
122 123
    ATTRIBUTE_NONNULL(1);

124
void virDomainNumaSetNodeMemorySize(virDomainNumaPtr numa,
125 126 127 128
                                    size_t node,
                                    unsigned long long size)
    ATTRIBUTE_NONNULL(1);

129 130 131
/*
 * Other accessors
 */
132 133
bool virDomainNumaEquals(virDomainNumaPtr n1,
                         virDomainNumaPtr n2);
134

135 136 137
bool virDomainNumaCheckABIStability(virDomainNumaPtr src,
                                    virDomainNumaPtr tgt);

138
bool virDomainNumatuneHasPlacementAuto(virDomainNumaPtr numatune);
139

140
bool virDomainNumatuneHasPerNodeBinding(virDomainNumaPtr numatune);
141

142
int virDomainNumatuneSpecifiedMaxNode(virDomainNumaPtr numatune);
143

144
bool virDomainNumatuneNodesetIsAvailable(virDomainNumaPtr numatune,
145
                                         virBitmapPtr auto_nodeset);
146

147
bool virDomainNumatuneNodeSpecified(virDomainNumaPtr numatune,
148
                                    int cellid);
149

150 151
int virDomainNumaDefCPUParseXML(virDomainNumaPtr def, xmlXPathContextPtr ctxt);
int virDomainNumaDefCPUFormat(virBufferPtr buf, virDomainNumaPtr def);
152

153
unsigned int virDomainNumaGetCPUCountTotal(virDomainNumaPtr numa);
154 155


156
#endif /* __NUMA_CONF_H__ */