Changeset 2373 in vbox for trunk/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c
- Timestamp:
- Apr 26, 2007 10:13:38 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c
r2242 r2373 1404 1404 pGip = pDevExt->pGip; 1405 1405 ulNow = jiffies; 1406 ulDiff = ulNow - pDevExt->ulLastJiffies; 1407 1408 pDevExt->ulLastJiffies = ulNow; 1406 1407 #ifdef CONFIG_SMP 1408 if (pGip && pGip->u32Mode == SUPGIPMODE_ASYNC_TSC) 1409 { 1410 uint8_t iCPU = ASMGetApicId(); 1411 ulDiff = ulNow - pDevExt->aCPUs[iCPU].ulLastJiffies; 1412 pDevExt->aCPUs[iCPU].ulLastJiffies = ulNow; 1409 1413 #ifdef TICK_NSEC 1410 u64Monotime = pDevExt->u64LastMonotime + ulDiff * TICK_NSEC;1414 u64Monotime = pDevExt->aCPUs[iCPU].u64LastMonotime + ulDiff * TICK_NSEC; 1411 1415 #else 1412 u64Monotime = pDevExt->u64LastMonotime + ulDiff * (1000000 / HZ); 1413 #endif 1414 ASMAtomicXchgU64(&pDevExt->u64LastMonotime, u64Monotime); 1416 u64Monotime = pDevExt->aCPUs[iCPU].u64LastMonotime + ulDiff * (1000000 / HZ); 1417 #endif 1418 pDevExt->aCPUs[iCPU].u64LastMonotime = u64Monotime; 1419 } 1420 else 1421 #endif /* CONFIG_SMP */ 1422 { 1423 ulDiff = ulNow - pDevExt->ulLastJiffies; 1424 pDevExt->ulLastJiffies = ulNow; 1425 #ifdef TICK_NSEC 1426 u64Monotime = pDevExt->u64LastMonotime + ulDiff * TICK_NSEC; 1427 #else 1428 u64Monotime = pDevExt->u64LastMonotime + ulDiff * (1000000 / HZ); 1429 #endif 1430 pDevExt->u64LastMonotime = u64Monotime; 1431 } 1415 1432 if (RT_LIKELY(pGip)) 1416 1433 supdrvGipUpdate(pDevExt->pGip, u64Monotime); 1417 mod_timer(&g_GipTimer, jiffies + (HZ <= 1000 ? 0 : ONE_MSEC_IN_JIFFIES)); 1434 if (RT_LIKELY(!pDevExt->fGIPSuspended)) 1435 mod_timer(&g_GipTimer, ulNow + (HZ <= 1000 ? 0 : ONE_MSEC_IN_JIFFIES)); 1418 1436 1419 1437 local_irq_restore(SavedFlags); … … 1425 1443 * Timer callback function for the other CPUs. 1426 1444 * 1427 * @param i LnxCPU The APIC ID of this timer.1428 */ 1429 static void VBoxSupGipTimerPerCpu(unsigned long i LnxCPU)1445 * @param iTimerCPU The APIC ID of this timer. 1446 */ 1447 static void VBoxSupGipTimerPerCpu(unsigned long iTimerCPU) 1430 1448 { 1431 1449 PSUPDRVDEVEXT pDevExt; … … 1443 1461 if (RT_LIKELY(iCPU < RT_ELEMENTS(pGip->aCPUs))) 1444 1462 { 1445 if (RT_LIKELY(i CPU == iLnxCPU))1463 if (RT_LIKELY(iTimerCPU == iCPU)) 1446 1464 { 1447 1465 unsigned long ulNow = jiffies; 1448 unsigned long ulDiff = ulNow - pDevExt->aCPUs[iLnxCPU].ulLastJiffies; 1449 1450 pDevExt->aCPUs[iLnxCPU].ulLastJiffies = ulNow; 1466 unsigned long ulDiff = ulNow - pDevExt->aCPUs[iCPU].ulLastJiffies; 1467 pDevExt->aCPUs[iCPU].ulLastJiffies = ulNow; 1451 1468 #ifdef TICK_NSEC 1452 1469 u64Monotime = pDevExt->aCPUs[iCPU].u64LastMonotime + ulDiff * TICK_NSEC; … … 1454 1471 u64Monotime = pDevExt->aCPUs[iCPU].u64LastMonotime + ulDiff * (1000000 / HZ); 1455 1472 #endif 1456 ASMAtomicXchgU64(&pDevExt->aCPUs[iCPU].u64LastMonotime, u64Monotime);1473 pDevExt->aCPUs[iCPU].u64LastMonotime = u64Monotime; 1457 1474 if (RT_LIKELY(pGip)) 1458 1475 supdrvGipUpdatePerCpu(pGip, u64Monotime, iCPU); 1459 mod_timer(&pDevExt->aCPUs[iCPU].Timer, jiffies + (HZ <= 1000 ? 0 : ONE_MSEC_IN_JIFFIES)); 1476 if (RT_LIKELY(!pDevExt->fGIPSuspended)) 1477 mod_timer(&pDevExt->aCPUs[iCPU].Timer, ulNow + (HZ <= 1000 ? 0 : ONE_MSEC_IN_JIFFIES)); 1460 1478 } 1461 1479 else 1462 printk("vboxdrv: error: GIP CPU update timer executing on the wrong CPU: apicid=%d != timer-apicid=%ld (cpuid=%d != timer-cpuid=%d)\n",1463 iCPU, i LnxCPU, smp_processor_id(), pDevExt->aCPUs[iLnxCPU].iSmpProcessorId);1480 printk("vboxdrv: error: GIP CPU update timer executing on the wrong CPU: apicid=%d != timer-apicid=%ld (cpuid=%d !=? timer-cpuid=%d)\n", 1481 iCPU, iTimerCPU, smp_processor_id(), pDevExt->aCPUs[iTimerCPU].iSmpProcessorId); 1464 1482 } 1465 1483 else … … 1577 1595 { 1578 1596 dprintf2(("supdrvOSGipResume:\n")); 1597 ASMAtomicXchgU8(&pDevExt->fGIPSuspended, false); 1579 1598 #ifdef CONFIG_SMP 1580 1599 if (pDevExt->pGip->u32Mode != SUPGIPMODE_ASYNC_TSC) … … 1628 1647 #endif 1629 1648 dprintf2(("supdrvOSGipSuspend:\n")); 1649 ASMAtomicXchgU8(&pDevExt->fGIPSuspended, true); 1630 1650 1631 1651 if (timer_pending(&g_GipTimer))
Note:
See TracChangeset
for help on using the changeset viewer.