Замучался с тестами (которые весьма продолжительны по времени) потому прошу помощи.
Пишу модуль ядра, он запускает новый поток обработки данных при запуске программы MyProgram
Примеры кода не буду показывать. (он максимльно упрощен)
Обычно, модуль работает без сбоев. Но если произвести тест работы с помощью баш скрипта, который постоянно создаёт условие , чтоб модуль создавал новый поток ядра, то система звисает. При разном количестве созданных потоков модулем(и завершённых). Может зависнуть при 100 созданных потоках, и может при 100,000...
На первый взгляд. (да и на 50-й) код чист. В создаваемые потоки передаётся указатель на новую выделенную память (для каждого потока). При работе с данными использую один семафор.
Эт всё написал, чтоб была общая картина... Так вот. Снова провел тесты, и в dmesg вывалился oops до зависания системы
Вот он. Помогите в нём разобраться. В каком направлении искать ошибку??
[ 2124.267682] INFO: rcu_sched detected stalls on CPUs/tasks: { 2} (detected by 0, t=15002 jiffies, g=132799, c=132798, q=0)
[ 2124.267694] sending NMI to all CPUs:
[ 2090.892412] NMI backtrace for cpu 2
[ 2090.892412] CPU: 2 PID: 1100 Comm: MyProgram Tainted: G OX 3.13.0-45-generic #74-Ubuntu
[ 2090.892412] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
[ 2090.892412] task: ffff880078af6000 ti: ffff880049564000 task.ti: ffff880049564000
[ 2090.892412] RIP: 0010:[<ffffffff8104f5a5>] [<ffffffff8104f5a5>] native_halt+0x5/0x10
[ 2090.892412] RSP: 0018:ffff8800495659f0 EFLAGS: 00000046
[ 2090.892412] RAX: 0000000000000008 RBX: ffff88007fd0cfc0 RCX: 0000000000000001
[ 2090.892412] RDX: 0000000000000000 RSI: 0000000000000006 RDI: ffff88007ffe7080
[ 2090.892412] RBP: ffff8800495659f0 R08: 0000000000000002 R09: 00007feb26a947b8
[ 2090.892412] R10: 00007feb26a947b8 R11: 0000000000000246 R12: 0000000000000002
[ 2090.892412] R13: 0000000000000000 R14: 0000097e7f0012c9 R15: 0000000000000096
[ 2090.892412] FS: 00007feb281fa780(0000) GS:ffff88007fd00000(0000) knlGS:0000000000000000
[ 2090.892412] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 2090.892412] CR2: 0000000000d7df38 CR3: 00000000372e5000 CR4: 00000000000006e0
[ 2090.892412] Stack:
[ 2090.892412] ffff880049565a30 ffffffff8104ec25 0000000678af6000 ffff8800302b9100
[ 2090.892412] ffff880049565ce0 ffff8800302b9100 0000000000000000 ffff880049565ca0
[ 2090.892412] ffff880049565a88 ffffffff8104e381 0000000000000246 00007feb26a947b8
[ 2090.892412] Call Trace:
[ 2090.892412] [<ffffffff8104ec25>] kvm_lock_spinning+0x125/0x1b0
[ 2090.892412] [<ffffffff8104e381>] __raw_callee_save_kvm_lock_spinning+0x11/0x20
[ 2090.892412] [<ffffffff81728f73>] ? _raw_spin_lock_irqsave+0x53/0x60
[ 2090.892412] [<ffffffff810aab2a>] add_wait_queue+0x1a/0x50
[ 2090.892412] [<ffffffff811d182f>] __pollwait+0x7f/0xf0
[ 2090.892412] [<ffffffff816bb159>] unix_poll+0x29/0xc0
[ 2090.892412] [<ffffffff8160bf4c>] sock_poll+0x4c/0x100
[ 2090.892412] [<ffffffff811d2dae>] do_sys_poll+0x2fe/0x540
[ 2090.892412] [<ffffffff81615111>] ? __kmalloc_reserve.isra.26+0x31/0x90
[ 2090.892412] [<ffffffff81615a6e>] ? __alloc_skb+0x4e/0x2b0
[ 2090.892412] [<ffffffff81615ab2>] ? __alloc_skb+0x92/0x2b0
[ 2090.892412] [<ffffffff81619e93>] ? memcpy_fromiovecend+0x83/0xb0
[ 2090.892412] [<ffffffff8161a70f>] ? skb_copy_datagram_from_iovec+0x5f/0x290
[ 2090.892412] [<ffffffff811d17b0>] ? poll_initwait+0x50/0x50
[ 2090.892412] [<ffffffff811d1a70>] ? poll_select_copy_remaining+0x130/0x130
[ 2090.892412] [<ffffffff816bbb16>] ? unix_stream_sendmsg+0x3c6/0x400
[ 2090.892412] [<ffffffff8160b4de>] ? sock_aio_write+0xfe/0x130
[ 2090.892412] [<ffffffff8172cf54>] ? __do_page_fault+0x204/0x560
[ 2090.892412] [<ffffffff811ff821>] ? fsnotify+0x241/0x320
[ 2090.892412] [<ffffffff811bdc8c>] ? vfs_write+0x15c/0x1f0
[ 2090.892412] [<ffffffff811d30c5>] SyS_poll+0x65/0x100
[ 2090.892412] [<ffffffff8173196d>] system_call_fastpath+0x1a/0x1f
[ 2090.892412] Code: 84 00 00 00 00 00 55 48 89 e5 fb 5d c3 66 0f 1f 84 00 00 00 00 00 55 48 89 e5 fb f4 5d c3 0f 1f 84 00 00 00 00 00 55 48 89 e5 f4 <5d> c3 66 0f 1f 84 00 00 00 00 00 55 49 89 ca 49 89 d1 8b 07 48
[ 2124.198965] NMI backtrace for cpu 1
[ 2124.198965] CPU: 1 PID: 0 Comm: swapper/1 Tainted: G OX 3.13.0-45-generic #74-Ubuntu
[ 2124.198965] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
[ 2124.198965] task: ffff88007c041800 ti: ffff88007c04a000 task.ti: ffff88007c04a000
[ 2124.198965] RIP: 0010:[<ffffffff8104f596>] [<ffffffff8104f596>] native_safe_halt+0x6/0x10
[ 2124.198965] RSP: 0018:ffff88007c04bea8 EFLAGS: 00000286
[ 2124.198965] RAX: 00000000ffffffed RBX: ffff88007c04bf38 RCX: 0100000000000000
[ 2124.198965] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000046
[ 2124.198965] RBP: ffff88007c04bea8 R08: 0000000000000000 R09: 0000000000000000
[ 2124.198965] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000001
[ 2124.198965] R13: ffffffff81d142c0 R14: 0000000000000000 R15: ffff88007c04bfd8
[ 2124.198965] FS: 0000000000000000(0000) GS:ffff88007fc80000(0000) knlGS:0000000000000000
[ 2124.198965] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[ 2124.198965] CR2: 00007fd59ec69f10 CR3: 0000000060832000 CR4: 00000000000006e0
[ 2124.198965] Stack:
[ 2124.198965] ffff88007c04bec8 ffffffff8101caaf ffff88007c04bf38 ffff88007c04bfd8
[ 2124.198965] ffff88007c04bed8 ffffffff8101d376 ffff88007c04bf28 ffffffff810bef35
[ 2124.198965] ffff88007c04bfd8 ffff88007c04bfd8 906b43aef1445783 ffff88007c04bf38
[ 2124.198965] Call Trace:
[ 2124.198965] [<ffffffff8101caaf>] default_idle+0x1f/0xc0
[ 2124.198965] [<ffffffff8101d376>] arch_cpu_idle+0x26/0x30
[ 2124.198965] [<ffffffff810bef35>] cpu_startup_entry+0xc5/0x290
[ 2124.198965] [<ffffffff810413fd>] start_secondary+0x21d/0x2d0
[ 2124.198965] Code: 00 00 00 00 00 55 48 89 e5 fa 5d c3 66 0f 1f 84 00 00 00 00 00 55 48 89 e5 fb 5d c3 66 0f 1f 84 00 00 00 00 00 55 48 89 e5 fb f4 <5d> c3 0f 1f 84 00 00 00 00 00 55 48 89 e5 f4 5d c3 66 0f 1f 84
[ 2124.268911] NMI backtrace for cpu 0
[ 2124.268916] CPU: 0 PID: 0 Comm: swapper/0 Tainted: G OX 3.13.0-45-generic #74-Ubuntu
[ 2124.268918] Hardware name: innotek GmbH VirtualBox/VirtualBox, BIOS VirtualBox 12/01/2006
[ 2124.268920] task: ffffffff81c15480 ti: ffffffff81c00000 task.ti: ffffffff81c00000
[ 2124.268922] RIP: 0010:[<ffffffff810498af>] [<ffffffff810498af>] flat_send_IPI_all+0x8f/0xa0
[ 2124.268928] RSP: 0018:ffff88007fc03dd8 EFLAGS: 00000006
[ 2124.268929] RAX: 0000000000000000 RBX: 0000000000000046 RCX: 0000000007000000
[ 2124.268931] RDX: 0000000000000c00 RSI: ffffffff81c26e80 RDI: 0000000000000300
[ 2124.268933] RBP: ffff88007fc03df0 R08: 0000000000000082 R09: 000000000000064c
[ 2124.268934] R10: 0000000000000000 R11: ffff88007fc03b2e R12: 0000000000000800
[ 2124.268936] R13: 0000000000000007 R14: ffffffff81c4e180 R15: 0000000000000000
[ 2124.268941] FS: 0000000000000000(0000) GS:ffff88007fc00000(0000) knlGS:0000000000000000
[ 2124.268943] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[ 2124.268944] CR2: 00007f195c1562d0 CR3: 000000006d6d8000 CR4: 00000000000006f0
[ 2124.268948] Stack:
[ 2124.268950] 0000000000002710 ffffffff81c4e180 ffffffff81d142e0 ffff88007fc03e08
[ 2124.268953] ffffffff81045120 ffff88007fc0d840 ffff88007fc03e60 ffffffff810cafb1
[ 2124.268956] ffffffff81c4e180 ffffffff00000002 0000000000000000 0000000000000001
[ 2124.268959] Call Trace:
[ 2124.268961] <IRQ>
[ 2124.268963] [<ffffffff81045120>] arch_trigger_all_cpu_backtrace+0x70/0xb0
[ 2124.268969] [<ffffffff810cafb1>] rcu_check_callbacks+0x631/0x650
[ 2124.268973] [<ffffffff81076377>] update_process_times+0x47/0x70
[ 2124.268977] [<ffffffff810d6175>] tick_sched_handle.isra.17+0x25/0x60
[ 2124.268979] [<ffffffff810d61f1>] tick_sched_timer+0x41/0x60
[ 2124.268983] [<ffffffff8108e787>] __run_hrtimer+0x77/0x1d0
[ 2124.268985] [<ffffffff810d61b0>] ? tick_sched_handle.isra.17+0x60/0x60
[ 2124.268988] [<ffffffff8108ef4f>] hrtimer_interrupt+0xef/0x230
[ 2124.268992] [<ffffffff81043537>] local_apic_timer_interrupt+0x37/0x60
[ 2124.268996] [<ffffffff81733d4f>] smp_apic_timer_interrupt+0x3f/0x60
[ 2124.268998] [<ffffffff817326dd>] apic_timer_interrupt+0x6d/0x80
[ 2124.269000] <EOI>
[ 2124.269001] [<ffffffff8104f596>] ? native_safe_halt+0x6/0x10
[ 2124.269007] [<ffffffff8101caaf>] default_idle+0x1f/0xc0
[ 2124.269010] [<ffffffff8101d376>] arch_cpu_idle+0x26/0x30
[ 2124.269013] [<ffffffff810bef35>] cpu_startup_entry+0xc5/0x290
[ 2124.269016] [<ffffffff8170f377>] rest_init+0x77/0x80
[ 2124.269021] [<ffffffff81d35f70>] start_kernel+0x438/0x443
[ 2124.269023] [<ffffffff81d35941>] ? repair_env_string+0x5c/0x5c
[ 2124.269026] [<ffffffff81d35120>] ? early_idt_handlers+0x120/0x120
[ 2124.269028] [<ffffffff81d355ee>] x86_64_start_reservations+0x2a/0x2c
[ 2124.269031] [<ffffffff81d35733>] x86_64_start_kernel+0x143/0x152
[ 2124.269032] Code: 48 8b 35 7d a7 cc 00 44 8b 66 3c ff 96 50 01 00 00 44 89 e9 c1 e1 18 89 0c 25 10 73 5f ff 44 89 e2 80 ce 04 89 14 25 00 73 5f ff <48> 89 df 57 9d 66 66 90 66 90 5b 41 5c 41 5d 5d c3 66 66 66 66