win-pvdrivers

changeset 455:f9afef4ddf23

Fixed a problem where a crash dump would fail if a page was still in use by the backend.
This could have caused corruption issues under extreme Dom0 load.
author James Harper <james.harper@bendigoit.com.au>
date Wed Nov 19 22:54:57 2008 +1100 (2008-11-19)
parents 5e3e348cd101
children 07d3ead8c502
files xenvbd/xenvbd.c
line diff
     1.1 --- a/xenvbd/xenvbd.c	Tue Nov 18 20:46:47 2008 +1100
     1.2 +++ b/xenvbd/xenvbd.c	Wed Nov 19 22:54:57 2008 +1100
     1.3 @@ -231,8 +231,25 @@ XenVbd_InitFromConfig(PXENVBD_DEVICE_DAT
     1.4      case XEN_INIT_TYPE_GRANT_ENTRIES:
     1.5        KdPrint((__DRIVER_NAME "     XEN_INIT_TYPE_GRANT_ENTRIES - %d\n", PtrToUlong(setting)));
     1.6        xvdd->grant_entries = (USHORT)PtrToUlong(setting);
     1.7 -      memcpy(&xvdd->grant_free_list, value, sizeof(grant_ref_t) * xvdd->grant_entries);
     1.8 -      xvdd->grant_free = xvdd->grant_entries;
     1.9 +      if (dump_mode)
    1.10 +      {
    1.11 +        /* check each grant entry first to make sure it isn't in use already */
    1.12 +        grant_ref_t *gref = (grant_ref_t *)value;
    1.13 +        xvdd->grant_free = 0;
    1.14 +        for (i = 0; i < xvdd->grant_entries; i++)
    1.15 +        {
    1.16 +          if (xvdd->vectors.GntTbl_EndAccess(xvdd->vectors.context, *gref, TRUE))
    1.17 +          {
    1.18 +            put_grant_on_freelist(xvdd, *gref);
    1.19 +          }
    1.20 +          gref++;
    1.21 +        }
    1.22 +      }
    1.23 +      else
    1.24 +      {
    1.25 +        memcpy(&xvdd->grant_free_list, value, sizeof(grant_ref_t) * xvdd->grant_entries);
    1.26 +        xvdd->grant_free = xvdd->grant_entries;
    1.27 +      }
    1.28        break;
    1.29      case XEN_INIT_TYPE_STATE_PTR:
    1.30        KdPrint((__DRIVER_NAME "     XEN_INIT_TYPE_DEVICE_STATE - %p\n", PtrToUlong(value)));
    1.31 @@ -818,14 +835,7 @@ XenVbd_HwScsiInterrupt(PVOID DeviceExten
    1.32      return FALSE;
    1.33    }
    1.34  
    1.35 -  if (dump_mode)
    1.36 -  {
    1.37 -    KdPrint((__DRIVER_NAME "     dump_mode interrupt\n"));
    1.38 -    KdPrint((__DRIVER_NAME "     req_prod_pvt = %d\n", xvdd->ring.req_prod_pvt));
    1.39 -    KdPrint((__DRIVER_NAME "     rsp_prod = %d\n", xvdd->ring.sring->rsp_prod));
    1.40 -    KdPrint((__DRIVER_NAME "     rsp_cons = %d\n", xvdd->ring.rsp_cons));
    1.41 -  }
    1.42 -  else if (!(stat_interrupts_for_me & 0xFFFF))
    1.43 +  if (!dump_mode && !(stat_interrupts_for_me & 0xFFFF))
    1.44      XenVbd_DumpStats();
    1.45      
    1.46    while (more_to_do)