Skip to contentSkip to conversation

GPF on hardware breakpoints (preempt_notifier)

BUG Luca Tettamanti 3 participants 6 messages Sep 9, 2007 5 messages not in the archive KVM

lore
Share & tools
lore
#0 lore raw

Hi,
while debugging a program with GDB I got a GPF which seems related to KVM. Note that I was *not* using the debugger inside the guest nor on the virtual machine. The target was an unrelated userspace program.

This is the GPF:

general protection fault: 0000 [#1]
PREEMPT SMP
Modules linked in: kvm_intel kvm bridge llc tun radeon drm binfmt_misc

nfs cpufreq_stats cpufreq_userspace cpufreq_powersave cpufreq_conservative microcode firmware_class cls_u32 cls_route sch_sfq sch_cbq des cbc blkcipher sha1 md5 hmac crypto_hash cryptomgr crypto_algapi nfsd exportfs lockd sunrpc fuse cpufreq_ondemand acpi_cpufreq freq_table ipv6 usblp snd_hda_intel snd_pcm_oss ohci1394 snd_mixer_oss atl1 ieee1394 iTCO_wdt parport_pc parport i2c_i801 rtc e100 snd_pcm snd_timer button mii ehci_hcd snd uhci_hcd intel_agp usbcore soundcore snd_page_alloc agpgart dm_snapshot dm_mod thermal processor fan vfat fat nls_cp850 nls_iso8859_15 ntfs nls_base pata_ali sata_uli pata_jmicron reiserfs xfs

CPU:    1
EIP:    0060:[<f9cfaac4>]    Not tainted VLI
EFLAGS: 00010002   (2.6.23-rc5-libata-gb21010ed-dirty #96)

EIP is at preempt_notifier_trigger+0x7/0x7a [kvm]
eax: f9cff460 ebx: b7f29ff4 ecx: bf91aa60 edx: bf91aa80
esi: b7f61ce0 edi: 00000000 ebp: bf91aa48 esp: e03e9fb8
ds: 007b es: 007b fs: 0000 gs: 0033 ss: 0068
Process p (pid: 13319, ti=e03e9000 task=f5d02530 task.ti=e03e9000)

Stack: b7f29ff4 b7f61ce0 f9cfa8be 00000000 b7f61ce0 bf91aa48 e03e9fe4 b7f29ff4
       bf91aa80 bf91aa60 00000001 0804835f 00000073 00000202 bf91aa44 0000007b
       00000000 00000000
Call Trace:
 [<f9cfa8be>] pn_int1_handler+0x12/0x22 [kvm]
 =======================
Code: b8 01 00 00 00 e8 7e 43 42 c6 89 e0 25 00 f0 ff ff 8b 40 08 a8 04

74 08 5b 5e 5f e9 93 51 5f c6 5b 5e 5f c3 56 b8 60 f4 cf f9 53 <64> 8b 35 08 20 42 c0 e8 48 77 5f c6 8b 1d 84 f4 cf f9 89 c2 eb
EIP: [<f9cfaac4>] preempt_notifier_trigger+0x7/0x7a [kvm] SS:ESP 0068:e03e9fb8

To reproduce just set a hw breakpoint (e.g. watch inside GDB) while a VM is running. As soon as the breakpoint is hit you get at GPF...

Host userspace and kernel are 32bit, the CPU is a Core2:

processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 15
model name : Intel(R) Core(TM)2 CPU 6400 @ 2.13GHz
stepping : 6
cpu MHz : 1596.000
cache size : 2048 KB
physical id : 0
siblings : 2
core id : 0
cpu cores : 2
fdiv_bug : no
hlt_bug : no
f00f_bug : no
coma_bug : no
fpu : yes
fpu_exception : yes
cpuid level : 10
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat
pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc arch_perfmon pebs bts pni monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr lahf_lm
bogomips : 4274.53
clflush size : 64

Luca

Signature · 7 lines
Quando un uomo porta dei fiori a sua moglie senza motivo, 
un motivo c'e`.

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
#2 lore raw
In reply to a message not in the archive
Quoted 6 lines · Luca Tettamanti

Hi,
while debugging a program with GDB I got a GPF which seems related to KVM. Note that I was *not* using the debugger inside the guest nor on the virtual machine. The target was an unrelated userspace program.

Yes, kvm is dirtily misappropriating the debug registers on older kernels. We really should context switch them more carefully.

Signature · 7 lines
error compiling committee.c: too many arguments to function


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
author
#4 lore raw
In reply to a message not in the archive
Quoted 9 lines · Avi Kivity
Quoted 5 lines · Luca Tettamanti

Hi,
while debugging a program with GDB I got a GPF which seems related to KVM. Note that I was *not* using the debugger inside the guest nor on the virtual machine. The target was an unrelated userspace program.

Yes, kvm is dirtily misappropriating the debug registers on older kernels.

I'm runninng the current Linus' git tree, shall I test kvm.git?

Luca

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

#6 lore raw
In reply to a message not in the archive
Quoted 10 lines · Luca
Quoted 8 lines · Avi Kivity
Quoted 6 lines · Luca Tettamanti

Hi,
while debugging a program with GDB I got a GPF which seems related to KVM. Note that I was *not* using the debugger inside the guest nor on the virtual machine. The target was an unrelated userspace program.

Quoted 6 lines
Quoted 3 lines

Yes, kvm is dirtily misappropriating the debug registers on older kernels.

I'm runninng the current Linus' git tree, shall I test kvm.git?

Do you have CONFIG_PREEMPT_NOTIFIERS enabled?

Regards,

Anthony Liguori

Quoted 12 lines

Luca

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
kvm-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/kvm-devel

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

author
#8 lore raw
In reply to a message not in the archive
Quoted 11 lines · Anthony Liguori
Quoted 10 lines · Luca
Quoted 8 lines · Avi Kivity
Quoted 6 lines · Luca Tettamanti

Hi,
while debugging a program with GDB I got a GPF which seems related to KVM. Note that I was *not* using the debugger inside the guest nor on the virtual machine. The target was an unrelated userspace program.

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

Yes, kvm is dirtily misappropriating the debug registers on older kernels.

I'm runninng the current Linus' git tree, shall I test kvm.git?

Do you have CONFIG_PREEMPT_NOTIFIERS enabled?

No, it's disabled.

Luca

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

#10 lore raw
In reply to a message not in the archive
Quoted 21 lines · Luca
Quoted 19 lines · Anthony Liguori
Quoted 17 lines · Luca
Quoted 14 lines · Avi Kivity
Quoted 7 lines · Luca Tettamanti

Hi,
while debugging a program with GDB I got a GPF which seems related to KVM. Note that I was *not* using the debugger inside the guest nor on the virtual machine. The target was an unrelated userspace program.

Yes, kvm is dirtily misappropriating the debug registers on older kernels.

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

I'm runninng the current Linus' git tree, shall I test kvm.git?

Do you have CONFIG_PREEMPT_NOTIFIERS enabled?

No, it's disabled.

If you enable it, you probably won't see this problem. KVM emulates PREEMPT_NOTIFIERS using debug registers.

Regards,

Anthony Liguori

Quoted 3 lines

Luca

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/