numa_conf.h 4.9 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
virDomainNumatuneMemMode virDomainNumatuneGetMode(virDomainNumaPtr numatune,
76
                                                  int cellid);
77

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

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

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

99 100 101
/*
 * Formatters
 */
102
char *virDomainNumatuneFormatNodeset(virDomainNumaPtr numatune,
103 104
                                     virBitmapPtr auto_nodeset,
                                     int cellid);
105

106
int virDomainNumatuneMaybeFormatNodeset(virDomainNumaPtr numatune,
107
                                        virBitmapPtr auto_nodeset,
108 109
                                        char **mask,
                                        int cellid);
110 111 112 113

/*
 * Setters
 */
114
int virDomainNumatuneSet(virDomainNumaPtr numa,
115 116 117 118
                         bool placement_static,
                         int placement,
                         int mode,
                         virBitmapPtr nodeset)
119 120
    ATTRIBUTE_NONNULL(1);

121
void virDomainNumaSetNodeMemorySize(virDomainNumaPtr numa,
122 123 124 125
                                    size_t node,
                                    unsigned long long size)
    ATTRIBUTE_NONNULL(1);

126 127 128
/*
 * Other accessors
 */
129 130
bool virDomainNumaEquals(virDomainNumaPtr n1,
                         virDomainNumaPtr n2);
131

132 133 134
bool virDomainNumaCheckABIStability(virDomainNumaPtr src,
                                    virDomainNumaPtr tgt);

135
bool virDomainNumatuneHasPlacementAuto(virDomainNumaPtr numatune);
136

137
bool virDomainNumatuneHasPerNodeBinding(virDomainNumaPtr numatune);
138

139
int virDomainNumatuneSpecifiedMaxNode(virDomainNumaPtr numatune);
140

141
bool virDomainNumatuneNodesetIsAvailable(virDomainNumaPtr numatune,
142
                                         virBitmapPtr auto_nodeset);
143

144
bool virDomainNumatuneNodeSpecified(virDomainNumaPtr numatune,
145
                                    int cellid);
146

147 148
int virDomainNumaDefCPUParseXML(virDomainNumaPtr def, xmlXPathContextPtr ctxt);
int virDomainNumaDefCPUFormat(virBufferPtr buf, virDomainNumaPtr def);
149

150
unsigned int virDomainNumaGetCPUCountTotal(virDomainNumaPtr numa);
151 152


153
#endif /* __NUMA_CONF_H__ */