- 論壇徽章:
- 0
|
最近在折騰一塊老板子,修改其bsp使其支持clock event & clock src, 但是在timekeeping卡住了,
時鐘中斷會在update_wall_time里面, 更新墻上時間,其中
/**
752 * update_wall_time - Uses the current clocksource to increment the wall time
753 *
754 * Called from the timer interrupt, must hold a write on xtime_lock.
755 */
756 void update_wall_time(void)
757 {
758 struct clocksource *clock;
759 cycle_t offset;
760 u64 nsecs;
761
762 /* Make sure we're fully resumed: */
763 if (unlikely(timekeeping_suspended))
764 return;
765
766 clock = timekeeper.clock;
767 #ifdef CONFIG_GENERIC_TIME
768 offset = (clock->read(clock) - clock->cycle_last) & clock->mask;
769 #else
770 offset = timekeeper.cycle_interval;
771 #endif
772 timekeeper.xtime_nsec = (s64)xtime.tv_nsec << timekeeper.shift;
773
774 /* normally this loop will run just once, however in the
775 * case of lost or late ticks, it will accumulate correctly.
776 */
777 while (offset >= timekeeper.cycle_interval) {
778 u64 nsecps = (u64)NSEC_PER_SEC << timekeeper.shift;
779
其中標紅的一句我無法理解, 按照道理應該是統(tǒng)計兩次中斷間已走過的ticks來決定更新多少xtime, 但是拿去和cycle_last這個累積值減的卻是當前時鐘計數(shù)器的值,這個結(jié)果有什么意義,完全無法理解。。。。 |
|