[PATCH 1/7] KVM: x86: Dirty the dest op page on cmpxchg emulation

2015-01-25 Thread Nadav Amit
Intel SDM says for CMPXCHG: To simplify the interface to the processor’s bus, the destination operand receives a write cycle without regard to the result of the comparison.. This means the destination page should be dirtied. Fix it to by writing back the original value if cmpxchg failed.

[PATCH 5/7] KVM: x86: Fix defines in emulator.c

2015-01-25 Thread Nadav Amit
Unnecassary define was left after commit 7d882ffa81d5 (KVM: x86: Revert NoBigReal patch in the emulator”). Commit 39f062ff51b2 (KVM: x86: Generate #UD when memory operand is required”) was missing undef. Fix it. Signed-off-by: Nadav Amit na...@cs.technion.ac.il --- arch/x86/kvm/emulate.c | 2

[PATCH 4/7] KVM: x86: ARPL emulation can cause spurious exceptions

2015-01-25 Thread Nadav Amit
ARPL and MOVSXD are encoded the same and their execution depends on the execution mode. The operand sizes of each instruction are different. Currently, ARPL is detected too late, after the decoding was already done, and therefore may result in spurious exception (instead of failed emulation).

[PATCH 3/7] KVM: x86: IRET emulation does not clear NMI masking

2015-01-25 Thread Nadav Amit
The IRET instruction should clear NMI masking, but the current implementation does not do so. Signed-off-by: Nadav Amit na...@cs.technion.ac.il --- arch/x86/include/asm/kvm_emulate.h | 1 + arch/x86/kvm/emulate.c | 1 + arch/x86/kvm/x86.c | 6 ++ 3 files changed,

[PATCH 6/7] KVM: x86: 32-bit wraparound read/write not emulated correctly

2015-01-25 Thread Nadav Amit
If we got a wraparound of 32-bit operand, and the limit is 0x, read and writes should be successful. It just needs to be done in two segments. Signed-off-by: Nadav Amit na...@cs.technion.ac.il --- arch/x86/kvm/emulate.c | 10 +++--- arch/x86/kvm/x86.c | 2 ++ 2 files changed, 9

[PATCH 7/7] KVM: x86: Emulation of call may use incorrect stack size

2015-01-25 Thread Nadav Amit
On long-mode, when far call that changes cs.l takes place, the stack size is determined by the new mode. For instance, if we go from 32-bit mode to 64-bit mode, the stack-size if 64. KVM uses the old stack size. Fix it. Signed-off-by: Nadav Amit na...@cs.technion.ac.il ---

[PATCH 2/7] KVM: x86: Wrong operand size for far ret

2015-01-25 Thread Nadav Amit
Indeed, Intel SDM specifically states that for the RET instruction In 64-bit mode, the default operation size of this instruction is the stack-address size, i.e. 64 bits. However, experiments show this is not the case. Here is for example objdump of small 64-bit asm: 4004f1: ca 14 00

[PATCH 0/7] KVM: x86: Emulator fixes

2015-01-25 Thread Nadav Amit
Sorry for sending patches at the last minute. There is nothing critical in this patch-set. Yet, if you may want to incorporate something in 3.20 - specifically 5 (small define mistakes) or 7 (which is somewhat affected by recent changes). Thanks for reviewing the patches. Nadav Amit (7): KVM:

Re: [question] incremental backup a running vm

2015-01-25 Thread Zhang Haoyu
On 2015-01-23 07:30:19, Kashyap Chamarthy wrote: On Wed, Jan 21, 2015 at 11:39:44AM +0100, Paolo Bonzini wrote: On 21/01/2015 11:32, Zhang Haoyu wrote: Hi, Does drive_mirror support incremental backup a running vm? Or other mechanism does? incremental backup a running vm