免费注册 查看新帖 |

Chinaunix

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

如何去掉这个自旋锁的BUG [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2009-04-09 11:28 |只看该作者 |倒序浏览
以前的驱动在linux 2.6.18下可以正常使用。
但是在新内核2.6.23下却总是出现BUG提示,很是头疼。
Jan  1 00:12:59 uclibc user.err kernel: BUG: scheduling while atomic: slave_test_node/334/0x00000002
Jan  1 00:12:59 uclibc user.warn kernel: [<c0029618>] (dump_stack+0x0/0x14) from [<c0036e00>] (__schedule_bug+0x50/0x5c)
Jan  1 00:12:59 uclibc user.warn kernel: [<c0036db0>] (__schedule_bug+0x0/0x5c) from [<c0206ca4>] (schedule+0x6c/0x2d
Jan  1 00:12:59 uclibc user.warn kernel:  r4:c403bf0c
Jan  1 00:12:59 uclibc user.warn kernel: [<c0206c38>] (schedule+0x0/0x2d from [<bf000e60>] (printer_read+0x244/0x4f4 [g_encdev])
Jan  1 00:12:59 uclibc user.warn kernel: [<bf000c1c>] (printer_read+0x0/0x4f4 [g_encdev]) from [<c008cf80>] (vfs_read+0xb8/0x14
Jan  1 00:12:59 uclibc user.warn kernel: [<c008cec8>] (vfs_read+0x0/0x14 from [<c008d3dc>] (sys_read+0x4c/0x7c)
Jan  1 00:12:59 uclibc user.warn kernel:  r7:00000003 r6:c5519700 r5:00000000 r4:00000000
Jan  1 00:12:59 uclibc user.warn kernel: [<c008d390>] (sys_read+0x0/0x7c) from [<c0024ec0>] (ret_fast_syscall+0x0/0x2c)
Jan  1 00:12:59 uclibc user.warn kernel:  r6:00000080 r5:0001218c r4:00000004

驱动里用的是自旋锁,怀疑自旋锁有问题。但不知道如何下手。以下是驱动程序。

/*
* printer.c -- Printer gadget driver
*
* Copyright (C) 2003-2005 David Brownell
* Copyright (C) 2006 Craig W. Nadler
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
*/


//#define GS_DEBUG 1
#define VERBOSE 1


#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/ioport.h>
#include <linux/sched.h>
#include <linux/slab.h>
#include <linux/smp_lock.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/timer.h>
#include <linux/list.h>
#include <linux/interrupt.h>
#include <linux/utsname.h>
#include <linux/device.h>
#include <linux/moduleparam.h>
#include <linux/fs.h>
#include <linux/poll.h>
#include <linux/types.h>
#include <linux/ctype.h>
#include <linux/cdev.h>

#include <asm/byteorder.h>
#include <asm/io.h>
#include <asm/irq.h>
#include <asm/system.h>
#include <asm/uaccess.h>
#include <asm/unaligned.h>

[ 本帖最后由 zealane 于 2009-4-22 17:04 编辑 ]

论坛徽章:
0
2 [报告]
发表于 2009-04-09 11:30 |只看该作者
111

[ 本帖最后由 zealane 于 2009-4-22 17:05 编辑 ]

论坛徽章:
0
3 [报告]
发表于 2009-04-09 23:52 |只看该作者
内核变了,可能有一些头文件变了,所以运行有可能出现错误。
得下载对应的版本。

论坛徽章:
0
4 [报告]
发表于 2009-04-10 08:40 |只看该作者
是不是可能机理也不同》?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

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

清除 Cookies - ChinaUnix - Archiver - WAP - TOP