| @@ -1,209 +1,209 @@ | | | @@ -1,209 +1,209 @@ |
1 | .\" $NetBSD: balloon.4,v 1.6 2011/04/20 08:20:16 wiz Exp $ | | 1 | .\" $NetBSD: balloon.4,v 1.7 2011/07/30 09:39:20 jym Exp $ |
2 | .\" | | 2 | .\" |
3 | .\" Copyright (c) 2011 The NetBSD Foundation, Inc. | | 3 | .\" Copyright (c) 2011 The NetBSD Foundation, Inc. |
4 | .\" All rights reserved. | | 4 | .\" All rights reserved. |
5 | .\" | | 5 | .\" |
6 | .\" This code is derived from software contributed to The NetBSD Foundation | | 6 | .\" This code is derived from software contributed to The NetBSD Foundation |
7 | .\" by Jean-Yves Migeon <jym@NetBSD.org>. | | 7 | .\" by Jean-Yves Migeon <jym@NetBSD.org>. |
8 | .\" | | 8 | .\" |
9 | .\" Redistribution and use in source and binary forms, with or without | | 9 | .\" Redistribution and use in source and binary forms, with or without |
10 | .\" modification, are permitted provided that the following conditions | | 10 | .\" modification, are permitted provided that the following conditions |
11 | .\" are met: | | 11 | .\" are met: |
12 | .\" 1. Redistributions of source code must retain the above copyright | | 12 | .\" 1. Redistributions of source code must retain the above copyright |
13 | .\" notice, this list of conditions and the following disclaimer. | | 13 | .\" notice, this list of conditions and the following disclaimer. |
14 | .\" 2. Redistributions in binary form must reproduce the above copyright | | 14 | .\" 2. Redistributions in binary form must reproduce the above copyright |
15 | .\" notice, this list of conditions and the following disclaimer in the | | 15 | .\" notice, this list of conditions and the following disclaimer in the |
16 | .\" documentation and/or other materials provided with the distribution. | | 16 | .\" documentation and/or other materials provided with the distribution. |
17 | .\" | | 17 | .\" |
18 | .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS | | 18 | .\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS |
19 | .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | | 19 | .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
20 | .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | | 20 | .\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
21 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | | 21 | .\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS |
22 | .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | | 22 | .\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
23 | .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | | 23 | .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
24 | .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | | 24 | .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
25 | .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | | 25 | .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
26 | .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | | 26 | .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
27 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | 27 | .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
28 | .\" POSSIBILITY OF SUCH DAMAGE. | | 28 | .\" POSSIBILITY OF SUCH DAMAGE. |
29 | .\" | | 29 | .\" |
30 | .Dd April 20, 2011 | | 30 | .Dd April 20, 2011 |
31 | .Dt BALLOON 4 xen | | 31 | .Dt BALLOON 4 xen |
32 | .Os | | 32 | .Os |
33 | .Sh NAME | | 33 | .Sh NAME |
34 | .Nm balloon | | 34 | .Nm balloon |
35 | .Nd Xen memory balloon driver | | 35 | .Nd Xen memory balloon driver |
36 | .Sh SYNOPSIS | | 36 | .Sh SYNOPSIS |
37 | .Cd "balloon* at xenbus?" | | 37 | .Cd "balloon* at xenbus?" |
38 | .Sh DESCRIPTION | | 38 | .Sh DESCRIPTION |
39 | The | | 39 | The |
40 | .Nm | | 40 | .Nm |
41 | driver supports the memory ballooning operations offered in | | 41 | driver supports the memory ballooning operations offered in |
42 | .Tn Xen | | 42 | .Tn Xen |
43 | environments. | | 43 | environments. |
44 | It allows shrinking or extending a domain's available memory by passing | | 44 | It allows shrinking or extending a domain's available memory by passing |
45 | pages between different domains. | | 45 | pages between different domains. |
46 | At any time, the total memory available to a domain is called the | | 46 | At any time, the total memory available to a domain is called the |
47 | ``reservation''. | | 47 | ``reservation''. |
48 | .Pp | | 48 | .Pp |
49 | Pages are moved via the use of the balloon, a reserved quantity | | 49 | Pages are moved via the use of the balloon, a reserved quantity |
50 | of memory available to all domains that can be freely deflated (or inflated) | | 50 | of memory available to all domains that can be freely deflated (or inflated) |
51 | at a domain's will. | | 51 | at a domain's will. |
52 | Deflating balloon means that pages are moved out from it, and bound to | | 52 | Deflating balloon means that pages are moved out from it, and bound to |
53 | domain's virtual memory. | | 53 | domain's virtual memory. |
54 | Respectively, inflating balloon indicates that pages are moved out of | | 54 | Respectively, inflating balloon indicates that pages are moved out of |
55 | domain's memory and pushed inside balloon. | | 55 | domain's memory and pushed inside balloon. |
56 | This is similar to a dynamic allocation of wired physical memory, except | | 56 | This is similar to a dynamic allocation of wired physical memory, except |
57 | that the pages are not available to domain anymore. | | 57 | that the pages are not available to domain anymore. |
58 | .Pp | | 58 | .Pp |
59 | Any domain is free to request memory from | | 59 | Any domain is free to request memory from |
60 | .Nm | | 60 | .Nm |
61 | up to the maximum value set by the host's administrator through the | | 61 | up to the maximum value set by the host's administrator through the |
62 | .Ic mem-max | | 62 | .Ic mem-max |
63 | command of | | 63 | command of |
64 | .Xr xm 1 . | | 64 | .Xr xm 1 . |
65 | Alternatively, the host's administrator is free to request to a particular | | 65 | Alternatively, the host's administrator is free to request to a particular |
66 | domain to give some memory back. | | 66 | domain to give some memory back. |
67 | This command requires the targeted domain's cooperation and requires | | 67 | This command requires the targeted domain's cooperation and requires |
68 | .Nm balloon | | 68 | .Nm balloon |
69 | support within it. | | 69 | support within it. |
70 | This can be done through the | | 70 | This can be done through the |
71 | .Ic mem-set | | 71 | .Ic mem-set |
72 | command of | | 72 | command of |
73 | .Xr xm 1 . | | 73 | .Xr xm 1 . |
74 | Alternatively, one can control the ballooning directly by writing | | 74 | Alternatively, one can control the ballooning directly by writing |
75 | under the | | 75 | under the |
76 | .Dq memory/target | | 76 | .Dq memory/target |
77 | node inside Xenstore. | | 77 | node inside Xenstore. |
78 | This entry controls the target memory reservation | | 78 | This entry controls the target memory reservation |
79 | of a given domain, indicated in kilobytes (KiB). | | 79 | of a given domain, indicated in kilobytes (KiB). |
80 | .Pp | | 80 | .Pp |
81 | An interface to control | | 81 | An interface to control |
82 | .Nm | | 82 | .Nm |
83 | is also available through | | 83 | is also available through |
84 | .Xr sysctl 8 | | 84 | .Xr sysctl 8 |
85 | under | | 85 | under |
86 | .Dq kern.xen.balloon | | 86 | .Dq machdep.xen.balloon |
87 | (all values being in kilobytes): | | 87 | (all values being in kilobytes): |
88 | .Bl -tag indent -width xxxxxxx | | 88 | .Bl -tag indent -width xxxxxxx |
89 | .It current | | 89 | .It current |
90 | (read-only) The current memory reservation of the domain. | | 90 | (read-only) The current memory reservation of the domain. |
91 | .It min | | 91 | .It min |
92 | (read-write) The minimum reservation value acceptable by the domain's | | 92 | (read-write) The minimum reservation value acceptable by the domain's |
93 | .Nm balloon | | 93 | .Nm balloon |
94 | driver. | | 94 | driver. |
95 | Any request that would require domain to reduce its reservation below | | 95 | Any request that would require domain to reduce its reservation below |
96 | this threshold will be refused by the driver. | | 96 | this threshold will be refused by the driver. |
97 | This can be used by a domain's administrator to control the number of memory | | 97 | This can be used by a domain's administrator to control the number of memory |
98 | pages that will be kept available to domain. | | 98 | pages that will be kept available to domain. |
99 | .It max | | 99 | .It max |
100 | (read-only) The maximum reservation accessible to a domain. | | 100 | (read-only) The maximum reservation accessible to a domain. |
101 | Its value can only be changed by the dom0's administrator, through the | | 101 | Its value can only be changed by the dom0's administrator, through the |
102 | .Ic mem-max | | 102 | .Ic mem-max |
103 | command of | | 103 | command of |
104 | .Xr xm 1 . | | 104 | .Xr xm 1 . |
105 | .It target | | 105 | .It target |
106 | (read-write) The target reservation of the domain. | | 106 | (read-write) The target reservation of the domain. |
107 | This entry serves the same purpose as the | | 107 | This entry serves the same purpose as the |
108 | .Dq memory/target | | 108 | .Dq memory/target |
109 | entry in Xenstore. | | 109 | entry in Xenstore. |
110 | This controls the targeted number of pages that the domain should have. | | 110 | This controls the targeted number of pages that the domain should have. |
111 | Note that this is only a target, and may not be achieved for a variety of | | 111 | Note that this is only a target, and may not be achieved for a variety of |
112 | reasons. | | 112 | reasons. |
113 | .El | | 113 | .El |
114 | .Sh DIAGNOSTICS | | 114 | .Sh DIAGNOSTICS |
115 | .Bl -diag | | 115 | .Bl -diag |
116 | .It "WARNING: balloon could not reach target %zu (current %zu)" | | 116 | .It "WARNING: balloon could not reach target %zu (current %zu)" |
117 | .Nm | | 117 | .Nm |
118 | failed to reach the target reservation. | | 118 | failed to reach the target reservation. |
119 | This is typically due to a target set too low; the kernel prevented | | 119 | This is typically due to a target set too low; the kernel prevented |
120 | memory exhaustion by refusing further allocation. | | 120 | memory exhaustion by refusing further allocation. |
121 | .It "increase reservation incomplete: was %zu, returned %d" | | 121 | .It "increase reservation incomplete: was %zu, returned %d" |
122 | The hypervisor only gave a partial set of memory pages to domain. | | 122 | The hypervisor only gave a partial set of memory pages to domain. |
123 | This happens when host's memory consumption is high, and hypervisor | | 123 | This happens when host's memory consumption is high, and hypervisor |
124 | is unable to give enough free pages back to domain. | | 124 | is unable to give enough free pages back to domain. |
125 | .It "memory 'hot-plug' unsupported - clipping reservation %zu => %zu pages." | | 125 | .It "memory 'hot-plug' unsupported - clipping reservation %zu => %zu pages." |
126 | An attempt was made by domain to get more memory than initially obtained | | 126 | An attempt was made by domain to get more memory than initially obtained |
127 | during boot. | | 127 | during boot. |
128 | As physical memory pages cannot be added to memory management sub-system | | 128 | As physical memory pages cannot be added to memory management sub-system |
129 | dynamically, | | 129 | dynamically, |
130 | .Nm | | 130 | .Nm |
131 | will limit reservation up to the maximum value it can handle. | | 131 | will limit reservation up to the maximum value it can handle. |
132 | .El | | 132 | .El |
133 | .Sh ERRORS | | 133 | .Sh ERRORS |
134 | When setting the minimum threshold or target reservation entries through | | 134 | When setting the minimum threshold or target reservation entries through |
135 | .Dq kern.xen.balloon , | | 135 | .Dq machdep.xen.balloon , |
136 | the following errors can be returned: | | 136 | the following errors can be returned: |
137 | .Bl -tag -width Er | | 137 | .Bl -tag -width Er |
138 | .It Bq Er EPERM | | 138 | .It Bq Er EPERM |
139 | The value passed is beyond limits. | | 139 | The value passed is beyond limits. |
140 | The new value is either too low | | 140 | The new value is either too low |
141 | .Po Dq min | | 141 | .Po Dq min |
142 | is below driver's safeguard value, or | | 142 | is below driver's safeguard value, or |
143 | .Dq target | | 143 | .Dq target |
144 | is below minimum value | | 144 | is below minimum value |
145 | .Pc , | | 145 | .Pc , |
146 | or too high | | 146 | or too high |
147 | .Po Dq target | | 147 | .Po Dq target |
148 | is above maximum value | | 148 | is above maximum value |
149 | .Pc . | | 149 | .Pc . |
150 | .El | | 150 | .El |
151 | .Sh SEE ALSO | | 151 | .Sh SEE ALSO |
152 | .Xr xm 1 , | | 152 | .Xr xm 1 , |
153 | .Xr xenbus 4 , | | 153 | .Xr xenbus 4 , |
154 | .Xr uvm 9 | | 154 | .Xr uvm 9 |
155 | .Rs | | 155 | .Rs |
156 | .%A Carl A. Waldspurger | | 156 | .%A Carl A. Waldspurger |
157 | .%T "Memory Resource Management in VMware ESX Server" | | 157 | .%T "Memory Resource Management in VMware ESX Server" |
158 | .%I USENIX Association | | 158 | .%I USENIX Association |
159 | .%B Proceedings of the 5th Symposium on \ | | 159 | .%B Proceedings of the 5th Symposium on \ |
160 | Operating Systems Design and Implementation | | 160 | Operating Systems Design and Implementation |
161 | .%D December 9-11, 2002 | | 161 | .%D December 9-11, 2002 |
162 | .%U http://www.usenix.org/events/osdi02/tech/full_papers/waldspurger/waldspurger.pdf | | 162 | .%U http://www.usenix.org/events/osdi02/tech/full_papers/waldspurger/waldspurger.pdf |
163 | .Re | | 163 | .Re |
164 | .\" | | 164 | .\" |
165 | .Sh HISTORY | | 165 | .Sh HISTORY |
166 | The | | 166 | The |
167 | .Nm | | 167 | .Nm |
168 | driver first appeared in | | 168 | driver first appeared in |
169 | .Nx 6.0 . | | 169 | .Nx 6.0 . |
170 | .Sh AUTHORS | | 170 | .Sh AUTHORS |
171 | .An -nosplit | | 171 | .An -nosplit |
172 | The | | 172 | The |
173 | .Nm | | 173 | .Nm |
174 | driver was written by | | 174 | driver was written by |
175 | .An Cherry G. Mathew Aq cherry@NetBSD.org | | 175 | .An Cherry G. Mathew Aq cherry@NetBSD.org |
176 | and | | 176 | and |
177 | .An Jean-Yves Migeon Aq jym@NetBSD.org . | | 177 | .An Jean-Yves Migeon Aq jym@NetBSD.org . |
178 | .Sh BUGS | | 178 | .Sh BUGS |
179 | There are a number of reasons why a domain may not attain the targeted | | 179 | There are a number of reasons why a domain may not attain the targeted |
180 | memory reservation: | | 180 | memory reservation: |
181 | .Nm | | 181 | .Nm |
182 | can be empty and cannot be collapsed further, domain | | 182 | can be empty and cannot be collapsed further, domain |
183 | may not have enough free memory pages (due to memory fragmentation, | | 183 | may not have enough free memory pages (due to memory fragmentation, |
184 | memory exhaustion, ...) so it cannot give enough back to | | 184 | memory exhaustion, ...) so it cannot give enough back to |
185 | .Nm . | | 185 | .Nm . |
186 | .Pp | | 186 | .Pp |
187 | Currently, the virtual memory sub-system of | | 187 | Currently, the virtual memory sub-system of |
188 | .Nx | | 188 | .Nx |
189 | is not capable of ``hot-plugging'' new memory pages into place. | | 189 | is not capable of ``hot-plugging'' new memory pages into place. |
190 | This means that increasing a domain's memory reservation above | | 190 | This means that increasing a domain's memory reservation above |
191 | its initial maximum value is pointless, as new memory pages | | 191 | its initial maximum value is pointless, as new memory pages |
192 | cannot be consumed by the memory management sub-system. | | 192 | cannot be consumed by the memory management sub-system. |
193 | .Pp | | 193 | .Pp |
194 | Over expanding | | 194 | Over expanding |
195 | .Nm | | 195 | .Nm |
196 | generates high kernel memory pressure. | | 196 | generates high kernel memory pressure. |
197 | While the driver tries to stay as conservative as possible to avoid | | 197 | While the driver tries to stay as conservative as possible to avoid |
198 | crashes, a very low memory reservation will lead to unwanted swap or even | | 198 | crashes, a very low memory reservation will lead to unwanted swap or even |
199 | .Fn panic . | | 199 | .Fn panic . |
200 | .Sh SECURITY CONSIDERATIONS | | 200 | .Sh SECURITY CONSIDERATIONS |
201 | Ballooning involves moving pages between different domains. | | 201 | Ballooning involves moving pages between different domains. |
202 | This includes their content, which can lead to information leak. | | 202 | This includes their content, which can lead to information leak. |
203 | If you are running domains of different sensitivities on the same host, | | 203 | If you are running domains of different sensitivities on the same host, |
204 | consider disabling the use of ballooning altogether. | | 204 | consider disabling the use of ballooning altogether. |
205 | The | | 205 | The |
206 | .Nx | | 206 | .Nx |
207 | kernel zeroes all pages before relinquishing them to | | 207 | kernel zeroes all pages before relinquishing them to |
208 | .Nm | | 208 | .Nm |
209 | but this may not be the case for other operating systems. | | 209 | but this may not be the case for other operating systems. |