Re: [PATCH] KVM: x86: fix missed hardware breakpoints

2016-02-26 Thread Paolo Bonzini
On 26/02/2016 12:28, Nadav Amit wrote: > Xiao Guangrong wrote: > >> On 02/19/2016 06:56 PM, Paolo Bonzini wrote: >>> Sometimes when setting a breakpoint a process doesn't stop on it. >>> This is because the debug registers are not loaded correctly on >>> VCPU

Re: [PATCH] KVM: x86: fix missed hardware breakpoints

2016-02-26 Thread Paolo Bonzini
On 26/02/2016 12:28, Nadav Amit wrote: > Xiao Guangrong wrote: > >> On 02/19/2016 06:56 PM, Paolo Bonzini wrote: >>> Sometimes when setting a breakpoint a process doesn't stop on it. >>> This is because the debug registers are not loaded correctly on >>> VCPU load. >>> >>> >>> diff --git

Re: [PATCH] KVM: x86: fix missed hardware breakpoints

2016-02-26 Thread Xiao Guangrong
On 02/26/2016 07:28 PM, Nadav Amit wrote: Xiao Guangrong wrote: On 02/19/2016 06:56 PM, Paolo Bonzini wrote: Sometimes when setting a breakpoint a process doesn't stop on it. This is because the debug registers are not loaded correctly on VCPU load. diff

Re: [PATCH] KVM: x86: fix missed hardware breakpoints

2016-02-26 Thread Xiao Guangrong
On 02/26/2016 07:28 PM, Nadav Amit wrote: Xiao Guangrong wrote: On 02/19/2016 06:56 PM, Paolo Bonzini wrote: Sometimes when setting a breakpoint a process doesn't stop on it. This is because the debug registers are not loaded correctly on VCPU load. diff --git a/arch/x86/kvm/x86.c

Re: [PATCH] KVM: x86: fix missed hardware breakpoints

2016-02-26 Thread Paolo Bonzini
On 26/02/2016 11:42, Xiao Guangrong wrote: >> >> +vcpu->arch.switch_db_regs |= KVM_DEBUGREG_RELOAD; > > Er, i do not understand how it works. The BP is enabled in this test case so > the debug registers are always reloaded before entering guest as > KVM_DEBUGREG_BP_ENABLED bit is always set

Re: [PATCH] KVM: x86: fix missed hardware breakpoints

2016-02-26 Thread Paolo Bonzini
On 26/02/2016 11:42, Xiao Guangrong wrote: >> >> +vcpu->arch.switch_db_regs |= KVM_DEBUGREG_RELOAD; > > Er, i do not understand how it works. The BP is enabled in this test case so > the debug registers are always reloaded before entering guest as > KVM_DEBUGREG_BP_ENABLED bit is always set

Re: [PATCH] KVM: x86: fix missed hardware breakpoints

2016-02-26 Thread Nadav Amit
Xiao Guangrong wrote: > On 02/19/2016 06:56 PM, Paolo Bonzini wrote: >> Sometimes when setting a breakpoint a process doesn't stop on it. >> This is because the debug registers are not loaded correctly on >> VCPU load. >> >> >> diff --git a/arch/x86/kvm/x86.c

Re: [PATCH] KVM: x86: fix missed hardware breakpoints

2016-02-26 Thread Nadav Amit
Xiao Guangrong wrote: > On 02/19/2016 06:56 PM, Paolo Bonzini wrote: >> Sometimes when setting a breakpoint a process doesn't stop on it. >> This is because the debug registers are not loaded correctly on >> VCPU load. >> >> >> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c >> index

Re: [PATCH] KVM: x86: fix missed hardware breakpoints

2016-02-26 Thread Xiao Guangrong
On 02/19/2016 06:56 PM, Paolo Bonzini wrote: Sometimes when setting a breakpoint a process doesn't stop on it. This is because the debug registers are not loaded correctly on VCPU load. The following simple reproducer from Oleg Nesterov tries using debug registers in two threads. To see the

Re: [PATCH] KVM: x86: fix missed hardware breakpoints

2016-02-26 Thread Xiao Guangrong
On 02/19/2016 06:56 PM, Paolo Bonzini wrote: Sometimes when setting a breakpoint a process doesn't stop on it. This is because the debug registers are not loaded correctly on VCPU load. The following simple reproducer from Oleg Nesterov tries using debug registers in two threads. To see the

[PATCH] KVM: x86: fix missed hardware breakpoints

2016-02-19 Thread Paolo Bonzini
Sometimes when setting a breakpoint a process doesn't stop on it. This is because the debug registers are not loaded correctly on VCPU load. The following simple reproducer from Oleg Nesterov tries using debug registers in two threads. To see the bug, run a 2-VCPU guest under "taskset -c 0",

[PATCH] KVM: x86: fix missed hardware breakpoints

2016-02-19 Thread Paolo Bonzini
Sometimes when setting a breakpoint a process doesn't stop on it. This is because the debug registers are not loaded correctly on VCPU load. The following simple reproducer from Oleg Nesterov tries using debug registers in two threads. To see the bug, run a 2-VCPU guest under "taskset -c 0",