diff options
author | Jeremy Fitzhardinge <jeremy@goop.org> | 2008-04-02 13:54:13 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-04-24 17:57:33 -0400 |
commit | 1775826ceec51187aa868406585799b7e76ffa7d (patch) | |
tree | 585b75deeb350a36ff54095de591ecd58e860ea1 /include | |
parent | af7ae3b9c4a4c1337903f31131d58e3c0d2b6d55 (diff) |
xen: add balloon driver
The balloon driver allows memory to be dynamically added or removed from the domain,
in order to allow host memory to be balanced between multiple domains.
This patch introduces the Xen balloon driver, though it currently only
allows a domain to be shrunk from its initial size (and re-grown back to
that size). A later patch will add the ability to grow a domain beyond
its initial size.
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/xen/balloon.h | 61 | ||||
-rw-r--r-- | include/xen/interface/memory.h | 12 |
2 files changed, 65 insertions, 8 deletions
diff --git a/include/xen/balloon.h b/include/xen/balloon.h new file mode 100644 index 000000000000..fe43b0f3c86a --- /dev/null +++ b/include/xen/balloon.h | |||
@@ -0,0 +1,61 @@ | |||
1 | /****************************************************************************** | ||
2 | * balloon.h | ||
3 | * | ||
4 | * Xen balloon driver - enables returning/claiming memory to/from Xen. | ||
5 | * | ||
6 | * Copyright (c) 2003, B Dragovic | ||
7 | * Copyright (c) 2003-2004, M Williamson, K Fraser | ||
8 | * | ||
9 | * This program is free software; you can redistribute it and/or | ||
10 | * modify it under the terms of the GNU General Public License version 2 | ||
11 | * as published by the Free Software Foundation; or, when distributed | ||
12 | * separately from the Linux kernel or incorporated into other | ||
13 | * software packages, subject to the following license: | ||
14 | * | ||
15 | * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
16 | * of this source file (the "Software"), to deal in the Software without | ||
17 | * restriction, including without limitation the rights to use, copy, modify, | ||
18 | * merge, publish, distribute, sublicense, and/or sell copies of the Software, | ||
19 | * and to permit persons to whom the Software is furnished to do so, subject to | ||
20 | * the following conditions: | ||
21 | * | ||
22 | * The above copyright notice and this permission notice shall be included in | ||
23 | * all copies or substantial portions of the Software. | ||
24 | * | ||
25 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
26 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
27 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
28 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
29 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
30 | * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||
31 | * IN THE SOFTWARE. | ||
32 | */ | ||
33 | |||
34 | #ifndef __XEN_BALLOON_H__ | ||
35 | #define __XEN_BALLOON_H__ | ||
36 | |||
37 | #include <linux/spinlock.h> | ||
38 | |||
39 | #if 0 | ||
40 | /* | ||
41 | * Inform the balloon driver that it should allow some slop for device-driver | ||
42 | * memory activities. | ||
43 | */ | ||
44 | void balloon_update_driver_allowance(long delta); | ||
45 | |||
46 | /* Allocate/free a set of empty pages in low memory (i.e., no RAM mapped). */ | ||
47 | struct page **alloc_empty_pages_and_pagevec(int nr_pages); | ||
48 | void free_empty_pages_and_pagevec(struct page **pagevec, int nr_pages); | ||
49 | |||
50 | void balloon_release_driver_page(struct page *page); | ||
51 | |||
52 | /* | ||
53 | * Prevent the balloon driver from changing the memory reservation during | ||
54 | * a driver critical region. | ||
55 | */ | ||
56 | extern spinlock_t balloon_lock; | ||
57 | #define balloon_lock(__flags) spin_lock_irqsave(&balloon_lock, __flags) | ||
58 | #define balloon_unlock(__flags) spin_unlock_irqrestore(&balloon_lock, __flags) | ||
59 | #endif | ||
60 | |||
61 | #endif /* __XEN_BALLOON_H__ */ | ||
diff --git a/include/xen/interface/memory.h b/include/xen/interface/memory.h index af36ead16817..da768469aa92 100644 --- a/include/xen/interface/memory.h +++ b/include/xen/interface/memory.h | |||
@@ -29,7 +29,7 @@ struct xen_memory_reservation { | |||
29 | * OUT: GMFN bases of extents that were allocated | 29 | * OUT: GMFN bases of extents that were allocated |
30 | * (NB. This command also updates the mach_to_phys translation table) | 30 | * (NB. This command also updates the mach_to_phys translation table) |
31 | */ | 31 | */ |
32 | GUEST_HANDLE(ulong) extent_start; | 32 | ulong extent_start; |
33 | 33 | ||
34 | /* Number of extents, and size/alignment of each (2^extent_order pages). */ | 34 | /* Number of extents, and size/alignment of each (2^extent_order pages). */ |
35 | unsigned long nr_extents; | 35 | unsigned long nr_extents; |
@@ -50,7 +50,6 @@ struct xen_memory_reservation { | |||
50 | domid_t domid; | 50 | domid_t domid; |
51 | 51 | ||
52 | }; | 52 | }; |
53 | DEFINE_GUEST_HANDLE_STRUCT(xen_memory_reservation); | ||
54 | 53 | ||
55 | /* | 54 | /* |
56 | * Returns the maximum machine frame number of mapped RAM in this system. | 55 | * Returns the maximum machine frame number of mapped RAM in this system. |
@@ -86,7 +85,7 @@ struct xen_machphys_mfn_list { | |||
86 | * any large discontiguities in the machine address space, 2MB gaps in | 85 | * any large discontiguities in the machine address space, 2MB gaps in |
87 | * the machphys table will be represented by an MFN base of zero. | 86 | * the machphys table will be represented by an MFN base of zero. |
88 | */ | 87 | */ |
89 | GUEST_HANDLE(ulong) extent_start; | 88 | ulong extent_start; |
90 | 89 | ||
91 | /* | 90 | /* |
92 | * Number of extents written to the above array. This will be smaller | 91 | * Number of extents written to the above array. This will be smaller |
@@ -94,7 +93,6 @@ struct xen_machphys_mfn_list { | |||
94 | */ | 93 | */ |
95 | unsigned int nr_extents; | 94 | unsigned int nr_extents; |
96 | }; | 95 | }; |
97 | DEFINE_GUEST_HANDLE_STRUCT(xen_machphys_mfn_list); | ||
98 | 96 | ||
99 | /* | 97 | /* |
100 | * Sets the GPFN at which a particular page appears in the specified guest's | 98 | * Sets the GPFN at which a particular page appears in the specified guest's |
@@ -117,7 +115,6 @@ struct xen_add_to_physmap { | |||
117 | /* GPFN where the source mapping page should appear. */ | 115 | /* GPFN where the source mapping page should appear. */ |
118 | unsigned long gpfn; | 116 | unsigned long gpfn; |
119 | }; | 117 | }; |
120 | DEFINE_GUEST_HANDLE_STRUCT(xen_add_to_physmap); | ||
121 | 118 | ||
122 | /* | 119 | /* |
123 | * Translates a list of domain-specific GPFNs into MFNs. Returns a -ve error | 120 | * Translates a list of domain-specific GPFNs into MFNs. Returns a -ve error |
@@ -132,14 +129,13 @@ struct xen_translate_gpfn_list { | |||
132 | unsigned long nr_gpfns; | 129 | unsigned long nr_gpfns; |
133 | 130 | ||
134 | /* List of GPFNs to translate. */ | 131 | /* List of GPFNs to translate. */ |
135 | GUEST_HANDLE(ulong) gpfn_list; | 132 | ulong gpfn_list; |
136 | 133 | ||
137 | /* | 134 | /* |
138 | * Output list to contain MFN translations. May be the same as the input | 135 | * Output list to contain MFN translations. May be the same as the input |
139 | * list (in which case each input GPFN is overwritten with the output MFN). | 136 | * list (in which case each input GPFN is overwritten with the output MFN). |
140 | */ | 137 | */ |
141 | GUEST_HANDLE(ulong) mfn_list; | 138 | ulong mfn_list; |
142 | }; | 139 | }; |
143 | DEFINE_GUEST_HANDLE_STRUCT(xen_translate_gpfn_list); | ||
144 | 140 | ||
145 | #endif /* __XEN_PUBLIC_MEMORY_H__ */ | 141 | #endif /* __XEN_PUBLIC_MEMORY_H__ */ |