ia64/linux-2.6.18-xen.hg

view drivers/block/cciss_cmd.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 #ifndef CCISS_CMD_H
2 #define CCISS_CMD_H
3 //###########################################################################
4 //DEFINES
5 //###########################################################################
6 #define CISS_VERSION "1.00"
8 //general boundary defintions
9 #define SENSEINFOBYTES 32//note that this value may vary between host implementations
10 #define MAXSGENTRIES 31
11 #define MAXREPLYQS 256
13 //Command Status value
14 #define CMD_SUCCESS 0x0000
15 #define CMD_TARGET_STATUS 0x0001
16 #define CMD_DATA_UNDERRUN 0x0002
17 #define CMD_DATA_OVERRUN 0x0003
18 #define CMD_INVALID 0x0004
19 #define CMD_PROTOCOL_ERR 0x0005
20 #define CMD_HARDWARE_ERR 0x0006
21 #define CMD_CONNECTION_LOST 0x0007
22 #define CMD_ABORTED 0x0008
23 #define CMD_ABORT_FAILED 0x0009
24 #define CMD_UNSOLICITED_ABORT 0x000A
25 #define CMD_TIMEOUT 0x000B
26 #define CMD_UNABORTABLE 0x000C
28 //transfer direction
29 #define XFER_NONE 0x00
30 #define XFER_WRITE 0x01
31 #define XFER_READ 0x02
32 #define XFER_RSVD 0x03
34 //task attribute
35 #define ATTR_UNTAGGED 0x00
36 #define ATTR_SIMPLE 0x04
37 #define ATTR_HEADOFQUEUE 0x05
38 #define ATTR_ORDERED 0x06
39 #define ATTR_ACA 0x07
41 //cdb type
42 #define TYPE_CMD 0x00
43 #define TYPE_MSG 0x01
45 //config space register offsets
46 #define CFG_VENDORID 0x00
47 #define CFG_DEVICEID 0x02
48 #define CFG_I2OBAR 0x10
49 #define CFG_MEM1BAR 0x14
51 //i2o space register offsets
52 #define I2O_IBDB_SET 0x20
53 #define I2O_IBDB_CLEAR 0x70
54 #define I2O_INT_STATUS 0x30
55 #define I2O_INT_MASK 0x34
56 #define I2O_IBPOST_Q 0x40
57 #define I2O_OBPOST_Q 0x44
59 //Configuration Table
60 #define CFGTBL_ChangeReq 0x00000001l
61 #define CFGTBL_AccCmds 0x00000001l
63 #define CFGTBL_Trans_Simple 0x00000002l
65 #define CFGTBL_BusType_Ultra2 0x00000001l
66 #define CFGTBL_BusType_Ultra3 0x00000002l
67 #define CFGTBL_BusType_Fibre1G 0x00000100l
68 #define CFGTBL_BusType_Fibre2G 0x00000200l
69 typedef struct _vals32
70 {
71 __u32 lower;
72 __u32 upper;
73 } vals32;
75 typedef union _u64bit
76 {
77 vals32 val32;
78 __u64 val;
79 } u64bit;
81 // Type defs used in the following structs
82 #define BYTE __u8
83 #define WORD __u16
84 #define HWORD __u16
85 #define DWORD __u32
86 #define QWORD vals32
88 //###########################################################################
89 //STRUCTURES
90 //###########################################################################
91 #define CISS_MAX_LUN 16
92 #define CISS_MAX_PHYS_LUN 1024
93 // SCSI-3 Cmmands
95 #pragma pack(1)
97 #define CISS_INQUIRY 0x12
98 //Date returned
99 typedef struct _InquiryData_struct
100 {
101 BYTE data_byte[36];
102 } InquiryData_struct;
104 #define CISS_REPORT_LOG 0xc2 /* Report Logical LUNs */
105 #define CISS_REPORT_PHYS 0xc3 /* Report Physical LUNs */
106 // Data returned
107 typedef struct _ReportLUNdata_struct
108 {
109 BYTE LUNListLength[4];
110 DWORD reserved;
111 BYTE LUN[CISS_MAX_LUN][8];
112 } ReportLunData_struct;
114 #define CCISS_READ_CAPACITY 0x25 /* Read Capacity */
115 typedef struct _ReadCapdata_struct
116 {
117 BYTE total_size[4]; // Total size in blocks
118 BYTE block_size[4]; // Size of blocks in bytes
119 } ReadCapdata_struct;
121 // 12 byte commands not implemented in firmware yet.
122 // #define CCISS_READ 0xa8 // Read(12)
123 // #define CCISS_WRITE 0xaa // Write(12)
124 #define CCISS_READ 0x28 // Read(10)
125 #define CCISS_WRITE 0x2a // Write(10)
127 // BMIC commands
128 #define BMIC_READ 0x26
129 #define BMIC_WRITE 0x27
130 #define BMIC_CACHE_FLUSH 0xc2
131 #define CCISS_CACHE_FLUSH 0x01 //C2 was already being used by CCISS
133 //Command List Structure
134 typedef union _SCSI3Addr_struct {
135 struct {
136 BYTE Dev;
137 BYTE Bus:6;
138 BYTE Mode:2; // b00
139 } PeripDev;
140 struct {
141 BYTE DevLSB;
142 BYTE DevMSB:6;
143 BYTE Mode:2; // b01
144 } LogDev;
145 struct {
146 BYTE Dev:5;
147 BYTE Bus:3;
148 BYTE Targ:6;
149 BYTE Mode:2; // b10
150 } LogUnit;
151 } SCSI3Addr_struct;
153 typedef struct _PhysDevAddr_struct {
154 DWORD TargetId:24;
155 DWORD Bus:6;
156 DWORD Mode:2;
157 SCSI3Addr_struct Target[2]; //2 level target device addr
158 } PhysDevAddr_struct;
160 typedef struct _LogDevAddr_struct {
161 DWORD VolId:30;
162 DWORD Mode:2;
163 BYTE reserved[4];
164 } LogDevAddr_struct;
166 typedef union _LUNAddr_struct {
167 BYTE LunAddrBytes[8];
168 SCSI3Addr_struct SCSI3Lun[4];
169 PhysDevAddr_struct PhysDev;
170 LogDevAddr_struct LogDev;
171 } LUNAddr_struct;
173 typedef struct _CommandListHeader_struct {
174 BYTE ReplyQueue;
175 BYTE SGList;
176 HWORD SGTotal;
177 QWORD Tag;
178 LUNAddr_struct LUN;
179 } CommandListHeader_struct;
180 typedef struct _RequestBlock_struct {
181 BYTE CDBLen;
182 struct {
183 BYTE Type:3;
184 BYTE Attribute:3;
185 BYTE Direction:2;
186 } Type;
187 HWORD Timeout;
188 BYTE CDB[16];
189 } RequestBlock_struct;
190 typedef struct _ErrDescriptor_struct {
191 QWORD Addr;
192 DWORD Len;
193 } ErrDescriptor_struct;
194 typedef struct _SGDescriptor_struct {
195 QWORD Addr;
196 DWORD Len;
197 DWORD Ext;
198 } SGDescriptor_struct;
200 typedef union _MoreErrInfo_struct{
201 struct {
202 BYTE Reserved[3];
203 BYTE Type;
204 DWORD ErrorInfo;
205 }Common_Info;
206 struct{
207 BYTE Reserved[2];
208 BYTE offense_size;//size of offending entry
209 BYTE offense_num; //byte # of offense 0-base
210 DWORD offense_value;
211 }Invalid_Cmd;
212 }MoreErrInfo_struct;
213 typedef struct _ErrorInfo_struct {
214 BYTE ScsiStatus;
215 BYTE SenseLen;
216 HWORD CommandStatus;
217 DWORD ResidualCnt;
218 MoreErrInfo_struct MoreErrInfo;
219 BYTE SenseInfo[SENSEINFOBYTES];
220 } ErrorInfo_struct;
222 /* Command types */
223 #define CMD_RWREQ 0x00
224 #define CMD_IOCTL_PEND 0x01
225 #define CMD_SCSI 0x03
226 #define CMD_MSG_DONE 0x04
227 #define CMD_MSG_TIMEOUT 0x05
229 /* This structure needs to be divisible by 8 for new
230 * indexing method.
231 */
232 #define PADSIZE (sizeof(long) - 4)
233 typedef struct _CommandList_struct {
234 CommandListHeader_struct Header;
235 RequestBlock_struct Request;
236 ErrDescriptor_struct ErrDesc;
237 SGDescriptor_struct SG[MAXSGENTRIES];
238 /* information associated with the command */
239 __u32 busaddr; /* physical address of this record */
240 ErrorInfo_struct * err_info; /* pointer to the allocated mem */
241 int ctlr;
242 int cmd_type;
243 long cmdindex;
244 struct _CommandList_struct *prev;
245 struct _CommandList_struct *next;
246 struct request * rq;
247 struct completion *waiting;
248 int retry_count;
249 void * scsi_cmd;
250 char pad[PADSIZE];
251 } CommandList_struct;
253 //Configuration Table Structure
254 typedef struct _HostWrite_struct {
255 DWORD TransportRequest;
256 DWORD Reserved;
257 DWORD CoalIntDelay;
258 DWORD CoalIntCount;
259 } HostWrite_struct;
261 typedef struct _CfgTable_struct {
262 BYTE Signature[4];
263 DWORD SpecValence;
264 DWORD TransportSupport;
265 DWORD TransportActive;
266 HostWrite_struct HostWrite;
267 DWORD CmdsOutMax;
268 DWORD BusTypes;
269 DWORD Reserved;
270 BYTE ServerName[16];
271 DWORD HeartBeat;
272 DWORD SCSI_Prefetch;
273 } CfgTable_struct;
274 #pragma pack()
275 #endif // CCISS_CMD_H