Subject: [BUG][tip] ftrace: mmiotracer hit a bug in mm

Here is what I've gotten on tip/master (4.2-rc1 base).

I ran the ftracetest and 2nd basic test for tracers hit a bug which completely
freeze the machine (maybe it broke pagetables).
>From the message it happened when initializing kmmio. Without CONFIG_MMIOTRACE
it has gone.

$ sudo ./ftracetest
=== Ftrace unit tests ===
[1] Basic trace file check [PASS]
[2] Basic test for tracers[ 216.878455] ------------[ cut here ]------------
[ 216.879905] kernel BUG at /home/mhiramat/ksrc/linux-3/arch/x86/mm/init_64.c:212!
[ 216.882022] invalid opcode: 0000 [#1] SMP
[ 216.883294] Modules linked in: ip6t_rpfilter ip6t_REJECT nf_reject_ipv6 nf_conntrack_ipv6 nf_defrag_ipv6 ipt_REJECT nf_reject_ipv4 xt_conntrack ebtable_nat ebtable_broute bridge stp llc
ebtable_filter ebtables ip6table_mangle ip6table_security ip6table_raw ip6table_filter ip6_tables iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack iptable_mangle
iptable_security iptable_raw iptable_filter ip_tables sg pcspkr acpi_cpufreq dm_mirror dm_region_hash dm_log dm_mod
[ 216.897025] CPU: 0 PID: 1322 Comm: ftracetest Not tainted 4.2.0-rc1+ #40
[ 216.898944] Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2011
[ 216.900615] task: ffff880076e55dc0 ti: ffff880035cdc000 task.ti: ffff880035cdc000
[ 216.902760] RIP: 0010:[<ffffffff810b349f>] [<ffffffff810b349f>] sync_global_pgds+0x18f/0x1a0
[ 216.905253] RSP: 0018:ffff880035cdfc58 EFLAGS: 00010287
[ 216.906782] RAX: ffff88007d09a000 RBX: ffff88003520ddc0 RCX: ffff880000000000
[ 216.908831] RDX: ffff88007909c000 RSI: 000000007d09a067 RDI: 000000007d09a067
[ 216.910880] RBP: ffff880035cdfca8 R08: ffff880035cdfc00 R09: 0000000000000002
[ 216.912948] R10: 0000000000000004 R11: 0000000000000005 R12: ffff88003520ddc0
[ 216.914998] R13: ffff880079094000 R14: ffffffff81b58c90 R15: ffff880076f3da64
[ 216.917047] FS: 00007f23c8e82740(0000) GS:ffff88007fc00000(0000) knlGS:0000000000000000
[ 216.919372] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[ 216.921027] CR2: 000000000078609c CR3: 0000000035cda000 CR4: 00000000000007f0
[ 216.923088] Stack:
[ 216.923700] ffffe8ffffffffff ffffc90000000000 ffff88003520e428 0000000088cbb921
[ 216.925983] ffff880035cdfc00 ffffffff81b7fc20 ffff880035cdfd8b ffffffff82057e80
[ 216.928273] 000000000000000a 0000000000000000 ffff880035cdfcb8 ffffffff810b5102
[ 216.930553] Call Trace:
[ 216.931289] [<ffffffff810b5102>] vmalloc_sync_all+0x22/0x30
[ 216.932922] [<ffffffff810e7556>] register_die_notifier+0x16/0x30
[ 216.934702] [<ffffffff810bcb2f>] kmmio_init+0x2f/0x40
[ 216.936186] [<ffffffff810bd9f1>] enable_mmiotrace+0x51/0x1e0
[ 216.937850] [<ffffffff811907ac>] mmio_trace_init+0x3c/0x70
[ 216.939464] [<ffffffff8118a59e>] tracing_set_tracer+0xfe/0x190
[ 216.941167] [<ffffffff8118a860>] tracing_set_trace_write+0x90/0xd0
[ 216.942975] [<ffffffff8123f73d>] ? do_filp_open+0x9d/0x100
[ 216.944604] [<ffffffff8122efb7>] __vfs_write+0x37/0x100
[ 216.946136] [<ffffffff81231ce8>] ? __sb_start_write+0x58/0x100
[ 216.947847] [<ffffffff813bd9bd>] ? security_file_permission+0x3d/0xc0
[ 216.949727] [<ffffffff8122f6b9>] vfs_write+0xa9/0x190
[ 216.951211] [<ffffffff81003176>] ? do_audit_syscall_entry+0x66/0x70
[ 216.953041] [<ffffffff812304b5>] SyS_write+0x55/0xc0
[ 216.954509] [<ffffffff81003e77>] ? syscall_return_slowpath+0xd7/0x1d0
[ 216.956402] [<ffffffff817a79ae>] entry_SYSCALL_64_fastpath+0x12/0x71
[ 216.958256] Code: 81 ff 14 25 48 f0 b7 81 e9 c6 fe ff ff 48 8b 45 c8 65 48 33 04 25 28 00 00 00 75 11 48 83 c4 28 5b 41 5c 41 5d 41 5e 41 5f 5d c3 <0f> 0b e8 7a 48 01 00 66 2e 0f 1f 84 00 00 00 00
00 0f 1f 44 00
[ 216.966294] RIP [<ffffffff810b349f>] sync_global_pgds+0x18f/0x1a0
[ 216.968106] RSP <ffff880035cdfc58>
[ 216.969198] ---[ end trace c824ada35f12984e ]---
[ 216.970614] Kernel panic - not syncing: Fatal exception
[ 216.973111] Kernel Offset: disabled
[ 216.974138] ---[ end Kernel panic - not syncing: Fatal exception

Thanks,
--
Masami HIRAMATSU
Linux Technology Research Center, System Productivity Research Dept.
Center for Technology Innovation - Systems Engineering
Hitachi, Ltd., Research & Development Group
E-mail: [email protected]