win-pvdrivers

changeset 293:279f5623f6c7 wdm 0.9.8

Tweaks to try and improve performance.
author James Harper <james.harper@bendigoit.com.au>
date Sun Jun 08 23:13:44 2008 +1000 (2008-06-08)
parents 43840aae5817
children ad900d2d7507
files common.inc installer.nsi xenvbd/scsiport.c xenvbd/xenvbd.h
line diff
     1.1 --- a/common.inc	Sat Jun 07 22:21:21 2008 +1000
     1.2 +++ b/common.inc	Sun Jun 08 23:13:44 2008 +1000
     1.3 @@ -1,4 +1,4 @@
     1.4 -VERSION=0.9.7.0
     1.5 +VERSION=0.9.8.0
     1.6  TARGETPATH=..\Target\$(DDK_TARGET_OS)
     1.7  MSC_WARNING_LEVEL=/W4
     1.8  INCLUDES = ..\common\include;..\common\include\public
     2.1 --- a/installer.nsi	Sat Jun 07 22:21:21 2008 +1000
     2.2 +++ b/installer.nsi	Sun Jun 08 23:13:44 2008 +1000
     2.3 @@ -3,7 +3,7 @@
     2.4  
     2.5  !define AppName "Xen PV Drivers"
     2.6  !define StartMenu "$SMPROGRAMS\${AppName}"
     2.7 -!define Version "0.9.7"
     2.8 +!define Version "0.9.8"
     2.9  #!define Version "$%VERSION%"
    2.10  Name "${AppName}"
    2.11  InstallDir "$PROGRAMFILES\${AppName}"
     3.1 --- a/xenvbd/scsiport.c	Sat Jun 07 22:21:21 2008 +1000
     3.2 +++ b/xenvbd/scsiport.c	Sun Jun 08 23:13:44 2008 +1000
     3.3 @@ -89,17 +89,18 @@ XenVbd_GetResponse(PXENVBD_DEVICE_DATA x
     3.4    return &xvdd->tmp_rep;
     3.5  }
     3.6  
     3.7 -#if 0
     3.8  static VOID
     3.9  XenVbd_HwScsiTimer(PVOID DeviceExtension)
    3.10  {
    3.11    PXENVBD_DEVICE_DATA xvdd = (PXENVBD_DEVICE_DATA)DeviceExtension;
    3.12  
    3.13 -  KdPrint((__DRIVER_NAME "     shadow_min_free = %d\n", xvdd->shadow_min_free));
    3.14 +  KdPrint((__DRIVER_NAME "     aligned requests   = %I64d, aligned bytes   = %I64d\n", xvdd->aligned_requests, xvdd->aligned_bytes));
    3.15 +  KdPrint((__DRIVER_NAME "     unaligned requests = %I64d, unaligned bytes = %I64d\n", xvdd->unaligned_requests, xvdd->unaligned_bytes));
    3.16 +  KdPrint((__DRIVER_NAME "     interrupts = %I64d\n", xvdd->interrupts));
    3.17 +  KdPrint((__DRIVER_NAME "     no_free_grant_requests = %I64d\n", xvdd->no_free_grant_requests));
    3.18    xvdd->shadow_min_free = xvdd->shadow_free;
    3.19 -  ScsiPortNotification(RequestTimerCall, DeviceExtension, XenVbd_HwScsiTimer, 1 * 1000 * 1000);
    3.20 +  ScsiPortNotification(RequestTimerCall, DeviceExtension, XenVbd_HwScsiTimer, 60 * 1000 * 1000);
    3.21  }
    3.22 -#endif
    3.23  
    3.24  static ULONG
    3.25  XenVbd_HwScsiFindAdapter(PVOID DeviceExtension, PVOID HwContext, PVOID BusInformation, PCHAR ArgumentString, PPORT_CONFIGURATION_INFORMATION ConfigInfo, PBOOLEAN Again)
    3.26 @@ -324,10 +325,7 @@ XenVbd_HwScsiInitialize(PVOID DeviceExte
    3.27    if (notify)
    3.28      xvdd->vectors.EvtChn_Notify(xvdd->vectors.context, xvdd->event_channel);
    3.29  
    3.30 -#if 0
    3.31 -  xvdd->shadow_min_free = xvdd->shadow_free;
    3.32 -  ScsiPortNotification(RequestTimerCall, DeviceExtension, XenVbd_HwScsiTimer, 1 * 1000 * 1000);
    3.33 -#endif
    3.34 +  ScsiPortNotification(RequestTimerCall, DeviceExtension, XenVbd_HwScsiTimer, 60 * 1000 * 1000);
    3.35  
    3.36    KdPrint((__DRIVER_NAME " <-- " __FUNCTION__ "\n"));
    3.37  
    3.38 @@ -369,31 +367,34 @@ XenVbd_PutSrbOnRing(PXENVBD_DEVICE_DATA 
    3.39  
    3.40  //  KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
    3.41  
    3.42 -  if (srb_offset == 0 && xvdd->split_request_in_progress)
    3.43 -  {
    3.44 -    KdPrint((__DRIVER_NAME "     Split request in progress - deferring\n"));
    3.45 -    srb->SrbStatus = SRB_STATUS_BUSY;
    3.46 -    ScsiPortNotification(RequestComplete, xvdd, srb);
    3.47 -    return;
    3.48 -  }
    3.49 +  ASSERT(!(srb_offset == 0 && xvdd->split_request_in_progress));
    3.50    block_count = (srb->Cdb[7] << 8) | srb->Cdb[8];
    3.51    block_count *= xvdd->bytes_per_sector / 512;
    3.52    if (PtrToUlong(srb->DataBuffer) & 511) /* use SrbExtension intead of DataBuffer if DataBuffer is not aligned to sector size */
    3.53    {
    3.54      ptr = GET_PAGE_ALIGNED(srb->SrbExtension);
    3.55      transfer_length = min(block_count * 512 - srb_offset, UNALIGNED_DOUBLE_BUFFER_SIZE);
    3.56 +    if (!srb_offset)
    3.57 +    {
    3.58 +      xvdd->unaligned_requests++;
    3.59 +      xvdd->unaligned_bytes += transfer_length;
    3.60 +    }
    3.61    }
    3.62    else
    3.63    {
    3.64      ptr = srb->DataBuffer;
    3.65      transfer_length = block_count * 512;
    3.66 +    xvdd->aligned_requests++;
    3.67 +    xvdd->aligned_bytes += transfer_length;
    3.68    }
    3.69  
    3.70    if (xvdd->grant_free <= ADDRESS_AND_SIZE_TO_SPAN_PAGES(ptr, transfer_length))
    3.71    {
    3.72 -    KdPrint((__DRIVER_NAME "     No enough grants - deferring\n"));
    3.73 -    srb->SrbStatus = SRB_STATUS_BUSY;
    3.74 -    ScsiPortNotification(RequestComplete, xvdd, srb);
    3.75 +    ASSERT(!xvdd->pending_srb);
    3.76 +    //KdPrint((__DRIVER_NAME "     No enough grants - deferring\n"));
    3.77 +    xvdd->pending_srb = srb;
    3.78 +    xvdd->no_free_grant_requests++;
    3.79 +
    3.80      return;
    3.81    }
    3.82    
    3.83 @@ -451,9 +452,12 @@ XenVbd_PutSrbOnRing(PXENVBD_DEVICE_DATA 
    3.84      xvdd->vectors.EvtChn_Notify(xvdd->vectors.context, xvdd->event_channel);
    3.85  
    3.86    /* we don't want another srb if we had to double buffer this one, it will put things out of order */
    3.87 -  if (xvdd->shadow_free && srb_offset + shadow->length == block_count * 512) // * xvdd->bytes_per_sector )
    3.88 +  if (srb_offset + shadow->length == block_count * 512)
    3.89    {
    3.90 -    ScsiPortNotification(NextLuRequest, xvdd, 0, 0, 0);
    3.91 +    if (xvdd->shadow_free)
    3.92 +    {
    3.93 +      ScsiPortNotification(NextLuRequest, xvdd, 0, 0, 0);
    3.94 +    }
    3.95      xvdd->split_request_in_progress = FALSE;
    3.96    }
    3.97    else
    3.98 @@ -594,6 +598,7 @@ XenVbd_HwScsiInterrupt(PVOID DeviceExten
    3.99  
   3.100    //KdPrint((__DRIVER_NAME " --> " __FUNCTION__ "\n"));
   3.101  
   3.102 +  xvdd->interrupts++;
   3.103    while (more_to_do)
   3.104    {
   3.105      rp = xvdd->ring.sring->rsp_prod;
   3.106 @@ -678,7 +683,6 @@ XenVbd_HwScsiInterrupt(PVOID DeviceExten
   3.107          {
   3.108            put_shadow_on_freelist(xvdd, shadow);
   3.109            ScsiPortNotification(RequestComplete, xvdd, srb);
   3.110 -#if 0
   3.111            if (xvdd->pending_srb)
   3.112            {
   3.113              srb = xvdd->pending_srb;
   3.114 @@ -686,8 +690,7 @@ XenVbd_HwScsiInterrupt(PVOID DeviceExten
   3.115              XenVbd_PutSrbOnRing(xvdd, srb, 0);
   3.116            }
   3.117            else
   3.118 -#endif
   3.119 -          ScsiPortNotification(NextLuRequest, DeviceExtension, 0, 0, 0);
   3.120 +            ScsiPortNotification(NextLuRequest, DeviceExtension, 0, 0, 0);
   3.121          }
   3.122        }
   3.123      }
     4.1 --- a/xenvbd/xenvbd.h	Sat Jun 07 22:21:21 2008 +1000
     4.2 +++ b/xenvbd/xenvbd.h	Sun Jun 08 23:13:44 2008 +1000
     4.3 @@ -80,8 +80,8 @@ typedef struct {
     4.4    ULONG length;
     4.5  } blkif_shadow_t;
     4.6  
     4.7 -#define SHADOW_ENTRIES 32
     4.8 -#define GRANT_ENTRIES 128
     4.9 +#define SHADOW_ENTRIES 16
    4.10 +#define GRANT_ENTRIES ((SHADOW_ENTRIES * BLKIF_MAX_SEGMENTS_PER_REQUEST) / 2)
    4.11  
    4.12  typedef enum {
    4.13    XENVBD_DEVICETYPE_UNKNOWN,
    4.14 @@ -115,8 +115,15 @@ struct
    4.15    ULONG bytes_per_sector;
    4.16    ULONGLONG total_sectors;
    4.17    XENPCI_VECTORS vectors;
    4.18 -  //PSCSI_REQUEST_BLOCK pending_srb;
    4.19 +  PSCSI_REQUEST_BLOCK pending_srb;
    4.20    BOOLEAN split_request_in_progress;
    4.21 +  
    4.22 +  ULONGLONG interrupts;
    4.23 +  ULONGLONG aligned_requests;
    4.24 +  ULONGLONG aligned_bytes;
    4.25 +  ULONGLONG unaligned_requests;
    4.26 +  ULONGLONG unaligned_bytes;
    4.27 +  ULONGLONG no_free_grant_requests;
    4.28  } typedef XENVBD_DEVICE_DATA, *PXENVBD_DEVICE_DATA;
    4.29  
    4.30  VOID