win-pvdrivers

changeset 902:44029b09876a

Flush DPC's before freeing highsync_info memory
author James Harper <james.harper@bendigoit.com.au>
date Fri Apr 01 16:02:17 2011 +1100 (2011-04-01)
parents 70738d39e3cc
children 2e4f05dd4dfe
files xenpci/xenpci_highsync.c
line diff
     1.1 --- a/xenpci/xenpci_highsync.c	Fri Apr 01 11:35:29 2011 +1100
     1.2 +++ b/xenpci/xenpci_highsync.c	Fri Apr 01 16:02:17 2011 +1100
     1.3 @@ -93,7 +93,7 @@ XenPci_HighSyncCallFunction0(
     1.4    }
     1.5    InterlockedDecrement(&highsync_info->nr_procs_at_dispatch_level);
     1.6    /* wait until nr_procs_at_dispatch_level drops to 0 indicating that nothing else requires highsync_info */
     1.7 -  while (highsync_info->nr_spinning_at_dispatch_level)
     1.8 +  while (highsync_info->nr_procs_at_dispatch_level)
     1.9    {
    1.10      KeStallExecutionProcessor(1);
    1.11      KeMemoryBarrier();
    1.12 @@ -200,6 +200,16 @@ XenPci_HighSync(PXENPCI_HIGHSYNC_FUNCTIO
    1.13  
    1.14    KdPrint((__DRIVER_NAME "     Waiting for highsync_complete_event\n"));
    1.15    KeWaitForSingleObject(&highsync_info->highsync_complete_event, Executive, KernelMode, FALSE, NULL);
    1.16 +#if (NTDDI_VERSION >= NTDDI_WINXP)
    1.17 +  KeFlushQueuedDpcs();
    1.18 +#else
    1.19 +  {
    1.20 +    /* just wait 1 second until all DPC's finish - not ideal but it's only for W2K */
    1.21 +    LARGE_INTEGER interval;
    1.22 +    interval.QuadPart = -1 * 1000 * 1000 * 10; /* 1 second */
    1.23 +    KeDelayExecutionThread(KernelMode, FALSE, &interval);
    1.24 +  }
    1.25 +#endif
    1.26    ExFreePoolWithTag(highsync_info, XENPCI_POOL_TAG);
    1.27    FUNCTION_EXIT();
    1.28  }