[BUG] kdump won't work if invalid TSS fault happens in irq context

2013-10-09 Thread Xishi Qiu
I write a module, and find kdump can't boot in the following case.
Kernel version is 3.4.24, Intel(R) Xeon(R) CPU  E5620, and kernel v3.12 
has the same problem too.

Here is the code:
struct timer_list g_timer;

void tmrhnd_invtssfault(unsigned long data)
{
long __res;
printk(KERN_EMERG "invalid TSS fault in interrupt context.\n");
__asm__ volatile("int $0x0A" : "=a"(__res):);
}

{
...
init_timer(_timer);
g_timer.expires = jiffies + 10;
g_timer.data = 0;
g_timer.function = tmrhnd_invtssfault;
add_timer(_timer);
...
}

Here is the log:
[   87.801066] kpgenm: invalid TSS fault in interrupt context.
[   87.976956] BUG: unable to handle kernel paging request at 81467489
[   87.983979] IP: [] down_read_trylock+0x10/0x20
[   87.990017] PGD 1a0d067 PUD 1a11063 PMD 14001e1 
[   87.994708] Oops: 0003 [#1] SMP 
[   87.997985] CPU 2 
[   87.999833] Modules linked in: kpgen(O) igb(O) netmap_lin(O) megaraid_sas 
sr_mod mpt2sas raid_class uhci_hcd usb_storage ide_cd_mod ide_core mptctl 
mptsas ata_piix acpi_cpufreq mperf tg3 usbhid hid nfs lockd fscache auth_rpcgss 
nfs_acl sunrpc cdrom scsi_transport_sas e1000 mptscsih mptbase ipmi_devintf 
ipmi_msghandler ext2 ac dm_mod af_packet af_key zlib_deflate loop coretemp 
crc32c_intel ghash_clmulni_intel aesni_intel cryptd ipv6 aes_x86_64 aes_generic 
pcspkr i2c_i801 mei(C) sg iTCO_wdt microcode iTCO_vendor_support dca rtc_cmos 
container ext3 jbd mbcache i915 drm_kms_helper drm i2c_algo_bit i2c_core sd_mod 
crc_t10dif ahci libahci ehci_hcd libata button usbcore usb_common thermal video 
fan intel_agp intel_gtt processor thermal_sys hwmon scsi_dh_rdac scsi_dh_alua 
scsi_dh_emc scsi_dh_hp_sw scsi_dh scsi_mod [last unloaded: igb]
[   88.075236] 
[   88.076738] Pid: 1417644280, comm: ԨF.??? Tainted: G C O 
3.4.24.13-0.1-default #1 INSYDE eChiefRiver/Type2 - Board Product Name1
[   88.089319] RIP: 0010:[]  [] 
down_read_trylock+0x10/0x20
[   88.097783] RSP: 0018:8802547fbc88  EFLAGS: 00010002
[   88.103101] RAX: 4c10246c894c1824 RBX: 0001 RCX: 81467429
[   88.110238] RDX: 4c10246c894c1825 RSI: 0010 RDI: 81467489
[   88.117373] RBP: 8802547fbc88 R08: 8802547fbfd8 R09: 
[   88.124511] R10: 88025f28dc50 R11:  R12: 0001
[   88.131648] R13: 0010 R14: 8802547fbda8 R15: 0028
[   88.138786] FS:  () GS:88025f28() 
knlGS:
[   88.146876] CS:  0010 DS:  ES:  CR0: 8005003b
[   88.152626] CR2: 81467489 CR3: 01a0b000 CR4: 001407e0
[   88.159764] DR0:  DR1:  DR2: 
[   88.166901] DR3:  DR6: 0ff0 DR7: 0400
[   88.174039] Process ԨF.??? (pid: 1417644280, threadinfo 8802547fa000, 
task 8802547f8440)
[   88.183082] Stack:
[   88.185101]  8802547fbd98 8146aa24 a02ca194 
81467489
[   88.192601]  8802547f8440 81467429 8802547fbe78 
814675f5
[   88.200084]  0028 8802547fbe88  
a02ca194
[   88.207571] Call Trace:
[   88.210031]  [] do_page_fault+0x184/0x4b0
[   88.215617]  [] ? tmrhnd_invtssfault+0x14/0x20 [kpgen]
[   88.222327]  [] ? retint_signal+0x25/0x8c
[   88.227901]  [] ? restore_args+0x30/0x30
[   88.233390]  [] ? page_fault+0x25/0x30
[   88.238706]  [] ? tmrhnd_invtssfault+0x14/0x20 [kpgen]
[   88.245411]  [] ? tmrhnd_invtssfault+0x14/0x20 [kpgen]
[   88.252112]  [] ? restore_args+0x30/0x30
[   88.257604]  [] ? do_page_fault+0x34/0x4b0
[   88.263265]  [] page_fault+0x25/0x30
[   88.268408]  [] ? tmrhnd_invtssfault+0x14/0x20 [kpgen]
[   88.275110]  [] ? page_fault+0x25/0x30
[   88.280427]  [] ? tmrhnd_invtssfault+0x14/0x20 [kpgen]
[   88.287130]  [] ? tmrhnd_invtssfault+0x14/0x20 [kpgen]
[   88.293835]  [] ? restore_args+0x30/0x30
[   88.299322]  [] ? do_page_fault+0x34/0x4b0
[   88.304987]  [] ? start_secondary+0x7a/0x7c
[   88.310733] Code: c0 83 fa 01 5b 0f 94 c0 41 5c c9 c3 90 90 90 90 90 90 90 
90 90 90 90 90 90 90 90 55 48 89 e5 48 8b 07 48 89 c2 48 83 c2 01 7e 07  48 
0f b1 17 75 f0 48 f7 d0 c9 48 c1 e8 3f c3 55 31 c0 48 ba 
[   88.330974] RIP  [] down_read_trylock+0x10/0x20
[   88.337097]  RSP 
[   88.340590] CR2: 81467489
[   88.343921] BUG: unable to handle kernel paging request at 81467489
[   88.350926] IP: [] down_read_trylock+0x10/0x20
[   88.356962] PGD 1a0d067 PUD 1a11063 PMD 14001e1 
[   88.361664] Oops: 0003 [#2] SMP 
[   88.364940] CPU 2 
[   88.366788] Modules linked in: kpgen(O) igb(O) netmap_lin(O) megaraid_sas 
sr_mod mpt2sas raid_class uhci_hcd usb_storage ide_cd_mod ide_core mptctl 
mptsas ata_piix acpi_cpufreq mperf tg3 usbhid hid nfs lockd fscache auth_rpcgss 
nfs_acl sunrpc cdrom scsi_transport_sas e1000 mptscsih mptbase ipmi_devintf 
ipmi_msghandler ext2 ac 

[BUG] kdump won't work if invalid TSS fault happens in irq context

2013-10-09 Thread Xishi Qiu
I write a module, and find kdump can't boot in the following case.
Kernel version is 3.4.24, Intel(R) Xeon(R) CPU  E5620, and kernel v3.12 
has the same problem too.

Here is the code:
struct timer_list g_timer;

void tmrhnd_invtssfault(unsigned long data)
{
long __res;
printk(KERN_EMERG invalid TSS fault in interrupt context.\n);
__asm__ volatile(int $0x0A : =a(__res):);
}

{
...
init_timer(g_timer);
g_timer.expires = jiffies + 10;
g_timer.data = 0;
g_timer.function = tmrhnd_invtssfault;
add_timer(g_timer);
...
}

Here is the log:
[   87.801066] kpgenm: invalid TSS fault in interrupt context.
[   87.976956] BUG: unable to handle kernel paging request at 81467489
[   87.983979] IP: [81099070] down_read_trylock+0x10/0x20
[   87.990017] PGD 1a0d067 PUD 1a11063 PMD 14001e1 
[   87.994708] Oops: 0003 [#1] SMP 
[   87.997985] CPU 2 
[   87.999833] Modules linked in: kpgen(O) igb(O) netmap_lin(O) megaraid_sas 
sr_mod mpt2sas raid_class uhci_hcd usb_storage ide_cd_mod ide_core mptctl 
mptsas ata_piix acpi_cpufreq mperf tg3 usbhid hid nfs lockd fscache auth_rpcgss 
nfs_acl sunrpc cdrom scsi_transport_sas e1000 mptscsih mptbase ipmi_devintf 
ipmi_msghandler ext2 ac dm_mod af_packet af_key zlib_deflate loop coretemp 
crc32c_intel ghash_clmulni_intel aesni_intel cryptd ipv6 aes_x86_64 aes_generic 
pcspkr i2c_i801 mei(C) sg iTCO_wdt microcode iTCO_vendor_support dca rtc_cmos 
container ext3 jbd mbcache i915 drm_kms_helper drm i2c_algo_bit i2c_core sd_mod 
crc_t10dif ahci libahci ehci_hcd libata button usbcore usb_common thermal video 
fan intel_agp intel_gtt processor thermal_sys hwmon scsi_dh_rdac scsi_dh_alua 
scsi_dh_emc scsi_dh_hp_sw scsi_dh scsi_mod [last unloaded: igb]
[   88.075236] 
[   88.076738] Pid: 1417644280, comm: ԨF.??? Tainted: G C O 
3.4.24.13-0.1-default #1 INSYDE eChiefRiver/Type2 - Board Product Name1
[   88.089319] RIP: 0010:[81099070]  [81099070] 
down_read_trylock+0x10/0x20
[   88.097783] RSP: 0018:8802547fbc88  EFLAGS: 00010002
[   88.103101] RAX: 4c10246c894c1824 RBX: 0001 RCX: 81467429
[   88.110238] RDX: 4c10246c894c1825 RSI: 0010 RDI: 81467489
[   88.117373] RBP: 8802547fbc88 R08: 8802547fbfd8 R09: 
[   88.124511] R10: 88025f28dc50 R11:  R12: 0001
[   88.131648] R13: 0010 R14: 8802547fbda8 R15: 0028
[   88.138786] FS:  () GS:88025f28() 
knlGS:
[   88.146876] CS:  0010 DS:  ES:  CR0: 8005003b
[   88.152626] CR2: 81467489 CR3: 01a0b000 CR4: 001407e0
[   88.159764] DR0:  DR1:  DR2: 
[   88.166901] DR3:  DR6: 0ff0 DR7: 0400
[   88.174039] Process ԨF.??? (pid: 1417644280, threadinfo 8802547fa000, 
task 8802547f8440)
[   88.183082] Stack:
[   88.185101]  8802547fbd98 8146aa24 a02ca194 
81467489
[   88.192601]  8802547f8440 81467429 8802547fbe78 
814675f5
[   88.200084]  0028 8802547fbe88  
a02ca194
[   88.207571] Call Trace:
[   88.210031]  [8146aa24] do_page_fault+0x184/0x4b0
[   88.215617]  [a02ca194] ? tmrhnd_invtssfault+0x14/0x20 [kpgen]
[   88.222327]  [81467489] ? retint_signal+0x25/0x8c
[   88.227901]  [81467429] ? restore_args+0x30/0x30
[   88.233390]  [814675f5] ? page_fault+0x25/0x30
[   88.238706]  [a02ca194] ? tmrhnd_invtssfault+0x14/0x20 [kpgen]
[   88.245411]  [a02ca194] ? tmrhnd_invtssfault+0x14/0x20 [kpgen]
[   88.252112]  [81467429] ? restore_args+0x30/0x30
[   88.257604]  [8146a8d4] ? do_page_fault+0x34/0x4b0
[   88.263265]  [814675f5] page_fault+0x25/0x30
[   88.268408]  [a02ca194] ? tmrhnd_invtssfault+0x14/0x20 [kpgen]
[   88.275110]  [814675f5] ? page_fault+0x25/0x30
[   88.280427]  [a02ca194] ? tmrhnd_invtssfault+0x14/0x20 [kpgen]
[   88.287130]  [a02ca194] ? tmrhnd_invtssfault+0x14/0x20 [kpgen]
[   88.293835]  [81467429] ? restore_args+0x30/0x30
[   88.299322]  [8146a8d4] ? do_page_fault+0x34/0x4b0
[   88.304987]  [8145c19e] ? start_secondary+0x7a/0x7c
[   88.310733] Code: c0 83 fa 01 5b 0f 94 c0 41 5c c9 c3 90 90 90 90 90 90 90 
90 90 90 90 90 90 90 90 55 48 89 e5 48 8b 07 48 89 c2 48 83 c2 01 7e 07 f0 48 
0f b1 17 75 f0 48 f7 d0 c9 48 c1 e8 3f c3 55 31 c0 48 ba 
[   88.330974] RIP  [81099070] down_read_trylock+0x10/0x20
[   88.337097]  RSP 8802547fbc88
[   88.340590] CR2: 81467489
[   88.343921] BUG: unable to handle kernel paging request at 81467489
[   88.350926] IP: [81099070] down_read_trylock+0x10/0x20
[   88.356962] PGD 1a0d067 PUD 1a11063 PMD 14001e1 
[   88.361664] Oops: 0003