{"id":810,"date":"2011-03-19T14:08:28","date_gmt":"2011-03-19T06:08:28","guid":{"rendered":"http:\/\/kaoru.tech\/archives\/810"},"modified":"2011-03-19T22:17:02","modified_gmt":"2011-03-19T14:17:02","slug":"bug-fixed%ef%bc%9a%e4%b8%ad%e6%96%ad%e4%b8%8a%e4%b8%8b%e6%96%87%e7%94%b3%e8%af%b7%e5%86%85%e5%ad%98","status":"publish","type":"post","link":"http:\/\/kaoru.tech:7000\/wordpress\/?p=810","title":{"rendered":"BUG Fixed\uff1a\u4e2d\u65ad\u4e0a\u4e0b\u6587\u7533\u8bf7\u5185\u5b58"},"content":{"rendered":"<p>\u4eca\u5929\u5ba2\u6237\u53cd\u5e94\u6211\u4eec\u7684\u9a71\u52a8\u5728\u8fd0\u884c\u4e2d\u8fd8\u662f\u4f1aOops\uff0c\u5947\u602a\u4e86\u3002\u56e0\u4e3a\u8fd9\u4e2a\u9a71\u52a8\u6211\u4eec\u4e4b\u524d\u662f\u5728\u6211\u4eec\u81ea\u5df1\u7684\u4e00\u4e2a\u677f\u5b50\u4e0a\u505a\u7684\uff0c\u7a33\u5b9a\u6027\u4e4b\u7c7b\u7684\u5df2\u7ecf\u9a8c\u8bc1\u8fc7\u4e86\uff0c\u867d\u7136\u73b0\u5728\u7684\u8fd0\u884c\u73af\u5883\u4e0d\u662f\u6211\u4eec\u81ea\u5df1\u7684\u7248\u672c\uff0c\u65e2\u7136\u9a71\u52a8\u6b63\u5e38\u52a0\u8f7d\uff0c\u600e\u4e48\u8fd8\u4f1a\u51fa\u95ee\u9898\u5462\u3002<\/p>\n<p>\u4e0b\u9762\u7684\u662fOops\u4fe1\u606f\uff1a<\/p>\n<blockquote>\n<p>BUG: scheduling while atomic: swapper\/0\/0x40010100      <br \/>Modules linked in: drv <\/p>\n<p>Pid: 0, comm:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; swapper      <br \/>CPU: 0&#160;&#160;&#160; Not tainted&#160; (2.6.33.5 #19)       <br \/>PC is at __rcu_process_callbacks+0x68\/0x3a0       <br \/>LR is at __rcu_process_callbacks+0x68\/0x3a0       <br \/>pc : [&lt;c0065820&gt;]&#160;&#160;&#160; lr : [&lt;c0065820&gt;]&#160;&#160;&#160; psr: a0000013       <br \/>sp : c02c3eb0&#160; ip : c02c3eb0&#160; fp : c02c3ed8       <br \/>r10: c02e2660&#160; r9 : 0000000a&#160; r8 : c02cd5c8       <br \/>r7 : 00000001&#160; r6 : 00000024&#160; r5 : c02cd708&#160; r4 : c02cd5c8       <br \/>r3 : 00000002&#160; r2 : c02c2000&#160; r1 : a0000013&#160; r0 : c02cd5c8       <br \/>Flags: NzCv&#160; IRQs on&#160; FIQs on&#160; Mode SVC_32&#160; ISA ARM&#160; Segment kernel       <br \/>Control: 0005317f&#160; Table: 21edc000&#160; DAC: 00000017       <br \/>[&lt;c0027de4&gt;] (show_regs+0x0\/0x4c) from [&lt;c0038678&gt;] (__schedule_bug+0x48\/0x5c)       <br \/>r4:c02c3e68       <br \/>[&lt;c0038630&gt;] (__schedule_bug+0x0\/0x5c) from [&lt;c022b964&gt;] (schedule+0x4c\/0x2bc)       <br \/>r4:c02c2000       <br \/>[&lt;c022b918&gt;] (schedule+0x0\/0x2bc) from [&lt;c00386b0&gt;] (__cond_resched+0x24\/0x34)       <br \/>[&lt;c003868c&gt;] (__cond_resched+0x0\/0x34) from [&lt;c022bc68&gt;] (_cond_resched+0x30\/0x40)       <br \/>r4:c1d8e180       <br \/>[&lt;c022bc38&gt;] (_cond_resched+0x0\/0x40) from [&lt;c0086890&gt;] (__kmalloc+0x5c\/0xe0)       <br \/>[&lt;c0086834&gt;] (__kmalloc+0x0\/0xe0) from [&lt;bf000130&gt;] (init_rx_dma+0x1c\/0x98 [drv])       <br \/>r7:00000000 r6:00000012 r5:c1d8e180 r4:c1d8e180       <br \/>[&lt;c0062684&gt;] (handle_IRQ_event+0x0\/0x114) from [&lt;c00649c8&gt;] (handle_level_irq+0xf0\/0x10c)       <br \/>r8:c02cd5c8 r7:00000001 r6:00000017 r5:00000017 r4:c02ca028       <br \/>[&lt;c00648d8&gt;] (handle_level_irq+0x0\/0x10c) from [&lt;c0026074&gt;] (asm_do_IRQ+0x74\/0xa0)       <br \/>r5:c02c3f50 r4:00000017       <br \/>[&lt;c0026000&gt;] (asm_do_IRQ+0x0\/0xa0) from [&lt;c0026a68&gt;] (__irq_svc+0x28\/0x60)<\/p>\n<\/blockquote>\n<p>\u5148google\u4e0b\u5427\uff0c\u5173\u952e\u5b57&quot;BUG: scheduling while atomic&quot;\uff0c\u5728<a href=\"http:\/\/www.lslnet.com\/linux\/dosc1\/29\/linux-235984.htm\" target=\"_blank\">\u8fd9\u91cc<\/a>\u627e\u5230\u7684\u7b54\u6848\u3002\u539f\u6765malloc\u5185\u5b58\u65f6\uff0c\u53c2\u6570GFP_KERNEL\u662f\u53ef\u80fd\u4f1a\u963b\u585e\u7684\uff0c\u6240\u4ee5\u4e0d\u80fd\u5728\u4e2d\u65ad\u4e0a\u4e0b\u6587\u4f7f\u7528GFP_KERNEL\u7533\u8bf7\u5185\u5b58\uff0c\u800c\u53ea\u80fd\u4f7f\u7528GFP_ATOMIC\u3002<\/p>\n<p>\u8be6\u89c1LDD CH8 Allocating Memory<\/p>\n<blockquote>\n<p>The most commonly used flag, GFP_KERNEL, means that the allocation (internally performed by calling, eventually, __get_free_pages, which is the source of the GFP_ prefix) is performed on behalf of a process running in kernel space. In other words, this means that the calling function is executing a system call on behalf of a process. Using GFP_KERNEL means that kmalloc can put the current process to sleep waiting for a page when called in low-memory situations. A function that allocates memory using GFP_KERNEL must, therefore, be reentrant and cannot be running in atomic context. While the current process sleeps, the kernel takes proper action to locate some free memory, either by flushing buffers to disk or by swapping out memory from a user process.<\/p>\n<ul>\n<li>GFP_ATOMIC        <br \/>Used to allocate memory from interrupt handlers and other code outside of a process context. Never sleeps. <\/li>\n<li>GFP_KERNEL        <br \/>Normal allocation of kernel memory. May sleep. <\/li>\n<li>GFP_USER        <br \/>Used to allocate memory for user-space pages; it may sleep. <\/li>\n<li>GFP_HIGHUSER        <br \/>Like GFP_USER, but allocates from high memory, if any. High memory is described in the next subsection. <\/li>\n<li>GFP_NOIO <\/li>\n<li>GFP_NOFS        <br \/>These flags function like GFP_KERNEL, but they add restrictions on what the kernel can do to satisfy the request. A GFP_NOFS allocation is not allowed to perform any filesystem calls, while GFP_NOIO disallows the initiation of any I\/O at all.         <br \/>They are used primarily in the filesystem and virtual memory code where an allocation may be allowed to sleep, but recursive filesystem calls would be a bad idea. <\/li>\n<\/ul>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>\u4eca\u5929\u5ba2\u6237\u53cd\u5e94\u6211\u4eec\u7684\u9a71\u52a8\u5728\u8fd0\u884c\u4e2d\u8fd8\u662f\u4f1aOops\uff0c\u5947\u602a\u4e86\u3002\u56e0\u4e3a\u8fd9\u4e2a\u9a71\u52a8\u6211\u4eec\u4e4b\u524d\u662f\u5728\u6211\u4eec\u81ea\u5df1\u7684\u4e00\u4e2a\u677f\u5b50\u4e0a\u505a\u7684\uff0c\u7a33\u5b9a\u6027\u4e4b\u7c7b\u7684\u5df2\u7ecf\u9a8c\u8bc1\u8fc7\u4e86\uff0c\u867d\u7136\u73b0\u5728\u7684\u8fd0\u884c\u73af\u5883\u4e0d\u662f\u6211\u4eec\u81ea\u5df1\u7684\u7248\u672c\uff0c\u65e2\u7136\u9a71\u52a8\u6b63\u5e38\u52a0\u8f7d\uff0c\u600e\u4e48\u8fd8\u4f1a\u51fa\u95ee\u9898\u5462\u3002 \u4e0b\u9762\u7684\u662fOops\u4fe1\u606f\uff1a BUG: scheduling while atomic: swapper\/0\/0x40010100 Modules linked in: drv Pid: 0, comm:&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; swapper CPU: 0&#160;&#160;&#160; Not tainted&#160; (2.6.33.5 #19) PC is at __rcu_process_callbacks+0x68\/0x3a0 LR is at __rcu_process_callbacks+0x68\/0x3a0 pc&hellip;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[7],"tags":[204],"class_list":["post-810","post","type-post","status-publish","format-standard","hentry","category-debug","tag-debug"],"_links":{"self":[{"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/810","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=810"}],"version-history":[{"count":1,"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/810\/revisions"}],"predecessor-version":[{"id":811,"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/810\/revisions\/811"}],"wp:attachment":[{"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=810"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=810"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/kaoru.tech:7000\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=810"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}