ia64/linux-2.6.18-xen.hg

view drivers/net/dgrs_bcomm.h @ 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 * The bios low-memory structure
3 *
4 * Some of the variables in here can be used to set parameters that
5 * are stored in NVRAM and will retain their old values the next time
6 * the card is brought up. To use the values stored in NVRAM, the
7 * parameter should be set to "all ones". This tells the firmware to
8 * use the NVRAM value or a suitable default. The value that is used
9 * will be stored back into this structure by the firmware. If the
10 * value of the variable is not "all ones", then that value will be
11 * used and will be stored into NVRAM if it isn't already there.
12 * The variables this applies to are the following:
13 * Variable Set to: Gets default of:
14 * bc_hashexpire -1 300 (5 minutes)
15 * bc_spantree -1 1 (spanning tree on)
16 * bc_ipaddr FF:FF:FF:FF 0 (no SNMP IP address)
17 * bc_ipxnet FF:FF:FF:FF 0 (no SNMP IPX net)
18 * bc_iptrap FF:FF:FF:FF 0 (no SNMP IP trap address)
19 *
20 * Some variables MUST have their value set after the firmware
21 * is loaded onto the board, but before the processor is released.
22 * These are:
23 * bc_host 0 means no host "port", run as standalone switch.
24 * 1 means run as a switch, with a host port. (normal)
25 * 2 means run as multiple NICs, not as a switch.
26 * -1 means run in diagnostics mode.
27 * bc_nowait
28 * bc_hostarea_len
29 * bc_filter_len
30 *
31 */
32 BEGIN_STRUCT(bios_comm)
33 S4(ulong, bc_intflag) /* Count of all interrupts */
34 S4(ulong, bc_lbolt) /* Count of timer interrupts */
35 S4(ulong, bc_maincnt) /* Count of main loops */
36 S4(ulong, bc_hashcnt) /* Count of entries in hash table */
37 S4A(ulong, bc_cnt, 8) /* Misc counters, for debugging */
38 S4A(ulong, bc_flag, 8) /* Misc flags, for debugging */
39 S4(ulong, bc_memsize) /* Size of memory */
40 S4(ulong, bc_dcache) /* Size of working dcache */
41 S4(ulong, bc_icache) /* Size of working icache */
42 S4(long, bc_status) /* Firmware status */
43 S1A(char, bc_file, 8) /* File name of assertion failure */
44 S4(ulong, bc_line) /* Line # of assertion failure */
45 S4(uchar *, bc_ramstart)
46 S4(uchar *, bc_ramend)
47 S4(uchar *, bc_heapstart) /* Start of heap (end of loaded memory) */
48 S4(uchar *, bc_heapend) /* End of heap */
50 /* Configurable Parameters */
51 S4(long, bc_host) /* 1=Host Port, 0=No Host Port, -1=Test Mode */
52 S4(long, bc_nowait) /* Don't wait for 2host circ buffer to empty*/
53 S4(long, bc_150ohm) /* 0 == 100 ohm UTP, 1 == 150 ohm STP */
54 S4(long, bc_squelch) /* 0 == normal squelch, 1 == reduced squelch */
55 S4(ulong, bc_hashexpire) /* Expiry time in seconds for hash table */
56 S4(long, bc_spantree) /* 1 == enable IEEE spanning tree */
58 S2A(ushort, bc_eaddr, 3) /* New ether address */
59 S2(ushort, bc_dummy1) /* padding for DOS compilers */
61 /* Various debugging aids */
62 S4(long, bc_debug) /* Debugging is turned on */
63 S4(long, bc_spew) /* Spew data on port 4 for bs_spew seconds */
64 S4(long, bc_spewlen) /* Length of spewed data packets */
65 S4(long, bc_maxrfd) /* If != 0, max number of RFD's to allocate */
66 S4(long, bc_maxrbd) /* If != 0, max number of RBD's to allocate */
68 /* Circular buffers for messages to/from host */
69 S4(ulong, bc_2host_head)
70 S4(ulong, bc_2host_tail)
71 S4(ulong, bc_2host_mask)
72 S1A(char, bc_2host, 0x200) /* Circ buff to host */
74 S4(ulong, bc_2idt_head)
75 S4(ulong, bc_2idt_tail)
76 S4(ulong, bc_2idt_mask)
77 S1A(char, bc_2idt, 0x200) /* Circ buff to idt */
79 /* Pointers to structures for driver access */
80 S4(uchar *, bc_port) /* pointer to Port[] structures */
81 S4(long, bc_nports) /* Number of ports */
82 S4(long, bc_portlen) /* sizeof(PORT) */
83 S4(uchar *, bc_hash) /* Pointer to hash table */
84 S4(long, bc_hashlen) /* sizeof(Table) */
86 /* SNMP agent addresses */
87 S1A(uchar, bc_ipaddr, 4) /* IP address for SNMP */
88 S1A(uchar, bc_ipxnet, 4) /* IPX net address for SNMP */
90 S4(long, bc_nohostintr) /* Do not cause periodic host interrupts */
92 S4(uchar *, bc_dmaaddr) /* Physical addr of host DMA buf for diags */
93 S4(ulong, bc_dmalen) /* Length of DMA buffer 0..2048 */
95 /*
96 * Board memory allocated on startup for use by host, usually
97 * for the purposes of creating DMA chain descriptors. The
98 * "len" must be set before the processor is released. The
99 * address of the area is returned in bc_hostarea. The area
100 * is guaranteed to be aligned on a 16 byte boundary.
101 */
102 S4(ulong, bc_hostarea_len) /* RW: Number of bytes to allocate */
103 S4(uchar *, bc_hostarea) /* RO: Address of allocated memory */
105 /*
106 * Variables for communicating filters into the board
107 */
108 S4(ulong *, bc_filter_area) /* RO: Space to put filter into */
109 S4(ulong, bc_filter_area_len) /* RO: Length of area, in bytes */
110 S4(long, bc_filter_cmd) /* RW: Filter command, see below */
111 S4(ulong, bc_filter_len) /* RW: Actual length of filter */
112 S4(ulong, bc_filter_port) /* RW: Port # for filter 0..6 */
113 S4(ulong, bc_filter_num) /* RW: Filter #, 0=input, 1=output */
115 /* more SNMP agent addresses */
116 S1A(uchar, bc_iptrap, 4) /* IP address for SNMP */
118 S4A(long, bc_spare, 2) /* spares */
119 END_STRUCT(bios_comm)
121 #define bc VMO(struct bios_comm, 0xa3000100)
123 /*
124 * bc_status values
125 */
126 #define BC_INIT 0
127 #define BC_RUN 100
129 /*
130 * bc_host values
131 */
132 #define BC_DIAGS -1
133 #define BC_SASWITCH 0
134 #define BC_SWITCH 1
135 #define BC_MULTINIC 2
137 /*
138 * Values for spew (debugging)
139 */
140 #define BC_SPEW_ENABLE 0x80000000
142 /*
143 * filter commands
144 */
145 #define BC_FILTER_ERR -1
146 #define BC_FILTER_OK 0
147 #define BC_FILTER_SET 1
148 #define BC_FILTER_CLR 2