ia64/linux-2.6.18-xen.hg

view drivers/serial/8250_gsc.c @ 897:329ea0ccb344

balloon: try harder to balloon up under memory pressure.

Currently if the balloon driver is unable to increase the guest's
reservation it assumes the failure was due to reaching its full
allocation, gives up on the ballooning operation and records the limit
it reached as the "hard limit". The driver will not try again until
the target is set again (even to the same value).

However it is possible that ballooning has in fact failed due to
memory pressure in the host and therefore it is desirable to keep
attempting to reach the target in case memory becomes available. The
most likely scenario is that some guests are ballooning down while
others are ballooning up and therefore there is temporary memory
pressure while things stabilise. You would not expect a well behaved
toolstack to ask a domain to balloon to more than its allocation nor
would you expect it to deliberately over-commit memory by setting
balloon targets which exceed the total host memory.

This patch drops the concept of a hard limit and causes the balloon
driver to retry increasing the reservation on a timer in the same
manner as when decreasing the reservation.

Also if we partially succeed in increasing the reservation
(i.e. receive less pages than we asked for) then we may as well keep
those pages rather than returning them to Xen.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Fri Jun 05 14:01:20 2009 +0100 (2009-06-05)
parents 831230e53067
children
line source
1 /*
2 * Serial Device Initialisation for Lasi/Asp/Wax/Dino
3 *
4 * (c) Copyright Matthew Wilcox <willy@debian.org> 2001-2002
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 */
12 #include <linux/errno.h>
13 #include <linux/init.h>
14 #include <linux/interrupt.h>
15 #include <linux/ioport.h>
16 #include <linux/module.h>
17 #include <linux/serial_core.h>
18 #include <linux/signal.h>
19 #include <linux/slab.h>
20 #include <linux/types.h>
22 #include <asm/hardware.h>
23 #include <asm/parisc-device.h>
24 #include <asm/io.h>
25 #include <asm/serial.h> /* for LASI_BASE_BAUD */
27 #include "8250.h"
29 static int __init
30 serial_init_chip(struct parisc_device *dev)
31 {
32 struct uart_port port;
33 unsigned long address;
34 int err;
36 if (!dev->irq) {
37 /* We find some unattached serial ports by walking native
38 * busses. These should be silently ignored. Otherwise,
39 * what we have here is a missing parent device, so tell
40 * the user what they're missing.
41 */
42 if (parisc_parent(dev)->id.hw_type != HPHW_IOA) {
43 printk(KERN_INFO "Serial: device 0x%lx not configured.\n"
44 "Enable support for Wax, Lasi, Asp or Dino.\n",
45 dev->hpa.start);
46 }
47 return -ENODEV;
48 }
50 address = dev->hpa.start;
51 if (dev->id.sversion != 0x8d) {
52 address += 0x800;
53 }
55 memset(&port, 0, sizeof(port));
56 port.iotype = UPIO_MEM;
57 port.uartclk = LASI_BASE_BAUD * 16;
58 port.mapbase = address;
59 port.membase = ioremap_nocache(address, 16);
60 port.irq = dev->irq;
61 port.flags = UPF_BOOT_AUTOCONF;
62 port.dev = &dev->dev;
64 err = serial8250_register_port(&port);
65 if (err < 0) {
66 printk(KERN_WARNING "serial8250_register_port returned error %d\n", err);
67 return err;
68 }
70 return 0;
71 }
73 static struct parisc_device_id serial_tbl[] = {
74 { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x00075 },
75 { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x0008c },
76 { HPHW_FIO, HVERSION_REV_ANY_ID, HVERSION_ANY_ID, 0x0008d },
77 { 0 }
78 };
80 /* Hack. Some machines have SERIAL_0 attached to Lasi and SERIAL_1
81 * attached to Dino. Unfortunately, Dino appears before Lasi in the device
82 * tree. To ensure that ttyS0 == SERIAL_0, we register two drivers; one
83 * which only knows about Lasi and then a second which will find all the
84 * other serial ports. HPUX ignores this problem.
85 */
86 static struct parisc_device_id lasi_tbl[] = {
87 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x03B, 0x0008C }, /* C1xx/C1xxL */
88 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x03C, 0x0008C }, /* B132L */
89 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x03D, 0x0008C }, /* B160L */
90 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x03E, 0x0008C }, /* B132L+ */
91 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x03F, 0x0008C }, /* B180L+ */
92 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x046, 0x0008C }, /* Rocky2 120 */
93 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x047, 0x0008C }, /* Rocky2 150 */
94 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x04E, 0x0008C }, /* Kiji L2 132 */
95 { HPHW_FIO, HVERSION_REV_ANY_ID, 0x056, 0x0008C }, /* Raven+ */
96 { 0 }
97 };
100 MODULE_DEVICE_TABLE(parisc, serial_tbl);
102 static struct parisc_driver lasi_driver = {
103 .name = "serial_1",
104 .id_table = lasi_tbl,
105 .probe = serial_init_chip,
106 };
108 static struct parisc_driver serial_driver = {
109 .name = "serial",
110 .id_table = serial_tbl,
111 .probe = serial_init_chip,
112 };
114 int __init probe_serial_gsc(void)
115 {
116 register_parisc_driver(&lasi_driver);
117 register_parisc_driver(&serial_driver);
118 return 0;
119 }
121 module_init(probe_serial_gsc);