0

我正在为基于网络的块设备编写驱动程序。相同的读取操作成功,但其他似乎无法生成此内核

[  170.289421] ------------[ cut here ]------------
[  170.289424] Kernel BUG at ffffffff81330120 [verbose debug info unavailable]
[  170.289425] invalid opcode: 0000 [#14] SMP 
[  170.289427] Modules linked in: dor(OF) ksocket(OF) nls_utf8(F) isofs(F) snd_ens1371(F) gameport(F) snd_ac97_codec(F) coretemp(F) ghash_clmulni_intel(F) ac97_bus(F) cryptd(F) snd_pcm(F) snd_seq_midi(F) joydev(F) snd_rawmidi(F) snd_seq_midi_event(F) hid_generic(F) snd_seq(F) vmw_balloon(F) snd_timer(F) snd_seq_device(F) microcode(F) psmouse(F) serio_raw(F) vmwgfx(F) ttm(F) snd(F) drm(F) bnep(F) i2c_piix4(F) rfcomm(F) soundcore(F) bluetooth(F) snd_page_alloc(F) ppdev(F) parport_pc(F) usbhid(F) hid(F) shpchp(F) mac_hid(F) lp(F) parport(F) e1000(F) floppy(F) mptspi(F) mptscsih(F) mptbase(F)
[  170.289443] CPU 1 
[  170.289445] Pid: 2706, comm: read_thread Tainted: GF     D    O 3.8.0-29-generic #42~precise1-Ubuntu VMware, Inc. VMware Virtual Platform/440BX Desktop Reference Platform
[  170.289447] RIP: 0010:[<ffffffff81330120>]  [<ffffffff81330120>] blk_finish_request+0xf0/0x100
[  170.289450] RSP: 0018:ffff88010787de58  EFLAGS: 00010216
[  170.289451] RAX: 0000000000000000 RBX: ffff8801282afdb0 RCX: ffffffffffffffff
[  170.289452] RDX: 0000000000000001 RSI: 0000000000000000 RDI: ffff8801282afdb0
[  170.289453] RBP: ffff88010787de68 R08: 000000000000007f R09: 0000000000000000
[  170.289454] R10: 000000000000004c R11: 0000000000000033 R12: 0000000000000000
[  170.289455] R13: ffffffffa02a62e0 R14: 0000000000000000 R15: 0000000000000000
[  170.289456] FS:  0000000000000000(0000) GS:ffff88013ae20000(0000) knlGS:0000000000000000
[  170.289458] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  170.289459] CR2: 00007f65ae3d7d7c CR3: 0000000001c0d000 CR4: 00000000001407e0
[  170.289481] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[  170.289500] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[  170.289502] Process read_thread (pid: 2706, threadinfo ffff88010787c000, task ffff880136589740)
[  170.289503] Stack:
[  170.289504]  ffff8801282afdb0 0000000000000000 ffff88010787de88 ffffffff81331fe4
[  170.289507]  ffff88013675e740 ffff88013675e740 ffff88010787de98 ffffffff8133201f
[  170.289509]  ffff88010787deb8 ffffffffa02a630b ffff88013675e740 ffff880137cdf8e0
[  170.289511] Call Trace:
[  170.289514]  [<ffffffff81331fe4>] __blk_end_bidi_request+0x34/0x50
[  170.289516]  [<ffffffff8133201f>] __blk_end_request_all+0x1f/0x30
[  170.289519]  [<ffffffffa02a630b>] kThread_fun_read+0x2b/0x40 [dor]
[  170.289522]  [<ffffffff8107f1b0>] kthread+0xc0/0xd0
[  170.289524]  [<ffffffff8107f0f0>] ? flush_kthread_worker+0xb0/0xb0
[  170.289527]  [<ffffffff816fc82c>] ret_from_fork+0x7c/0xb0
[  170.289529]  [<ffffffff8107f0f0>] ? flush_kthread_worker+0xb0/0xb0
[  170.289530] Code: 89 de e8 44 2b 00 00 e9 4b ff ff ff 83 7b 44 01 0f 85 58 ff ff ff 48 8b 7b 38 48 81 c7 60 01 00 00 e8 35 05 e1 ff e9 43 ff ff ff <0f> 0b 66 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 
[  170.289553] RIP  [<ffffffff81330120>] blk_finish_request+0xf0/0x100
[  170.289555]  RSP <ffff88010787de58>
[  170.289557] ---[ end trace 697188dbdb5f7c34 ]---

知道如何解决这个问题吗?我可以将代码发送给任何愿意提供帮助的人。

提前致谢!

4

1 回答 1

0

“无效的操作码”通常意味着您遇到了BUG_ON()守卫。由于这是在 blk_finish_request() 中,因此很可能是这一行:block/blk-core.c (2111): BUG_ON(blk_queued_rq(req)); -- 3.8.x 内核的行号 2458。

http://lxr.free-electrons.com/source/block/blk-core.c?v=3.8#L2453

static void blk_finish_request(struct request *req, int error)
{
        if (blk_rq_tagged(req))
                blk_queue_end_tag(req->q, req);

        BUG_ON(blk_queued_rq(req));

        if (unlikely(laptop_mode) && blk_fs_request(req))
                laptop_io_completion();

        blk_delete_timer(req);

        blk_account_io_done(req);

        if (req->end_io)
                req->end_io(req, error);
        else {
                if (blk_bidi_rq(req))
                        __blk_put_request(req->next_rq->q, req->next_rq);

                __blk_put_request(req->q, req);
        }
}

也许 blk_end_request_all() 在这里不是正确的调用。其他驱动程序似乎在一切完成后使用它。查看 lxr.free-electrons.com 了解它的常用方法。

于 2013-09-19T23:58:08.490 回答