免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3339 | 回复: 0
打印 上一主题 下一主题

[内核同步] sshd占cpu 100%,内核进入lock_timer_base死循环 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2013-07-02 20:20 |只看该作者 |倒序浏览
本帖最后由 tqyou85 于 2013-08-27 09:28 编辑

近期调试中遇到一个问题,板子跑业务的时候会出现cpu挂死的现象,ppc平台,32位系统,表现为
sshd占用cpu到100%,所有的ssh均无法登陆到板子。
查看内核发现其进入死循环:
  1. 7:mon> t
  2. [ef37b9d0] c00644f4 lock_timer_base+0x34/0x70 (unreliable)
  3. [ef37b9f0] c006454c try_to_del_timer_sync+0x1c/0x150
  4. [ef37ba20] c0065c00 del_timer_sync+0x30/0x50
  5. [ef37ba30] c00727dc flush_delayed_work+0x1c/0x90
  6. [ef37ba40] c024b1c4 tty_flush_to_ldisc+0x14/0x30
  7. [ef37ba50] c0244f34 n_tty_poll+0x74/0x1a0
  8. [ef37ba70] c02402f0 tty_poll+0x90/0xc0
  9. [ef37ba90] c010d1e8 do_select+0x2e8/0x5e0
  10. [ef37bda0] c010d68c core_sys_select+0x1ac/0x3f0
  11. [ef37bf00] c010dc88 sys_select+0x38/0x150
  12. [ef37bf40] c00124b0 ret_from_syscall+0x0/0x4
  13. --- Exception: c01 (System Call) at 0fc8c4c0
  14. SP (bfcb3010) is in userspace
  15. 7:mon>
复制代码
进一步调试发现,该timer一直在lock_timer_base中死循环:
  1. static struct tvec_base *lock_timer_base(struct timer_list *timer,
  2.                                         unsigned long *flags)
  3.         __acquires(timer->base->lock)
  4. {
  5.         struct tvec_base *base;

  6.         for (;;) {
  7.                 struct tvec_base *prelock_base = timer->base;
  8.                 base = tbase_get_base(prelock_base);
  9.                 if (likely(base != NULL)) {
  10.                         spin_lock_irqsave(&base->lock, *flags);
  11.                         if (likely(prelock_base == timer->base))
  12.                                 return base;
  13.                         /* The timer has migrated to another CPU */
  14.                         spin_unlock_irqrestore(&base->lock, *flags);
  15.                 }
  16.                 cpu_relax();
  17.         }
  18. }
复制代码
此时base = NULL,导致内核一直在该循环中无法退出。、
通过xmon查到出问题的timer function是:
  1. 7:mon> la c0071b20
  2. c0071b20: delayed_work_timer_fn+0x0/0x50
复制代码
通过struct timer_list结构对照该timer发现,该timer的list_head是00000000 00200200,所以该timer应该是从内核的timer链表中删除了,但是为什么现在还会进入到del_timer_sync的流程呢?


您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP