LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1505|回复: 3

求助:timer问题

[复制链接]
发表于 2007-6-24 19:55:42 | 显示全部楼层 |阅读模式
请教各位:
   编了一个模块,该模块主要作用是利用netfilter框架对某些特定条件的数据包做统计,其中用到定时器:如果一定时间内该类型的数据包没有一个到来就删除相关的统计项,如果有则更新定时器时间。这个检测函数注册在netfilter框架上的HOOK点为IP_PRE_ROUTING,更新定时器的主要代码如下

      write_lock_bh(&abc_lock);
      ......
       /*查找表项 ,获取cbth*/
       /*更新超时时间*/
      //mod_timer(&cbth->tuple.timeout, jiffies+abc_timeout);
      if (del_timer_sync(&cbth->tuple.timeout))
     {
             cbth->tuple.timeout.expires = jiffies+abc_timeout;
             add_timer(&cbth->tuple.timeout);       
      }
     write_unlock_bh(&abc_lock);
       
   其中abc_lock是为了对统计表项同步的读写锁,abc_timeout为超时时间
  模块加载后不久,就会报错如下:

BUG: soft lockup detected on CPU#1!
softlockup_tick+0x8d/0xb2
update_process_times+0x28/0x5e
tick_sched_timer+0x68/0x177
hrtimer_interrupt+0x13e/0x1c9
smp_apic_timer_interrupt+0x54/0x84
smp_call_function_interrupt+0x3c/0x52
apic_timer_interrupt+0x28/0x30
sys_swapon+0x25b/0xa4b
_spin_lock_irqsave+0x16/0x27
lock_timer_base+0x15/0x2f
try_to_del_timer_sync+0xe/0x4f
del_timer_sync+0xe/0x14
......

    使用mod_timer也是一样的情况,只不过错误提示中del_timer_sync的为mod_timer罢了
   请问各位到底怎么回事啊,谢谢!
发表于 2007-6-24 20:47:48 | 显示全部楼层
搜索一下错误信息吧,尤其是 BUG: soft lockup detected on CPU。

另外,这种和内核相关的问题最好提供内核版本号,以及必要的配置信息。
回复 支持 反对

使用道具 举报

发表于 2007-6-24 20:55:42 | 显示全部楼层
void softlockup_tick(void)
{
        int this_cpu = smp_processor_id();
        unsigned long touch_timestamp = per_cpu(touch_timestamp, this_cpu);

        /* prevent double reports: */
        if (per_cpu(print_timestamp, this_cpu) == touch_timestamp ||
                did_panic ||
                        !per_cpu(watchdog_task, this_cpu))
                return;

        /* do not print during early bootup: */
        if (unlikely(system_state != SYSTEM_RUNNING)) {
                touch_softlockup_watchdog();
                return;
        }

        /* Wake up the high-prio watchdog task every second: */
        if (time_after(jiffies, touch_timestamp + HZ))
                wake_up_process(per_cpu(watchdog_task, this_cpu));

        /* Warn about unreasonable 10+ seconds delays: */
        if (time_after(jiffies, touch_timestamp + 10*HZ)) {
                per_cpu(print_timestamp, this_cpu) = touch_timestamp;

                spin_lock(&print_lock);
               printk(KERN_ERR "BUG: soft lockup detected on CPU#%d!\n",
                        this_cpu);

                dump_stack();
                spin_unlock(&print_lock);
        }
}
回复 支持 反对

使用道具 举报

 楼主| 发表于 2007-6-25 14:42:42 | 显示全部楼层
谢谢各位!
问题已解决
回复 支持 反对

使用道具 举报

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

本版积分规则

快速回复 返回顶部 返回列表