ia64/linux-2.6.18-xen.hg

view Documentation/mca.txt @ 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 i386 Micro Channel Architecture Support
2 =======================================
4 MCA support is enabled using the CONFIG_MCA define. A machine with a MCA
5 bus will have the kernel variable MCA_bus set, assuming the BIOS feature
6 bits are set properly (see arch/i386/boot/setup.S for information on
7 how this detection is done).
9 Adapter Detection
10 =================
12 The ideal MCA adapter detection is done through the use of the
13 Programmable Option Select registers. Generic functions for doing
14 this have been added in include/linux/mca.h and arch/i386/kernel/mca.c.
15 Everything needed to detect adapters and read (and write) configuration
16 information is there. A number of MCA-specific drivers already use
17 this. The typical probe code looks like the following:
19 #include <linux/mca.h>
21 unsigned char pos2, pos3, pos4, pos5;
22 struct net_device* dev;
23 int slot;
25 if( MCA_bus ) {
26 slot = mca_find_adapter( ADAPTER_ID, 0 );
27 if( slot == MCA_NOTFOUND ) {
28 return -ENODEV;
29 }
30 /* optional - see below */
31 mca_set_adapter_name( slot, "adapter name & description" );
32 mca_set_adapter_procfn( slot, dev_getinfo, dev );
34 /* read the POS registers. Most devices only use 2 and 3 */
35 pos2 = mca_read_stored_pos( slot, 2 );
36 pos3 = mca_read_stored_pos( slot, 3 );
37 pos4 = mca_read_stored_pos( slot, 4 );
38 pos5 = mca_read_stored_pos( slot, 5 );
39 } else {
40 return -ENODEV;
41 }
43 /* extract configuration from pos[2345] and set everything up */
45 Loadable modules should modify this to test that the specified IRQ and
46 IO ports (plus whatever other stuff) match. See 3c523.c for example
47 code (actually, smc-mca.c has a slightly more complex example that can
48 handle a list of adapter ids).
50 Keep in mind that devices should never directly access the POS registers
51 (via inb(), outb(), etc). While it's generally safe, there is a small
52 potential for blowing up hardware when it's done at the wrong time.
53 Furthermore, accessing a POS register disables a device temporarily.
54 This is usually okay during startup, but do _you_ want to rely on it?
55 During initial configuration, mca_init() reads all the POS registers
56 into memory. mca_read_stored_pos() accesses that data. mca_read_pos()
57 and mca_write_pos() are also available for (safer) direct POS access,
58 but their use is _highly_ discouraged. mca_write_pos() is particularly
59 dangerous, as it is possible for adapters to be put in inconsistent
60 states (i.e. sharing IO address, etc) and may result in crashes, toasted
61 hardware, and blindness.
63 User level drivers (such as the AGX X server) can use /proc/mca/pos to
64 find adapters (see below).
66 Some MCA adapters can also be detected via the usual ISA-style device
67 probing (many SCSI adapters, for example). This sort of thing is highly
68 discouraged. Perfectly good information is available telling you what's
69 there, so there's no excuse for messing with random IO ports. However,
70 we MCA people still appreciate any ISA-style driver that will work with
71 our hardware. You take what you can get...
73 Level-Triggered Interrupts
74 ==========================
76 Because MCA uses level-triggered interrupts, a few problems arise with
77 what might best be described as the ISA mindset and its effects on
78 drivers. These sorts of problems are expected to become less common as
79 more people use shared IRQs on PCI machines.
81 In general, an interrupt must be acknowledged not only at the ICU (which
82 is done automagically by the kernel), but at the device level. In
83 particular, IRQ 0 must be reset after a timer interrupt (now done in
84 arch/i386/kernel/time.c) or the first timer interrupt hangs the system.
85 There were also problems with the 1.3.x floppy drivers, but that seems
86 to have been fixed.
88 IRQs are also shareable, and most MCA-specific devices should be coded
89 with shared IRQs in mind.
91 /proc/mca
92 =========
94 /proc/mca is a directory containing various files for adapters and
95 other stuff.
97 /proc/mca/pos Straight listing of POS registers
98 /proc/mca/slot[1-8] Information on adapter in specific slot
99 /proc/mca/video Same for integrated video
100 /proc/mca/scsi Same for integrated SCSI
101 /proc/mca/machine Machine information
103 See Appendix A for a sample.
105 Device drivers can easily add their own information function for
106 specific slots (including integrated ones) via the
107 mca_set_adapter_procfn() call. Drivers that support this are ESDI, IBM
108 SCSI, and 3c523. If a device is also a module, make sure that the proc
109 function is removed in the module cleanup. This will require storing
110 the slot information in a private structure somewhere. See the 3c523
111 driver for details.
113 Your typical proc function will look something like this:
115 static int
116 dev_getinfo( char* buf, int slot, void* d ) {
117 struct net_device* dev = (struct net_device*) d;
118 int len = 0;
120 len += sprintf( buf+len, "Device: %s\n", dev->name );
121 len += sprintf( buf+len, "IRQ: %d\n", dev->irq );
122 len += sprintf( buf+len, "IO Port: %#lx-%#lx\n", ... );
123 ...
125 return len;
126 }
128 Some of the standard MCA information will already be printed, so don't
129 bother repeating it. Don't try putting in more than 3K of information.
131 Enable this function with:
132 mca_set_adapter_procfn( slot, dev_getinfo, dev );
134 Disable it with:
135 mca_set_adapter_procfn( slot, NULL, NULL );
137 It is also recommended that, even if you don't write a proc function, to
138 set the name of the adapter (i.e. "PS/2 ESDI Controller") via
139 mca_set_adapter_name( int slot, char* name ).
141 MCA Device Drivers
142 ==================
144 Currently, there are a number of MCA-specific device drivers.
146 1) PS/2 ESDI
147 drivers/block/ps2esdi.c
148 include/linux/ps2esdi.h
149 Uses major number 36, and should use /dev files /dev/eda, /dev/edb.
150 Supports two drives, but only one controller. May use the
151 command-line args "ed=cyl,head,sec" and "tp720".
153 2) PS/2 SCSI
154 drivers/scsi/ibmmca.c
155 drivers/scsi/ibmmca.h
156 The driver for the IBM SCSI subsystem. Includes both integrated
157 controllers and adapter cards. May require command-line arg
158 "ibmmcascsi=io_port" to force detection of an adapter. If you have a
159 machine with a front-panel display (i.e. model 95), you can use
160 "ibmmcascsi=display" to enable a drive activity indicator.
162 3) 3c523
163 drivers/net/3c523.c
164 drivers/net/3c523.h
165 3Com 3c523 Etherlink/MC ethernet driver.
167 4) SMC Ultra/MCA and IBM Adapter/A
168 drivers/net/smc-mca.c
169 drivers/net/smc-mca.h
170 Driver for the MCA version of the SMC Ultra and various other
171 OEM'ed and work-alike cards (Elite, Adapter/A, etc).
173 5) NE/2
174 driver/net/ne2.c
175 driver/net/ne2.h
176 The NE/2 is the MCA version of the NE2000. This may not work
177 with clones that have a different adapter id than the original
178 NE/2.
180 6) Future Domain MCS-600/700, OEM'd IBM Fast SCSI Aapter/A and
181 Reply Sound Blaster/SCSI (SCSI part)
182 Better support for these cards than the driver for ISA.
183 Supports multiple cards with IRQ sharing.
185 Also added boot time option of scsi-probe, which can do reordering of
186 SCSI host adapters. This will direct the kernel on the order which
187 SCSI adapter should be detected. Example:
188 scsi-probe=ibmmca,fd_mcs,adaptec1542,buslogic
190 The serial drivers were modified to support the extended IO port range
191 of the typical MCA system (also #ifdef CONFIG_MCA).
193 The following devices work with existing drivers:
194 1) Token-ring
195 2) Future Domain SCSI (MCS-600, MCS-700, not MCS-350, OEM'ed IBM SCSI)
196 3) Adaptec 1640 SCSI (using the aha1542 driver)
197 4) Bustek/Buslogic SCSI (various)
198 5) Probably all Arcnet cards.
199 6) Some, possibly all, MCA IDE controllers.
200 7) 3Com 3c529 (MCA version of 3c509) (patched)
202 8) Intel EtherExpressMC (patched version)
203 You need to have CONFIG_MCA defined to have EtherExpressMC support.
204 9) Reply Sound Blaster/SCSI (SB part) (patched version)
206 Bugs & Other Weirdness
207 ======================
209 NMIs tend to occur with MCA machines because of various hardware
210 weirdness, bus timeouts, and many other non-critical things. Some basic
211 code to handle them (inspired by the NetBSD MCA code) has been added to
212 detect the guilty device, but it's pretty incomplete. If NMIs are a
213 persistent problem (on some model 70 or 80s, they occur every couple
214 shell commands), the CONFIG_IGNORE_NMI flag will take care of that.
216 Various Pentium machines have had serious problems with the FPU test in
217 bugs.h. Basically, the machine hangs after the HLT test. This occurs,
218 as far as we know, on the Pentium-equipped 85s, 95s, and some PC Servers.
219 The PCI/MCA PC 750s are fine as far as I can tell. The ``mca-pentium''
220 boot-prompt flag will disable the FPU bug check if this is a problem
221 with your machine.
223 The model 80 has a raft of problems that are just too weird and unique
224 to get into here. Some people have no trouble while others have nothing
225 but problems. I'd suspect some problems are related to the age of the
226 average 80 and accompanying hardware deterioration, although others
227 are definitely design problems with the hardware. Among the problems
228 include SCSI controller problems, ESDI controller problems, and serious
229 screw-ups in the floppy controller. Oh, and the parallel port is also
230 pretty flaky. There were about 5 or 6 different model 80 motherboards
231 produced to fix various obscure problems. As far as I know, it's pretty
232 much impossible to tell which bugs a particular model 80 has (other than
233 triggering them, that is).
235 Drivers are required for some MCA memory adapters. If you're suddenly
236 short a few megs of RAM, this might be the reason. The (I think) Enhanced
237 Memory Adapter commonly found on the model 70 is one. There's a very
238 alpha driver floating around, but it's pretty ugly (disassembled from
239 the DOS driver, actually). See the MCA Linux web page (URL below)
240 for more current memory info.
242 The Thinkpad 700 and 720 will work, but various components are either
243 non-functional, flaky, or we don't know anything about them. The
244 graphics controller is supposed to be some WD, but we can't get things
245 working properly. The PCMCIA slots don't seem to work. Ditto for APM.
246 The serial ports work, but detection seems to be flaky.
248 Credits
249 =======
250 A whole pile of people have contributed to the MCA code. I'd include
251 their names here, but I don't have a list handy. Check the MCA Linux
252 home page (URL below) for a perpetually out-of-date list.
254 =====================================================================
255 MCA Linux Home Page: http://www.dgmicro.com/mca/
257 Christophe Beauregard
258 chrisb@truespectra.com
259 cpbeaure@calum.csclub.uwaterloo.ca
261 =====================================================================
262 Appendix A: Sample /proc/mca
264 This is from my model 8595. Slot 1 contains the standard IBM SCSI
265 adapter, slot 3 is an Adaptec AHA-1640, slot 5 is a XGA-1 video adapter,
266 and slot 7 is the 3c523 Etherlink/MC.
268 /proc/mca/machine:
269 Model Id: 0xf8
270 Submodel Id: 0x14
271 BIOS Revision: 0x5
273 /proc/mca/pos:
274 Slot 1: ff 8e f1 fc a0 ff ff ff IBM SCSI Adapter w/Cache
275 Slot 2: ff ff ff ff ff ff ff ff
276 Slot 3: 1f 0f 81 3b bf b6 ff ff
277 Slot 4: ff ff ff ff ff ff ff ff
278 Slot 5: db 8f 1d 5e fd c0 00 00
279 Slot 6: ff ff ff ff ff ff ff ff
280 Slot 7: 42 60 ff 08 ff ff ff ff 3Com 3c523 Etherlink/MC
281 Slot 8: ff ff ff ff ff ff ff ff
282 Video : ff ff ff ff ff ff ff ff
283 SCSI : ff ff ff ff ff ff ff ff
285 /proc/mca/slot1:
286 Slot: 1
287 Adapter Name: IBM SCSI Adapter w/Cache
288 Id: 8eff
289 Enabled: Yes
290 POS: ff 8e f1 fc a0 ff ff ff
291 Subsystem PUN: 7
292 Detected at boot: Yes
294 /proc/mca/slot3:
295 Slot: 3
296 Adapter Name: Unknown
297 Id: 0f1f
298 Enabled: Yes
299 POS: 1f 0f 81 3b bf b6 ff ff
301 /proc/mca/slot5:
302 Slot: 5
303 Adapter Name: Unknown
304 Id: 8fdb
305 Enabled: Yes
306 POS: db 8f 1d 5e fd c0 00 00
308 /proc/mca/slot7:
309 Slot: 7
310 Adapter Name: 3Com 3c523 Etherlink/MC
311 Id: 6042
312 Enabled: Yes
313 POS: 42 60 ff 08 ff ff ff ff
314 Revision: 0xe
315 IRQ: 9
316 IO Address: 0x3300-0x3308
317 Memory: 0xd8000-0xdbfff
318 Transceiver: External
319 Device: eth0
320 Hardware Address: 02 60 8c 45 c4 2a