About the Behavior of "z_clock_announce" in SMP?

"曹子龙
 

Hi  folks:
    
  a puzzle in the timer tick interrupt handler in SMP mode.  look at below,  the SMP mult cores share the same "cur_tick" object to remeber the current time, each cpu would increment it when the tick hander  excutes on each CPU.
so, could this would accelerate the timer compare with the realworld?  for example, if 4cores  exist, the cur_tick would 4 times incmrent than the read world, i cant fingure out where am a wrong, so, could you figure me out?  thanks for your kinldy supply. 

void z_clock_announce(s32_t ticks)
{
#ifdef CONFIG_TIMESLICING
 z_time_slice(ticks);
#endif

 k_spinlock_key_t key = k_spin_lock(&timeout_lock);

 announce_remaining = ticks;

 while (first() != NULL && first()->dticks <= announce_remaining) {
  struct _timeout *t = first();
  int dt = t->dticks;

  curr_tick += dt;
  announce_remaining -= dt;
  t->dticks = 0;
  remove_timeout(t);

  k_spin_unlock(&timeout_lock, key);
  t->fn(t);
  key = k_spin_lock(&timeout_lock);
 }

 if (first() != NULL) {
  first()->dticks -= announce_remaining;
 }

 curr_tick += announce_remaining;
 announce_remaining = 0;

 z_clock_set_timeout(next_timeout(), false);

 k_spin_unlock(&timeout_lock, key);
}


曹子龙

珠海全志科技股份有限公司      BU1-PSW

地址:广东省珠海市高新区唐家湾镇科技2路9号

TEL:13824125580

Email:caozilong@...

网址: http://www.allwinnertech.com

 


Join devel@lists.zephyrproject.org to automatically receive all group messages.