blob: 77b5dc3597e31d6c543e9c8cd5959cca53d5c375 [file] [log] [blame]
Jeremy Fitzhardinge17758262008-04-02 10:54:13 -07001/******************************************************************************
2 * balloon.c
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 * Copyright (c) 2005 Dan M. Smith, IBM Corporation
9 *
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License version 2
12 * as published by the Free Software Foundation; or, when distributed
13 * separately from the Linux kernel or incorporated into other
14 * software packages, subject to the following license:
15 *
16 * Permission is hereby granted, free of charge, to any person obtaining a copy
17 * of this source file (the "Software"), to deal in the Software without
18 * restriction, including without limitation the rights to use, copy, modify,
19 * merge, publish, distribute, sublicense, and/or sell copies of the Software,
20 * and to permit persons to whom the Software is furnished to do so, subject to
21 * the following conditions:
22 *
23 * The above copyright notice and this permission notice shall be included in
24 * all copies or substantial portions of the Software.
25 *
26 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
27 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
28 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
29 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
30 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
31 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
32 * IN THE SOFTWARE.
33 */
34
35#include <linux/kernel.h>
36#include <linux/module.h>
37#include <linux/sched.h>
38#include <linux/errno.h>
39#include <linux/mm.h>
40#include <linux/bootmem.h>
41#include <linux/pagemap.h>
42#include <linux/highmem.h>
43#include <linux/mutex.h>
Jeremy Fitzhardinge17758262008-04-02 10:54:13 -070044#include <linux/list.h>
45#include <linux/sysdev.h>
Tejun Heo5a0e3ad2010-03-24 17:04:11 +090046#include <linux/gfp.h>
Jeremy Fitzhardinge17758262008-04-02 10:54:13 -070047
Jeremy Fitzhardinge17758262008-04-02 10:54:13 -070048#include <asm/page.h>
49#include <asm/pgalloc.h>
50#include <asm/pgtable.h>
51#include <asm/uaccess.h>
52#include <asm/tlb.h>
53
Jeremy Fitzhardingeecbf29c2008-12-16 12:37:07 -080054#include <asm/xen/hypervisor.h>
55#include <asm/xen/hypercall.h>
Jeremy Fitzhardinge1ccbf532009-10-06 15:11:14 -070056
57#include <xen/xen.h>
Jeremy Fitzhardingeecbf29c2008-12-16 12:37:07 -080058#include <xen/interface/xen.h>
Jeremy Fitzhardinge17758262008-04-02 10:54:13 -070059#include <xen/interface/memory.h>
Jeremy Fitzhardinge17758262008-04-02 10:54:13 -070060#include <xen/xenbus.h>
61#include <xen/features.h>
62#include <xen/page.h>
63
64#define PAGES2KB(_p) ((_p)<<(PAGE_SHIFT-10))
65
Jeremy Fitzhardinge167e6cf2008-07-24 16:27:52 -070066#define BALLOON_CLASS_NAME "xen_memory"
Jeremy Fitzhardinge17758262008-04-02 10:54:13 -070067
68struct balloon_stats {
69 /* We aim for 'current allocation' == 'target allocation'. */
70 unsigned long current_pages;
71 unsigned long target_pages;
Jeremy Fitzhardinge17758262008-04-02 10:54:13 -070072 /*
73 * Drivers may alter the memory reservation independently, but they
74 * must inform the balloon driver so we avoid hitting the hard limit.
75 */
76 unsigned long driver_pages;
77 /* Number of pages in high- and low-memory balloons. */
78 unsigned long balloon_low;
79 unsigned long balloon_high;
80};
81
82static DEFINE_MUTEX(balloon_mutex);
83
84static struct sys_device balloon_sysdev;
85
86static int register_balloon(struct sys_device *sysdev);
87
Jeremy Fitzhardinge17758262008-04-02 10:54:13 -070088static struct balloon_stats balloon_stats;
89
90/* We increase/decrease in batches which fit in a page */
91static unsigned long frame_list[PAGE_SIZE / sizeof(unsigned long)];
92
Jeremy Fitzhardinge17758262008-04-02 10:54:13 -070093#ifdef CONFIG_HIGHMEM
Jeremy Fitzhardinge17758262008-04-02 10:54:13 -070094#define inc_totalhigh_pages() (totalhigh_pages++)
95#define dec_totalhigh_pages() (totalhigh_pages--)
96#else
97#define inc_totalhigh_pages() do {} while(0)
98#define dec_totalhigh_pages() do {} while(0)
99#endif
100
101/* List of ballooned pages, threaded through the mem_map array. */
102static LIST_HEAD(ballooned_pages);
103
104/* Main work function, always executed in process context. */
105static void balloon_process(struct work_struct *work);
106static DECLARE_WORK(balloon_worker, balloon_process);
107static struct timer_list balloon_timer;
108
109/* When ballooning out (allocating memory to return to Xen) we don't really
110 want the kernel to try too hard since that can trigger the oom killer. */
111#define GFP_BALLOON \
112 (GFP_HIGHUSER | __GFP_NOWARN | __GFP_NORETRY | __GFP_NOMEMALLOC)
113
114static void scrub_page(struct page *page)
115{
116#ifdef CONFIG_XEN_SCRUB_PAGES
Jeremy Fitzhardinge26a3e992008-11-17 09:35:00 -0800117 clear_highpage(page);
Jeremy Fitzhardinge17758262008-04-02 10:54:13 -0700118#endif
119}
120
121/* balloon_append: add the given page to the balloon. */
Jeremy Fitzhardinge9be4d452010-08-31 15:01:16 -0700122static void __balloon_append(struct page *page)
Jeremy Fitzhardinge17758262008-04-02 10:54:13 -0700123{
124 /* Lowmem is re-populated first, so highmem pages go at list tail. */
125 if (PageHighMem(page)) {
126 list_add_tail(&page->lru, &ballooned_pages);
127 balloon_stats.balloon_high++;
128 dec_totalhigh_pages();
129 } else {
130 list_add(&page->lru, &ballooned_pages);
131 balloon_stats.balloon_low++;
132 }
Jeremy Fitzhardinge9be4d452010-08-31 15:01:16 -0700133}
Gianluca Guida3d65c942009-07-30 22:54:36 +0100134
Jeremy Fitzhardinge9be4d452010-08-31 15:01:16 -0700135static void balloon_append(struct page *page)
136{
137 __balloon_append(page);
Gianluca Guida3d65c942009-07-30 22:54:36 +0100138 totalram_pages--;
Jeremy Fitzhardinge17758262008-04-02 10:54:13 -0700139}
140
141/* balloon_retrieve: rescue a page from the balloon, if it is not empty. */
142static struct page *balloon_retrieve(void)
143{
144 struct page *page;
145
146 if (list_empty(&ballooned_pages))
147 return NULL;
148
149 page = list_entry(ballooned_pages.next, struct page, lru);
150 list_del(&page->lru);
151
152 if (PageHighMem(page)) {
153 balloon_stats.balloon_high--;
154 inc_totalhigh_pages();
155 }
156 else
157 balloon_stats.balloon_low--;
158
Gianluca Guida3d65c942009-07-30 22:54:36 +0100159 totalram_pages++;
160
Jeremy Fitzhardinge17758262008-04-02 10:54:13 -0700161 return page;
162}
163
164static struct page *balloon_first_page(void)
165{
166 if (list_empty(&ballooned_pages))
167 return NULL;
168 return list_entry(ballooned_pages.next, struct page, lru);
169}
170
171static struct page *balloon_next_page(struct page *page)
172{
173 struct list_head *next = page->lru.next;
174 if (next == &ballooned_pages)
175 return NULL;
176 return list_entry(next, struct page, lru);
177}
178
179static void balloon_alarm(unsigned long unused)
180{
181 schedule_work(&balloon_worker);
182}
183
184static unsigned long current_target(void)
185{
Ian Campbellbc2c0302009-06-05 11:58:37 +0100186 unsigned long target = balloon_stats.target_pages;
Jeremy Fitzhardinge17758262008-04-02 10:54:13 -0700187
188 target = min(target,
189 balloon_stats.current_pages +
190 balloon_stats.balloon_low +
191 balloon_stats.balloon_high);
192
193 return target;
194}
195
196static int increase_reservation(unsigned long nr_pages)
197{
Jeremy Fitzhardinge2f70e0a2010-09-02 23:11:17 -0700198 unsigned long pfn, i;
Jeremy Fitzhardinge17758262008-04-02 10:54:13 -0700199 struct page *page;
200 long rc;
201 struct xen_memory_reservation reservation = {
202 .address_bits = 0,
203 .extent_order = 0,
204 .domid = DOMID_SELF
205 };
206
207 if (nr_pages > ARRAY_SIZE(frame_list))
208 nr_pages = ARRAY_SIZE(frame_list);
209
Jeremy Fitzhardinge17758262008-04-02 10:54:13 -0700210 page = balloon_first_page();
211 for (i = 0; i < nr_pages; i++) {
212 BUG_ON(page == NULL);
Joe Perchesa419aef2009-08-18 11:18:35 -0700213 frame_list[i] = page_to_pfn(page);
Jeremy Fitzhardinge17758262008-04-02 10:54:13 -0700214 page = balloon_next_page(page);
215 }
216
Isaku Yamahataa90971e2008-05-26 23:31:14 +0100217 set_xen_guest_handle(reservation.extent_start, frame_list);
Jeremy Fitzhardingefde28e82008-07-24 16:28:00 -0700218 reservation.nr_extents = nr_pages;
219 rc = HYPERVISOR_memory_op(XENMEM_populate_physmap, &reservation);
Ian Campbellbc2c0302009-06-05 11:58:37 +0100220 if (rc < 0)
Jeremy Fitzhardinge17758262008-04-02 10:54:13 -0700221 goto out;
Jeremy Fitzhardinge17758262008-04-02 10:54:13 -0700222
Ian Campbellbc2c0302009-06-05 11:58:37 +0100223 for (i = 0; i < rc; i++) {
Jeremy Fitzhardinge17758262008-04-02 10:54:13 -0700224 page = balloon_retrieve();
225 BUG_ON(page == NULL);
226
227 pfn = page_to_pfn(page);
228 BUG_ON(!xen_feature(XENFEAT_auto_translated_physmap) &&
229 phys_to_machine_mapping_valid(pfn));
230
231 set_phys_to_machine(pfn, frame_list[i]);
232
233 /* Link back into the page tables if not highmem. */
234 if (pfn < max_low_pfn) {
235 int ret;
236 ret = HYPERVISOR_update_va_mapping(
237 (unsigned long)__va(pfn << PAGE_SHIFT),
238 mfn_pte(frame_list[i], PAGE_KERNEL),
239 0);
240 BUG_ON(ret);
241 }
242
243 /* Relinquish the page back to the allocator. */
244 ClearPageReserved(page);
245 init_page_count(page);
246 __free_page(page);
247 }
248
Ian Campbellbc2c0302009-06-05 11:58:37 +0100249 balloon_stats.current_pages += rc;
Jeremy Fitzhardinge17758262008-04-02 10:54:13 -0700250
251 out:
Ian Campbellbc2c0302009-06-05 11:58:37 +0100252 return rc < 0 ? rc : rc != nr_pages;
Jeremy Fitzhardinge17758262008-04-02 10:54:13 -0700253}
254
255static int decrease_reservation(unsigned long nr_pages)
256{
Jeremy Fitzhardinge2f70e0a2010-09-02 23:11:17 -0700257 unsigned long pfn, i;
Jeremy Fitzhardinge17758262008-04-02 10:54:13 -0700258 struct page *page;
259 int need_sleep = 0;
260 int ret;
261 struct xen_memory_reservation reservation = {
262 .address_bits = 0,
263 .extent_order = 0,
264 .domid = DOMID_SELF
265 };
266
267 if (nr_pages > ARRAY_SIZE(frame_list))
268 nr_pages = ARRAY_SIZE(frame_list);
269
270 for (i = 0; i < nr_pages; i++) {
271 if ((page = alloc_page(GFP_BALLOON)) == NULL) {
272 nr_pages = i;
273 need_sleep = 1;
274 break;
275 }
276
277 pfn = page_to_pfn(page);
278 frame_list[i] = pfn_to_mfn(pfn);
279
280 scrub_page(page);
Dan Magenheimer1058a752009-01-22 14:36:08 -0800281
Ian Campbellff4ce8c2009-01-23 16:26:21 +0000282 if (!PageHighMem(page)) {
283 ret = HYPERVISOR_update_va_mapping(
284 (unsigned long)__va(pfn << PAGE_SHIFT),
285 __pte_ma(0), 0);
286 BUG_ON(ret);
287 }
288
Jeremy Fitzhardinge17758262008-04-02 10:54:13 -0700289 }
290
291 /* Ensure that ballooned highmem pages don't have kmaps. */
292 kmap_flush_unused();
293 flush_tlb_all();
294
Jeremy Fitzhardinge17758262008-04-02 10:54:13 -0700295 /* No more mappings: invalidate P2M and add to balloon. */
296 for (i = 0; i < nr_pages; i++) {
297 pfn = mfn_to_pfn(frame_list[i]);
298 set_phys_to_machine(pfn, INVALID_P2M_ENTRY);
299 balloon_append(pfn_to_page(pfn));
300 }
301
Isaku Yamahataa90971e2008-05-26 23:31:14 +0100302 set_xen_guest_handle(reservation.extent_start, frame_list);
Jeremy Fitzhardinge17758262008-04-02 10:54:13 -0700303 reservation.nr_extents = nr_pages;
304 ret = HYPERVISOR_memory_op(XENMEM_decrease_reservation, &reservation);
305 BUG_ON(ret != nr_pages);
306
307 balloon_stats.current_pages -= nr_pages;
Jeremy Fitzhardinge17758262008-04-02 10:54:13 -0700308
Jeremy Fitzhardinge17758262008-04-02 10:54:13 -0700309 return need_sleep;
310}
311
312/*
313 * We avoid multiple worker processes conflicting via the balloon mutex.
314 * We may of course race updates of the target counts (which are protected
315 * by the balloon lock), or with changes to the Xen hard limit, but we will
316 * recover from these in time.
317 */
318static void balloon_process(struct work_struct *work)
319{
320 int need_sleep = 0;
321 long credit;
322
323 mutex_lock(&balloon_mutex);
324
325 do {
326 credit = current_target() - balloon_stats.current_pages;
327 if (credit > 0)
328 need_sleep = (increase_reservation(credit) != 0);
329 if (credit < 0)
330 need_sleep = (decrease_reservation(-credit) != 0);
331
332#ifndef CONFIG_PREEMPT
333 if (need_resched())
334 schedule();
335#endif
336 } while ((credit != 0) && !need_sleep);
337
338 /* Schedule more work if there is some still to be done. */
339 if (current_target() != balloon_stats.current_pages)
340 mod_timer(&balloon_timer, jiffies + HZ);
341
342 mutex_unlock(&balloon_mutex);
343}
344
345/* Resets the Xen limit, sets new target, and kicks off processing. */
Adrian Bunk955d6f12008-05-26 23:31:17 +0100346static void balloon_set_new_target(unsigned long target)
Jeremy Fitzhardinge17758262008-04-02 10:54:13 -0700347{
348 /* No need for lock. Not read-modify-write updates. */
Jeremy Fitzhardinge17758262008-04-02 10:54:13 -0700349 balloon_stats.target_pages = target;
350 schedule_work(&balloon_worker);
351}
352
353static struct xenbus_watch target_watch =
354{
355 .node = "memory/target"
356};
357
358/* React to a change in the target key */
359static void watch_target(struct xenbus_watch *watch,
360 const char **vec, unsigned int len)
361{
362 unsigned long long new_target;
363 int err;
364
365 err = xenbus_scanf(XBT_NIL, "memory", "target", "%llu", &new_target);
366 if (err != 1) {
367 /* This is ok (for domain0 at least) - so just return */
368 return;
369 }
370
371 /* The given memory/target value is in KiB, so it needs converting to
372 * pages. PAGE_SHIFT converts bytes to pages, hence PAGE_SHIFT - 10.
373 */
374 balloon_set_new_target(new_target >> (PAGE_SHIFT - 10));
375}
376
377static int balloon_init_watcher(struct notifier_block *notifier,
378 unsigned long event,
379 void *data)
380{
381 int err;
382
383 err = register_xenbus_watch(&target_watch);
384 if (err)
385 printk(KERN_ERR "Failed to set balloon watcher\n");
386
387 return NOTIFY_DONE;
388}
389
390static struct notifier_block xenstore_notifier;
391
392static int __init balloon_init(void)
393{
394 unsigned long pfn;
395 struct page *page;
396
Jeremy Fitzhardinge6e833582008-08-19 13:16:17 -0700397 if (!xen_pv_domain())
Jeremy Fitzhardinge17758262008-04-02 10:54:13 -0700398 return -ENODEV;
399
400 pr_info("xen_balloon: Initialising balloon driver.\n");
401
402 balloon_stats.current_pages = min(xen_start_info->nr_pages, max_pfn);
Jeremy Fitzhardinge17758262008-04-02 10:54:13 -0700403 balloon_stats.target_pages = balloon_stats.current_pages;
404 balloon_stats.balloon_low = 0;
405 balloon_stats.balloon_high = 0;
406 balloon_stats.driver_pages = 0UL;
Jeremy Fitzhardinge17758262008-04-02 10:54:13 -0700407
408 init_timer(&balloon_timer);
409 balloon_timer.data = 0;
410 balloon_timer.function = balloon_alarm;
411
412 register_balloon(&balloon_sysdev);
413
414 /* Initialise the balloon with excess memory space. */
Jeremy Fitzhardinge9be4d452010-08-31 15:01:16 -0700415 for (pfn = PFN_UP(xen_extra_mem_start);
416 pfn < PFN_DOWN(xen_extra_mem_start + xen_extra_mem_size);
417 pfn++) {
Jeremy Fitzhardinge17758262008-04-02 10:54:13 -0700418 page = pfn_to_page(pfn);
Jeremy Fitzhardinge9be4d452010-08-31 15:01:16 -0700419 /* totalram_pages doesn't include the boot-time
420 balloon extension, so don't subtract from it. */
421 __balloon_append(page);
Jeremy Fitzhardinge17758262008-04-02 10:54:13 -0700422 }
423
424 target_watch.callback = watch_target;
425 xenstore_notifier.notifier_call = balloon_init_watcher;
426
427 register_xenstore_notifier(&xenstore_notifier);
428
429 return 0;
430}
431
432subsys_initcall(balloon_init);
433
434static void balloon_exit(void)
435{
436 /* XXX - release balloon here */
437 return;
438}
439
440module_exit(balloon_exit);
441
Jeremy Fitzhardinge167e6cf2008-07-24 16:27:52 -0700442#define BALLOON_SHOW(name, format, args...) \
443 static ssize_t show_##name(struct sys_device *dev, \
444 struct sysdev_attribute *attr, \
445 char *buf) \
446 { \
447 return sprintf(buf, format, ##args); \
448 } \
Jeremy Fitzhardinge17758262008-04-02 10:54:13 -0700449 static SYSDEV_ATTR(name, S_IRUGO, show_##name, NULL)
450
451BALLOON_SHOW(current_kb, "%lu\n", PAGES2KB(balloon_stats.current_pages));
452BALLOON_SHOW(low_kb, "%lu\n", PAGES2KB(balloon_stats.balloon_low));
453BALLOON_SHOW(high_kb, "%lu\n", PAGES2KB(balloon_stats.balloon_high));
Jeremy Fitzhardinge17758262008-04-02 10:54:13 -0700454BALLOON_SHOW(driver_kb, "%lu\n", PAGES2KB(balloon_stats.driver_pages));
455
Jeremy Fitzhardinge167e6cf2008-07-24 16:27:52 -0700456static ssize_t show_target_kb(struct sys_device *dev, struct sysdev_attribute *attr,
457 char *buf)
Jeremy Fitzhardinge17758262008-04-02 10:54:13 -0700458{
459 return sprintf(buf, "%lu\n", PAGES2KB(balloon_stats.target_pages));
460}
461
462static ssize_t store_target_kb(struct sys_device *dev,
Andi Kleen4a0b2b42008-07-01 18:48:41 +0200463 struct sysdev_attribute *attr,
Jeremy Fitzhardinge17758262008-04-02 10:54:13 -0700464 const char *buf,
465 size_t count)
466{
Jeremy Fitzhardinge167e6cf2008-07-24 16:27:52 -0700467 char *endchar;
Jeremy Fitzhardinge17758262008-04-02 10:54:13 -0700468 unsigned long long target_bytes;
469
470 if (!capable(CAP_SYS_ADMIN))
471 return -EPERM;
472
Jeremy Fitzhardinge618b2c82009-01-28 16:50:20 -0800473 target_bytes = simple_strtoull(buf, &endchar, 0) * 1024;
Jeremy Fitzhardinge17758262008-04-02 10:54:13 -0700474
Jeremy Fitzhardinge17758262008-04-02 10:54:13 -0700475 balloon_set_new_target(target_bytes >> PAGE_SHIFT);
476
477 return count;
478}
479
480static SYSDEV_ATTR(target_kb, S_IRUGO | S_IWUSR,
481 show_target_kb, store_target_kb);
482
Jeremy Fitzhardinge618b2c82009-01-28 16:50:20 -0800483
484static ssize_t show_target(struct sys_device *dev, struct sysdev_attribute *attr,
485 char *buf)
486{
487 return sprintf(buf, "%llu\n",
Jan Beulich06926982009-05-05 13:57:52 +0100488 (unsigned long long)balloon_stats.target_pages
489 << PAGE_SHIFT);
Jeremy Fitzhardinge618b2c82009-01-28 16:50:20 -0800490}
491
492static ssize_t store_target(struct sys_device *dev,
493 struct sysdev_attribute *attr,
494 const char *buf,
495 size_t count)
496{
497 char *endchar;
498 unsigned long long target_bytes;
499
500 if (!capable(CAP_SYS_ADMIN))
501 return -EPERM;
502
503 target_bytes = memparse(buf, &endchar);
504
505 balloon_set_new_target(target_bytes >> PAGE_SHIFT);
506
507 return count;
508}
509
510static SYSDEV_ATTR(target, S_IRUGO | S_IWUSR,
511 show_target, store_target);
512
513
Jeremy Fitzhardinge17758262008-04-02 10:54:13 -0700514static struct sysdev_attribute *balloon_attrs[] = {
515 &attr_target_kb,
Jeremy Fitzhardinge618b2c82009-01-28 16:50:20 -0800516 &attr_target,
Jeremy Fitzhardinge17758262008-04-02 10:54:13 -0700517};
518
519static struct attribute *balloon_info_attrs[] = {
520 &attr_current_kb.attr,
521 &attr_low_kb.attr,
522 &attr_high_kb.attr,
Jeremy Fitzhardinge17758262008-04-02 10:54:13 -0700523 &attr_driver_kb.attr,
524 NULL
525};
526
527static struct attribute_group balloon_info_group = {
528 .name = "info",
529 .attrs = balloon_info_attrs,
530};
531
532static struct sysdev_class balloon_sysdev_class = {
533 .name = BALLOON_CLASS_NAME,
534};
535
536static int register_balloon(struct sys_device *sysdev)
537{
538 int i, error;
539
540 error = sysdev_class_register(&balloon_sysdev_class);
541 if (error)
542 return error;
543
544 sysdev->id = 0;
545 sysdev->cls = &balloon_sysdev_class;
546
547 error = sysdev_register(sysdev);
548 if (error) {
549 sysdev_class_unregister(&balloon_sysdev_class);
550 return error;
551 }
552
553 for (i = 0; i < ARRAY_SIZE(balloon_attrs); i++) {
554 error = sysdev_create_file(sysdev, balloon_attrs[i]);
555 if (error)
556 goto fail;
557 }
558
559 error = sysfs_create_group(&sysdev->kobj, &balloon_info_group);
560 if (error)
561 goto fail;
562
563 return 0;
564
565 fail:
566 while (--i >= 0)
567 sysdev_remove_file(sysdev, balloon_attrs[i]);
568 sysdev_unregister(sysdev);
569 sysdev_class_unregister(&balloon_sysdev_class);
570 return error;
571}
572
Jeremy Fitzhardinge17758262008-04-02 10:54:13 -0700573MODULE_LICENSE("GPL");