win-pvdrivers

view xenvbd_scsiport/common.h @ 1106:2d392ecdd366

Fix race is xenvbd causing 30 second freeze under high load
author James Harper <james.harper@bendigoit.com.au>
date Tue Nov 11 23:08:11 2014 +1100 (2014-11-11)
parents 27bd2a5a4704
children
line source
1 /*
2 PV Drivers for Windows Xen HVM Domains
3 Copyright (C) 2013 James Harper
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU General Public License
7 as published by the Free Software Foundation; either version 2
8 of the License, or (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
20 #define XENVBD_CONTROL_SIG "XENEJBPV"
21 #define XENVBD_CONTROL_START 0
22 #define XENVBD_CONTROL_STOP 1
23 #define XENVBD_CONTROL_EVENT 2
26 #define MAX_SHADOW_ENTRIES 64
27 #define SHADOW_ENTRIES min(MAX_SHADOW_ENTRIES, BLK_RING_SIZE)
29 struct {
30 /* filter data */
31 PVOID xvfd;
32 PDEVICE_OBJECT pdo;
33 ULONG backend_state;
34 KEVENT backend_event;
36 /* shared data */
37 ULONG device_state;
38 XN_HANDLE handle;
39 evtchn_port_t event_channel;
40 blkif_front_ring_t ring;
41 blkif_sring_t *sring;
42 grant_ref_t sring_gref;
43 UCHAR last_sense_key;
44 UCHAR last_additional_sense_code;
45 UCHAR last_additional_sense_code_qualifier;
46 BOOLEAN cac;
47 XENVBD_DEVICETYPE device_type;
48 XENVBD_DEVICEMODE device_mode;
49 ULONG bytes_per_sector; /* 512 for disk, 2048 for CDROM) */
50 ULONG hw_bytes_per_sector; /* underlying hardware format, eg 4K */
51 ULONGLONG total_sectors;
52 ULONGLONG new_total_sectors;
53 ULONG feature_flush_cache;
54 ULONG feature_discard;
55 ULONG feature_barrier;
56 CHAR serial_number[64];
58 /* miniport data */
59 PVOID xvsd;
60 blkif_shadow_t shadows[MAX_SHADOW_ENTRIES];
61 USHORT shadow_free_list[MAX_SHADOW_ENTRIES];
62 USHORT shadow_free;
63 //USHORT shadow_min_free;
64 ULONG grant_tag;
65 LIST_ENTRY srb_list;
66 BOOLEAN aligned_buffer_in_use;
67 ULONG aligned_buffer_size;
68 PVOID aligned_buffer;
69 } typedef XENVBD_DEVICE_DATA, *PXENVBD_DEVICE_DATA;