[Bug 65561] KVM:Entry failed on Single stepping sti instruction

2014-05-25 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=65561 --- Comment #31 from Jidong Xiao jidong.x...@gmail.com --- Hi, Paolo, I added a sti instruction in kvm-unit-tests:x86/debug.c, like this: asm volatile( pushf\n\t pop %%rax\n\t sti\n\t

[Bug 65561] KVM:Entry failed on Single stepping sti instruction

2014-05-25 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=65561 --- Comment #32 from Jatin Kumar jatin.iitde...@gmail.com --- (In reply to Jidong Xiao from comment #29) Okay, I will try the sti instruction. Jatin, since your title says that there is something wrong with the sti instruction, but looking at

[Bug 65561] KVM:Entry failed on Single stepping sti instruction

2014-05-25 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=65561 --- Comment #33 from Jidong Xiao jidong.x...@gmail.com --- Jatin, thanks for the clarification. Are you using kgdb to perform single step kernel code? I am still wondering how did you do the single step execution for kernel level code. -- You

[Bug 65561] KVM:Entry failed on Single stepping sti instruction

2014-05-25 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=65561 --- Comment #34 from Jatin Kumar jatin.iitde...@gmail.com --- (In reply to Jidong Xiao from comment #33) Jatin, thanks for the clarification. Are you using kgdb to perform single step kernel code? I am still wondering how did you do the single

[Bug 65561] KVM:Entry failed on Single stepping sti instruction

2014-05-24 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=65561 --- Comment #25 from Jidong Xiao jidong.x...@gmail.com --- (In reply to Jatin Kumar from comment #24) linux:~/code/cvedr # ./accessmsr Segmentation fault You got a seg fault because it is privileged instruction and I run it in kernel mode

[Bug 65561] KVM:Entry failed on Single stepping sti instruction

2014-05-24 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=65561 --- Comment #26 from Jatin Kumar jatin.iitde...@gmail.com --- In arch/x86/kvm/vmx.c file, there is a complete list of kvm_vmx_exit_handlers, you can find there appropriate handlers for each of the exit reasons. There is a handle_io() handler. Can

[Bug 65561] KVM:Entry failed on Single stepping sti instruction

2014-05-24 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=65561 --- Comment #27 from Jidong Xiao jidong.x...@gmail.com --- Jatin, after I have added printk in handle_io, it looks like the printk will be called very frequently, I don't need to run any own program in the guest OS, the printk message in

[Bug 65561] KVM:Entry failed on Single stepping sti instruction

2014-05-24 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=65561 --- Comment #28 from Paolo Bonzini bonz...@gnu.org --- As Jatin said, most of the time the emulator is not invoked for instructions that require intervention of the hypervisor. Instead, the processor provides enough pre-decoded information about

[Bug 65561] KVM:Entry failed on Single stepping sti instruction

2014-05-24 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=65561 --- Comment #29 from Jidong Xiao jidong.x...@gmail.com --- Okay, I will try the sti instruction. Jatin, since your title says that there is something wrong with the sti instruction, but looking at your sample code, it does not include a sti

[Bug 65561] KVM:Entry failed on Single stepping sti instruction

2014-05-23 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=65561 --- Comment #18 from Jidong Xiao jidong.x...@gmail.com --- Hi, Paolo, I am still reading the source code so as to understand the root cause of this problem. In particular, I added some printk statements in x86_emulate_insn(). For example, I added

[Bug 65561] KVM:Entry failed on Single stepping sti instruction

2014-05-23 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=65561 --- Comment #19 from Jatin Kumar jatin.iitde...@gmail.com --- I am not sure if I am correct but `add` doesn't look like any privileged or special instruction so if running with KVM it should run directly on the hardware and without needing

[Bug 65561] KVM:Entry failed on Single stepping sti instruction

2014-05-23 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=65561 --- Comment #20 from Jidong Xiao jidong.x...@gmail.com --- Thanks Jatin, I actually tried some other instructions, like accessing cr register. I use the following program: linux:~/code/cvedr # cat getcr.c #include stdio.h main(){ asm

[Bug 65561] KVM:Entry failed on Single stepping sti instruction

2014-05-23 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=65561 --- Comment #21 from Jatin Kumar jatin.iitde...@gmail.com --- The way I would approach this problem is to first check if there is a VM_EXIT while executing this instruction. You should be able to find that in vmx_vcpu_run() function (I guess in

[Bug 65561] KVM:Entry failed on Single stepping sti instruction

2014-05-23 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=65561 --- Comment #22 from Jidong Xiao jidong.x...@gmail.com --- Alright, I added a printk statement in the wrmsr case, like this: case 0x30: printk(KERN_ERR DEBUG: Passed %s %d \n,__FUNCTION__,__LINE__); /*

[Bug 65561] KVM:Entry failed on Single stepping sti instruction

2014-05-23 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=65561 --- Comment #23 from Jidong Xiao jidong.x...@gmail.com --- Jatin, do you mean that if one instruction triggers a VM_EXIT, then it won't trigger the emulate code? So why the emulate code tries to emulate those privileged instructions, like wrmsr,

[Bug 65561] KVM:Entry failed on Single stepping sti instruction

2014-05-23 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=65561 --- Comment #24 from Jatin Kumar jatin.iitde...@gmail.com --- linux:~/code/cvedr # ./accessmsr Segmentation fault You got a seg fault because it is privileged instruction and I run it in kernel mode not user mode. But you are likely to be

[Bug 65561] KVM:Entry failed on Single stepping sti instruction

2014-05-21 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=65561 --- Comment #7 from Paolo Bonzini bonz...@gnu.org --- Hi Jidong, no this is not fixed yet. Basically OUT instructions are emulated by KVM, and support for single-stepping and breakpoints in the emulator is quite minimal. 3.12 added some support

[Bug 65561] KVM:Entry failed on Single stepping sti instruction

2014-05-21 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=65561 --- Comment #8 from Jidong Xiao jidong.x...@gmail.com --- Hi, Jatin, from inside the OS means from within the Guest OS right? (In reply to Jatin Kumar from comment #5) -- You are receiving this mail because: You are watching the assignee of the

[Bug 65561] KVM:Entry failed on Single stepping sti instruction

2014-05-21 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=65561 --- Comment #9 from Jidong Xiao jidong.x...@gmail.com --- Hi, Paolo, It seems that Gleb's patch commit 03617c188f41eeeb4223c919ee7e66e5a114f2c6 KVM: VMX: mark unusable segment as nonpresent fixed a similar problem like this, look at this:

[Bug 65561] KVM:Entry failed on Single stepping sti instruction

2014-05-21 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=65561 --- Comment #10 from Paolo Bonzini bonz...@gnu.org --- No, hardware error 0x8021 includes pretty much everything that could go wrong in vmx.c. :) -- You are receiving this mail because: You are watching the assignee of the bug. -- To

[Bug 65561] KVM:Entry failed on Single stepping sti instruction

2014-05-21 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=65561 --- Comment #11 from Jidong Xiao jidong.x...@gmail.com --- Hi, Paolo, thanks for your explanation. I am interested in fixing this. So what's the technical challenge here? When you say support for single-stepping and breakpoints in the emulator is

[Bug 65561] KVM:Entry failed on Single stepping sti instruction

2014-05-21 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=65561 --- Comment #12 from Paolo Bonzini bonz...@gnu.org --- Hi, Paolo, thanks for your explanation. I am interested in fixing this. So what's the technical challenge here? The first step is to reproduce the failure. To do this you can make a patch

[Bug 65561] KVM:Entry failed on Single stepping sti instruction

2014-05-21 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=65561 --- Comment #13 from Jidong Xiao jidong.x...@gmail.com --- Great, I will try. Yes I have the inter manual and I have studied it for a while, so basically I know the data structure of VMCS. To reproduce the failure, so, if I use gdb in a guest OS,

[Bug 65561] KVM:Entry failed on Single stepping sti instruction

2014-05-21 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=65561 --- Comment #14 from Jatin Kumar jatin.iitde...@gmail.com --- (In reply to Jidong Xiao from comment #8) Hi, Jatin, from inside the OS means from within the Guest OS right? (In reply to Jatin Kumar from comment #5) Hello Jidong, Yes it means

[Bug 65561] KVM:Entry failed on Single stepping sti instruction

2014-05-21 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=65561 --- Comment #15 from Paolo Bonzini bonz...@gnu.org --- if I use gdb in a guest OS, like to debug a program inside the Guest OS, and run the single step command in gdb, that should trigger this bug right Yes. For kvm-unit-tests you would

[Bug 65561] KVM:Entry failed on Single stepping sti instruction

2014-05-21 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=65561 --- Comment #16 from Jidong Xiao jidong.x...@gmail.com --- Alright, thank you Paolo, I will try and let you know once I am done.(In reply to Paolo Bonzini from comment #15) -- You are receiving this mail because: You are watching the assignee of

[Bug 65561] KVM:Entry failed on Single stepping sti instruction

2014-05-21 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=65561 --- Comment #17 from Jidong Xiao jidong.x...@gmail.com --- Hi,Paolo, I am not familiar with kvm-unit-tests, and I cannot find any documents describe it. So I use gdb to debug. And yes I can reproduce the problem. I just use Jatin's sample code

[Bug 65561] KVM:Entry failed on Single stepping sti instruction

2014-05-20 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=65561 --- Comment #2 from Jatin Kumar jatin.iitde...@gmail.com --- Hello Jidong, thanks for the info. I will try and let you know. While you are at this, can you please help me another single stepping issue and the issue is: 1. While single stepping,

[Bug 65561] KVM:Entry failed on Single stepping sti instruction

2014-05-20 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=65561 Paolo Bonzini bonz...@gnu.org changed: What|Removed |Added CC||bonz...@gnu.org ---

[Bug 65561] KVM:Entry failed on Single stepping sti instruction

2014-05-20 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=65561 --- Comment #4 from Jidong Xiao jidong.x...@gmail.com --- Jatin, are you using gdb to do the single step?(In reply to Jatin Kumar from comment #2) -- You are receiving this mail because: You are watching the assignee of the bug. -- To

[Bug 65561] KVM:Entry failed on Single stepping sti instruction

2014-05-20 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=65561 --- Comment #5 from Jatin Kumar jatin.iitde...@gmail.com --- @Paolo: Thanks for the info. That makes sense to me. (In reply to Jidong Xiao from comment #4) Jatin, are you using gdb to do the single step?(In reply to Jatin Kumar from comment #2)

[Bug 65561] KVM:Entry failed on Single stepping sti instruction

2014-05-20 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=65561 --- Comment #6 from Jatin Kumar jatin.iitde...@gmail.com --- (In reply to Jatin Kumar from comment #5) whenever I hit an out instruction, the very next instruction is not skipped Sorry I meant 'is skipped'. -- You are receiving this mail

[Bug 65561] KVM:Entry failed on Single stepping sti instruction

2014-05-19 Thread bugzilla-daemon
https://bugzilla.kernel.org/show_bug.cgi?id=65561 Jidong Xiao jidong.x...@gmail.com changed: What|Removed |Added CC||jidong.x...@gmail.com