向各位请教:BUG: scheduling while atomic: swapper/1/0x00010004

xuluqxulu 2011-01-10 06:24:08
各位大侠,小弟我碰到难题了,我的内核版本是2.6.31.14,我在disable内核中的两个config项就出问题了。
CONFIG_USB_SERIAL is not set
CONFIG_USB_SERIAL_GENERIC is not set
相关的log如下所示:

hub 2-0:1.0: USB hub found
hub 2-0:1.0: 1 port detected
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
ARC USBOTG Device Controller driver (1 August 2005)
mice: could not register psaux device, error: -16
mice: PS/2 mouse device common for all mice
MXC keypad loaded
clk: Unable to get requested clock: kpp_clk
BUG: scheduling while atomic: swapper/1/0x00010004
Modules linked in:

Pid: 1, comm: swapper
CPU: 0 Not tainted (2.6.31.14-01061-gde93852-dirty #72)
PC is at vprintk+0x328/0x3a0
LR is at vprintk+0x320/0x3a0
pc : [<c0063438>] lr : [<c0063430>] psr: 60000013
sp : d9025e48 ip : c0725a4f fp : 00000032
r10: c0727648 r9 : 0000003c r8 : 00000000
r7 : 00000000 r6 : c0739e8c r5 : 00000001 r4 : c06ecce4
r3 : 60000013 r2 : c06eda14 r1 : 00002444 r0 : c06eda54
Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment kernel
Control: 10c5387d Table: 90004019 DAC: 00000017
[<c003a504>] (unwind_backtrace+0x0/0xd4) from [<c0401ff8>] (schedule+0x68/0x364)
NOHZ: local_softirq_pending 102
BUG: scheduling while atomic: swapper/0/0x00000002
Modules linked in:

Pid: 0, comm: swapper
CPU: 0 Not tainted (2.6.31.14-01061-gde93852-dirty #72)
PC is at vprintk+0x328/0x3a0
LR is at vprintk+0x320/0x3a0
pc : [<c0063438>] lr : [<c0063430>] psr: 60000013
sp : d9025e48 ip : c0725a4f fp : 00000032
r10: c0727648 r9 : 0000003c r8 : 00000000
r7 : 00000000 r6 : c0739e8c r5 : 00000001 r4 : c06ecce4
r3 : 60000013 r2 : c06eda14 r1 : 00002444 r0 : c06eda54
Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment kernel
Control: 10c5387d Table: 90004019 DAC: 00000017
[<c003a504>] (unwind_backtrace+0x0/0xd4) from [<c0401ff8>] (schedule+0x68/0x364)
bad: scheduling from the idle thread!
[<c003a504>] (unwind_backtrace+0x0/0xd4) from [<c005e470>] (dequeue_task_idle+0x44/0x5c)
BUG: scheduling while atomic: swapper/0/0x00000002
Modules linked in:

后面重复的我就省略了.
我查了下kernel code.上面的log 是由下面的代码打印出来的:
if (unlikely(in_atomic_preempt_off() && !prev->exit_state))
__schedule_bug(prev);

static noinline void __schedule_bug(struct task_struct *prev)
{
struct pt_regs *regs = get_irq_regs();

printk(KERN_ERR "BUG: scheduling while atomic: %s/%d/0x%08x\n",
prev->comm, prev->pid, preempt_count());

debug_show_held_locks(prev);
print_modules();
if (irqs_disabled())
print_irqtrace_events(prev);

if (regs)
show_regs(regs);
//else
dump_stack();
}

“Scheduling while atomic" 一般是尝试sleep在有锁保护的临界区,或者中断中,从而造成非法的schedule。
但是这里的dump_statch给出的相关信息太少,我的kernel debug由于某种原因无法打开,无法看到lockdep的信息,无法看到关联的代码,不知道是有什么引起的。
我实在想不出我去掉的usb serial driver和这个有什么关系?更加奇怪的是如果我插上我的usb otg 到PC上,再启动系统的话,就不会出现这个错误。
大侠们,帮帮忙吧,帮我分析分析原因,或者有什么好的debug方法。
我很困惑,很无助。先谢谢了。
...全文
2860 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
海枫 2011-01-11
  • 打赏
  • 举报
回复
[Quote=引用楼主 xuluqxulu 的回复:]
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 1 port detected
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
ARC USBOTG Device Controller driver (1 August 2005)
mice: could not register psaux device, error: -16
mice: PS/2 mouse device common for all mice
MXC keypad loaded
clk: Unable to get requested clock: kpp_clk
BUG: scheduling while atomic: swapper/1/0x00010004
Modules linked in:
[/Quote]

查查下面这两行log,为什么出错了:

mice: could not register psaux device, error: -16
mice: PS/2 mouse device common for all mice

xuluqxulu 2011-01-11
  • 打赏
  • 举报
回复
呵呵,没有人回复亚,我自己先顶顶。坐等各位的指导。
xuluqxulu 2011-01-11
  • 打赏
  • 举报
回复
从dump_stack打出信息来看,是0号进程init出了问题.
没有什么可用的stack信息
个人感觉和硬件关系蛮大,如果我插上我的USB到PC,就不会有这个问题。
希望大家多给建议。
xuluqxulu 2011-01-11
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 wenxy1 的回复:]
配置内核选项不对, 强烈建议不要手工去改.config文件, 用make menuconfig去配置.

另外,改内核代码,我习惯用svn做版本控制,直接在本机安装一个SVN 服务器.
[/Quote]
谢谢大侠的回复
大侠是如何看出这个是内核选项配置不对引起的,先申明一下:我用的是make menuconfig 配置内核,使用git 来管理代码。
Wenxy1 2011-01-11
  • 打赏
  • 举报
回复
配置内核选项不对, 强烈建议不要手工去改.config文件, 用make menuconfig去配置.

另外,改内核代码,我习惯用svn做版本控制,直接在本机安装一个SVN 服务器.
xuluqxulu 2011-01-11
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 linyt 的回复:]

引用楼主 xuluqxulu 的回复:
hub 2-0:1.0: USB hub found
hub 2-0:1.0: 1 port detected
Initializing USB Mass Storage driver...
usbcore: registered new interface driver usb-storage
USB Mass Storage support ……
[/Quote]
谢谢林兄的指导,那个mice的错误是一直都有的,和这个BUG没有关系

4,469

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 内核源代码研究区
社区管理员
  • 内核源代码研究区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧