win-pvdrivers
changeset 1063:fe04dbceb0b2
Tidy up highsync code. Remove KdPrint calls.
author | James Harper <james.harper@bendigoit.com.au> |
---|---|
date | Thu Oct 03 18:10:21 2013 +1000 (2013-10-03) |
parents | 5775fb8612ab |
children | 1d6eae98e552 |
files | xenpci/xenpci_highsync.c |
line diff
1.1 --- a/xenpci/xenpci_highsync.c Tue Oct 01 18:47:25 2013 +1000 1.2 +++ b/xenpci/xenpci_highsync.c Thu Oct 03 18:10:21 2013 +1000 1.3 @@ -44,12 +44,7 @@ struct { 1.4 } typedef highsync_info_t; 1.5 1.6 static VOID 1.7 -XenPci_HighSyncCallFunction0( 1.8 - PRKDPC Dpc, 1.9 - PVOID Context, 1.10 - PVOID SystemArgument1, 1.11 - PVOID SystemArgument2) 1.12 -{ 1.13 +XenPci_HighSyncCallFunction0(PRKDPC Dpc, PVOID Context, PVOID SystemArgument1, PVOID SystemArgument2) { 1.14 highsync_info_t *highsync_info = Context; 1.15 ULONG ActiveProcessorCount; 1.16 KIRQL old_irql; 1.17 @@ -65,18 +60,15 @@ XenPci_HighSyncCallFunction0( 1.18 ActiveProcessorCount = (ULONG)*KeNumberProcessors; 1.19 #endif 1.20 InterlockedIncrement(&highsync_info->nr_procs_at_dispatch_level); 1.21 - if (highsync_info->sync_level > DISPATCH_LEVEL) 1.22 - { 1.23 - while (highsync_info->nr_procs_at_dispatch_level < (LONG)ActiveProcessorCount) 1.24 - { 1.25 + if (highsync_info->sync_level > DISPATCH_LEVEL) { 1.26 + while (highsync_info->nr_procs_at_dispatch_level < (LONG)ActiveProcessorCount) { 1.27 KeStallExecutionProcessor(1); 1.28 KeMemoryBarrier(); 1.29 } 1.30 } 1.31 _disable(); //__asm cli; 1.32 KeRaiseIrql(highsync_info->sync_level, &old_irql); 1.33 - while (highsync_info->nr_spinning_at_sync_level < (LONG)ActiveProcessorCount - 1) 1.34 - { 1.35 + while (highsync_info->nr_spinning_at_sync_level < (LONG)ActiveProcessorCount - 1) { 1.36 KeStallExecutionProcessor(1); 1.37 KeMemoryBarrier(); 1.38 } 1.39 @@ -86,15 +78,13 @@ XenPci_HighSyncCallFunction0( 1.40 highsync_info->do_spin = FALSE; 1.41 KeMemoryBarrier(); 1.42 /* wait for all the other processors to complete spinning, just in case it matters */ 1.43 - while (highsync_info->nr_spinning_at_sync_level) 1.44 - { 1.45 + while (highsync_info->nr_spinning_at_sync_level) { 1.46 KeStallExecutionProcessor(1); 1.47 KeMemoryBarrier(); 1.48 } 1.49 InterlockedDecrement(&highsync_info->nr_procs_at_dispatch_level); 1.50 /* wait until nr_procs_at_dispatch_level drops to 0 indicating that nothing else requires highsync_info */ 1.51 - while (highsync_info->nr_procs_at_dispatch_level) 1.52 - { 1.53 + while (highsync_info->nr_procs_at_dispatch_level) { 1.54 KeStallExecutionProcessor(1); 1.55 KeMemoryBarrier(); 1.56 } 1.57 @@ -104,12 +94,7 @@ XenPci_HighSyncCallFunction0( 1.58 } 1.59 1.60 static VOID 1.61 -XenPci_HighSyncCallFunctionN( 1.62 - PRKDPC Dpc, 1.63 - PVOID Context, 1.64 - PVOID SystemArgument1, 1.65 - PVOID SystemArgument2) 1.66 -{ 1.67 +XenPci_HighSyncCallFunctionN(PRKDPC Dpc, PVOID Context, PVOID SystemArgument1, PVOID SystemArgument2) { 1.68 highsync_info_t *highsync_info = Context; 1.69 ULONG ActiveProcessorCount; 1.70 KIRQL old_irql; 1.71 @@ -121,17 +106,15 @@ XenPci_HighSyncCallFunctionN( 1.72 FUNCTION_ENTER(); 1.73 FUNCTION_MSG("(CPU = %d)\n", KeGetCurrentProcessorNumber()); 1.74 1.75 - KdPrint((__DRIVER_NAME " CPU %d spinning...\n", KeGetCurrentProcessorNumber())); 1.76 + FUNCTION_MSG("CPU %d spinning...\n", KeGetCurrentProcessorNumber()); 1.77 InterlockedIncrement(&highsync_info->nr_procs_at_dispatch_level); 1.78 - if (highsync_info->sync_level > DISPATCH_LEVEL) 1.79 - { 1.80 + if (highsync_info->sync_level > DISPATCH_LEVEL) { 1.81 #if (NTDDI_VERSION >= NTDDI_WINXP) 1.82 ActiveProcessorCount = (ULONG)KeNumberProcessors; 1.83 #else 1.84 ActiveProcessorCount = (ULONG)*KeNumberProcessors; 1.85 #endif 1.86 - while (highsync_info->nr_procs_at_dispatch_level < (LONG)ActiveProcessorCount) 1.87 - { 1.88 + while (highsync_info->nr_procs_at_dispatch_level < (LONG)ActiveProcessorCount) { 1.89 KeStallExecutionProcessor(1); 1.90 KeMemoryBarrier(); 1.91 } 1.92 @@ -139,8 +122,7 @@ XenPci_HighSyncCallFunctionN( 1.93 _disable(); //__asm cli; 1.94 KeRaiseIrql(highsync_info->sync_level, &old_irql); 1.95 InterlockedIncrement(&highsync_info->nr_spinning_at_sync_level); 1.96 - while(highsync_info->do_spin) 1.97 - { 1.98 + while(highsync_info->do_spin) { 1.99 KeStallExecutionProcessor(1); 1.100 KeMemoryBarrier(); 1.101 } 1.102 @@ -154,8 +136,7 @@ XenPci_HighSyncCallFunctionN( 1.103 } 1.104 1.105 VOID 1.106 -XenPci_HighSync(PXENPCI_HIGHSYNC_FUNCTION function0, PXENPCI_HIGHSYNC_FUNCTION functionN, PVOID context) 1.107 -{ 1.108 +XenPci_HighSync(PXENPCI_HIGHSYNC_FUNCTION function0, PXENPCI_HIGHSYNC_FUNCTION functionN, PVOID context) { 1.109 ULONG ActiveProcessorCount; 1.110 ULONG i; 1.111 highsync_info_t *highsync_info; 1.112 @@ -171,7 +152,7 @@ XenPci_HighSync(PXENPCI_HIGHSYNC_FUNCTIO 1.113 highsync_info->functionN = functionN; 1.114 highsync_info->context = context; 1.115 highsync_info->sync_level = HIGH_LEVEL; 1.116 - 1.117 + 1.118 #if (NTDDI_VERSION >= NTDDI_WINXP) 1.119 ActiveProcessorCount = (ULONG)KeNumberProcessors; 1.120 #else 1.121 @@ -182,23 +163,22 @@ XenPci_HighSync(PXENPCI_HIGHSYNC_FUNCTIO 1.122 KeRaiseIrql(highsync_info->sync_level, &old_irql); 1.123 1.124 highsync_info->do_spin = TRUE; 1.125 - for (i = 0; i < ActiveProcessorCount; i++) 1.126 - { 1.127 + for (i = 0; i < ActiveProcessorCount; i++) { 1.128 if (i == 0) 1.129 KeInitializeDpc(&highsync_info->dpcs[i], XenPci_HighSyncCallFunction0, highsync_info); 1.130 else 1.131 KeInitializeDpc(&highsync_info->dpcs[i], XenPci_HighSyncCallFunctionN, highsync_info); 1.132 KeSetTargetProcessorDpc(&highsync_info->dpcs[i], (CCHAR)i); 1.133 KeSetImportanceDpc(&highsync_info->dpcs[i], HighImportance); 1.134 - KdPrint((__DRIVER_NAME " queuing Dpc for CPU %d\n", i)); 1.135 + FUNCTION_MSG("queuing Dpc for CPU %d\n", i); 1.136 KeInsertQueueDpc(&highsync_info->dpcs[i], NULL, NULL); 1.137 } 1.138 - KdPrint((__DRIVER_NAME " All Dpc's queued\n")); 1.139 + FUNCTION_MSG("All Dpc's queued\n"); 1.140 1.141 KeMemoryBarrier(); 1.142 KeLowerIrql(old_irql); 1.143 1.144 - KdPrint((__DRIVER_NAME " Waiting for highsync_complete_event\n")); 1.145 + FUNCTION_MSG("Waiting for highsync_complete_event\n"); 1.146 KeWaitForSingleObject(&highsync_info->highsync_complete_event, Executive, KernelMode, FALSE, NULL); 1.147 #if (NTDDI_VERSION >= NTDDI_WINXP) 1.148 KeFlushQueuedDpcs();