Re: trouble with dvd drives
On Sat, Apr 11, 2009 at 11:31:41PM -0500, Gene Horodecki wrote: Hi there.. I have a new machine with an AMD Phenom processor and two fairly average LG DVD burners. I've gotten to the point that I seem to be able to see both but they are not coming up as writable drives.. AFAIK the IDE device emulation from QEMU only supports up to (incomplete) DVD-ROM profile, hence why support for writting isn't working. Carlo -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 01/10] Add decoding of 16bit second immediate argument.
Such as segment number in lcall/ljmp Signed-off-by: Gleb Natapov g...@redhat.com --- arch/x86/kvm/x86_emulate.c |7 +++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c index d7c9f6f..c015063 100644 --- a/arch/x86/kvm/x86_emulate.c +++ b/arch/x86/kvm/x86_emulate.c @@ -76,6 +76,7 @@ #define Src2CL (129) #define Src2ImmByte (229) #define Src2One (329) +#define Src2Imm16 (429) #define Src2Mask(729) enum { @@ -1072,6 +1073,12 @@ done_prefixes: c-src2.bytes = 1; c-src2.val = insn_fetch(u8, 1, c-eip); break; + case Src2Imm16: + c-src2.type = OP_IMM; + c-src2.ptr = (unsigned long *)c-eip; + c-src2.bytes = 2; + c-src2.val = insn_fetch(u16, 2, c-eip); + break; case Src2One: c-src2.bytes = 1; c-src2.val = 1; -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 02/10] Add lcall decoding.
No emulation yet. Signed-off-by: Gleb Natapov g...@redhat.com --- arch/x86/kvm/x86_emulate.c |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c index c015063..0dd50d3 100644 --- a/arch/x86/kvm/x86_emulate.c +++ b/arch/x86/kvm/x86_emulate.c @@ -154,7 +154,8 @@ static u32 opcode_table[256] = { /* 0x90 - 0x97 */ DstReg, DstReg, DstReg, DstReg, DstReg, DstReg, DstReg, DstReg, /* 0x98 - 0x9F */ - 0, 0, 0, 0, ImplicitOps | Stack, ImplicitOps | Stack, 0, 0, + 0, 0, SrcImm | Src2Imm16 | ImplicitOps, 0, + ImplicitOps | Stack, ImplicitOps | Stack, 0, 0, /* 0xA0 - 0xA7 */ ByteOp | DstReg | SrcMem | Mov | MemAbs, DstReg | SrcMem | Mov | MemAbs, ByteOp | DstMem | SrcReg | Mov | MemAbs, DstMem | SrcReg | Mov | MemAbs, -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 03/10] Complete ljmp decoding at decode stage.
Signed-off-by: Gleb Natapov g...@redhat.com --- arch/x86/kvm/x86_emulate.c | 25 + 1 files changed, 5 insertions(+), 20 deletions(-) diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c index 0dd50d3..3026929 100644 --- a/arch/x86/kvm/x86_emulate.c +++ b/arch/x86/kvm/x86_emulate.c @@ -193,7 +193,7 @@ static u32 opcode_table[256] = { SrcNone | ByteOp | ImplicitOps, SrcNone | ImplicitOps, /* 0xE8 - 0xEF */ ImplicitOps | Stack, SrcImm | ImplicitOps, - ImplicitOps, SrcImmByte | ImplicitOps, + SrcImm | Src2Imm16 | ImplicitOps, SrcImmByte | ImplicitOps, SrcNone | ByteOp | ImplicitOps, SrcNone | ImplicitOps, SrcNone | ByteOp | ImplicitOps, SrcNone | ImplicitOps, /* 0xF0 - 0xF7 */ @@ -1805,30 +1805,15 @@ special_insn: } case 0xe9: /* jmp rel */ goto jmp; - case 0xea: /* jmp far */ { - uint32_t eip; - uint16_t sel; - - switch (c-op_bytes) { - case 2: - eip = insn_fetch(u16, 2, c-eip); - break; - case 4: - eip = insn_fetch(u32, 4, c-eip); - break; - default: - DPRINTF(jmp far: Invalid op_bytes\n); - goto cannot_emulate; - } - sel = insn_fetch(u16, 2, c-eip); - if (kvm_load_segment_descriptor(ctxt-vcpu, sel, 9, VCPU_SREG_CS) 0) { + case 0xea: /* jmp far */ + if (kvm_load_segment_descriptor(ctxt-vcpu, c-src2.val, 9, + VCPU_SREG_CS) 0) { DPRINTF(jmp far: Failed to load CS descriptor\n); goto cannot_emulate; } - c-eip = eip; + c-eip = c-src.val; break; - } case 0xeb: jmp: /* jmp rel short */ jmp_rel(c, c-src.val); -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 04/10] Complete short/near jcc decoding in decode stage.
Signed-off-by: Gleb Natapov g...@redhat.com --- arch/x86/kvm/x86_emulate.c | 50 1 files changed, 18 insertions(+), 32 deletions(-) diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c index 3026929..0ca8b60 100644 --- a/arch/x86/kvm/x86_emulate.c +++ b/arch/x86/kvm/x86_emulate.c @@ -136,11 +136,15 @@ static u32 opcode_table[256] = { SrcNone | ByteOp | ImplicitOps, SrcNone | ImplicitOps, /* insb, insw/insd */ SrcNone | ByteOp | ImplicitOps, SrcNone | ImplicitOps, /* outsb, outsw/outsd */ /* 0x70 - 0x77 */ - ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps, - ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps, + ImplicitOps | SrcImmByte, ImplicitOps | SrcImmByte, + ImplicitOps | SrcImmByte, ImplicitOps | SrcImmByte, + ImplicitOps | SrcImmByte, ImplicitOps | SrcImmByte, + ImplicitOps | SrcImmByte, ImplicitOps | SrcImmByte, /* 0x78 - 0x7F */ - ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps, - ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps, + ImplicitOps | SrcImmByte, ImplicitOps | SrcImmByte, + ImplicitOps | SrcImmByte, ImplicitOps | SrcImmByte, + ImplicitOps | SrcImmByte, ImplicitOps | SrcImmByte, + ImplicitOps | SrcImmByte, ImplicitOps | SrcImmByte, /* 0x80 - 0x87 */ Group | Group1_80, Group | Group1_81, Group | Group1_82, Group | Group1_83, @@ -232,10 +236,12 @@ static u32 twobyte_table[256] = { /* 0x70 - 0x7F */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80 - 0x8F */ - ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps, - ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps, - ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps, - ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps, + SrcImm | ImplicitOps, SrcImm | ImplicitOps, SrcImm | ImplicitOps, + SrcImm | ImplicitOps, SrcImm | ImplicitOps, SrcImm | ImplicitOps, + SrcImm | ImplicitOps, SrcImm | ImplicitOps, SrcImm | ImplicitOps, + SrcImm | ImplicitOps, SrcImm | ImplicitOps, SrcImm | ImplicitOps, + SrcImm | ImplicitOps, SrcImm | ImplicitOps, SrcImm | ImplicitOps, + SrcImm | ImplicitOps, /* 0x90 - 0x9F */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xA0 - 0xA7 */ @@ -1539,13 +1545,10 @@ special_insn: return -1; } return 0; - case 0x70 ... 0x7f: /* jcc (short) */ { - int rel = insn_fetch(s8, 1, c-eip); - + case 0x70 ... 0x7f: /* jcc (short) */ if (test_cc(c-b, ctxt-eflags)) - jmp_rel(c, rel); + jmp_rel(c, c-src.val); break; - } case 0x80 ... 0x83: /* Grp1 */ switch (c-modrm_reg) { case 0: @@ -2031,28 +2034,11 @@ twobyte_insn: if (!test_cc(c-b, ctxt-eflags)) c-dst.type = OP_NONE; /* no writeback */ break; - case 0x80 ... 0x8f: /* jnz rel, etc*/ { - long int rel; - - switch (c-op_bytes) { - case 2: - rel = insn_fetch(s16, 2, c-eip); - break; - case 4: - rel = insn_fetch(s32, 4, c-eip); - break; - case 8: - rel = insn_fetch(s64, 8, c-eip); - break; - default: - DPRINTF(jnz: Invalid op_bytes\n); - goto cannot_emulate; - } + case 0x80 ... 0x8f: /* jnz rel, etc*/ if (test_cc(c-b, ctxt-eflags)) - jmp_rel(c, rel); + jmp_rel(c, c-src.val); c-dst.type = OP_NONE; break; - } case 0xa3: bt: /* bt */ c-dst.type = OP_NONE; -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 05/10] Complete decoding of call near in decode stage.
Signed-off-by: Gleb Natapov g...@redhat.com --- arch/x86/kvm/x86_emulate.c | 15 ++- 1 files changed, 2 insertions(+), 13 deletions(-) diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c index 0ca8b60..6b5f9bc 100644 --- a/arch/x86/kvm/x86_emulate.c +++ b/arch/x86/kvm/x86_emulate.c @@ -196,7 +196,7 @@ static u32 opcode_table[256] = { SrcNone | ByteOp | ImplicitOps, SrcNone | ImplicitOps, SrcNone | ByteOp | ImplicitOps, SrcNone | ImplicitOps, /* 0xE8 - 0xEF */ - ImplicitOps | Stack, SrcImm | ImplicitOps, + SrcImm | ImplicitOps | Stack, SrcImm | ImplicitOps, SrcImm | Src2Imm16 | ImplicitOps, SrcImmByte | ImplicitOps, SrcNone | ByteOp | ImplicitOps, SrcNone | ImplicitOps, SrcNone | ByteOp | ImplicitOps, SrcNone | ImplicitOps, @@ -1789,18 +1789,7 @@ special_insn: io_dir_in = 0; goto do_io; case 0xe8: /* call (near) */ { - long int rel; - switch (c-op_bytes) { - case 2: - rel = insn_fetch(s16, 2, c-eip); - break; - case 4: - rel = insn_fetch(s32, 4, c-eip); - break; - default: - DPRINTF(Call: Invalid op_bytes\n); - goto cannot_emulate; - } + long int rel = c-src.val; c-src.val = (unsigned long) c-eip; jmp_rel(c, rel); emulate_push(ctxt); -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 06/10] Add unsigned byte immediate decode.
Extend Source operand type opcode description field to 4 bites to accommodate new option. Signed-off-by: Gleb Natapov g...@redhat.com --- arch/x86/kvm/x86_emulate.c | 17 +++-- 1 files changed, 11 insertions(+), 6 deletions(-) diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c index 6b5f9bc..5a58344 100644 --- a/arch/x86/kvm/x86_emulate.c +++ b/arch/x86/kvm/x86_emulate.c @@ -59,13 +59,14 @@ #define SrcImm (54) /* Immediate operand. */ #define SrcImmByte (64) /* 8-bit sign-extended immediate operand. */ #define SrcOne (74) /* Implied '1' */ -#define SrcMask (74) +#define SrcImmUByte (84) /* 8-bit unsigned immediate operand. */ +#define SrcMask (0xf4) /* Generic ModRM decode. */ -#define ModRM (17) +#define ModRM (18) /* Destination is only written; never read. */ -#define Mov (18) -#define BitOp (19) -#define MemAbs (110) /* Memory operand is absolute displacement */ +#define Mov (19) +#define BitOp (110) +#define MemAbs (111) /* Memory operand is absolute displacement */ #define String (112) /* String instruction (rep capable) */ #define Stack (113) /* Stack instruction (push/pop) */ #define Group (114) /* Bits 3:5 of modrm byte extend opcode */ @@ -1052,10 +1053,14 @@ done_prefixes: } break; case SrcImmByte: + case SrcImmUByte: c-src.type = OP_IMM; c-src.ptr = (unsigned long *)c-eip; c-src.bytes = 1; - c-src.val = insn_fetch(s8, 1, c-eip); + if ((c-d SrcMask) == SrcImmByte) + c-src.val = insn_fetch(s8, 1, c-eip); + else + c-src.val = insn_fetch(u8, 1, c-eip); break; case SrcOne: c-src.bytes = 1; -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 07/10] Completely decode in/out at decoding stage.
Signed-off-by: Gleb Natapov g...@redhat.com --- arch/x86/kvm/x86_emulate.c | 10 ++ 1 files changed, 6 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c index 5a58344..4ebc628 100644 --- a/arch/x86/kvm/x86_emulate.c +++ b/arch/x86/kvm/x86_emulate.c @@ -194,8 +194,10 @@ static u32 opcode_table[256] = { 0, 0, 0, 0, 0, 0, 0, 0, /* 0xE0 - 0xE7 */ 0, 0, 0, 0, - SrcNone | ByteOp | ImplicitOps, SrcNone | ImplicitOps, - SrcNone | ByteOp | ImplicitOps, SrcNone | ImplicitOps, + SrcNone | ByteOp | SrcImmUByte | ImplicitOps, + SrcNone | SrcImmUByte | ImplicitOps, + SrcNone | ByteOp | SrcImmUByte | ImplicitOps, + SrcNone | SrcImmUByte | ImplicitOps, /* 0xE8 - 0xEF */ SrcImm | ImplicitOps | Stack, SrcImm | ImplicitOps, SrcImm | Src2Imm16 | ImplicitOps, SrcImmByte | ImplicitOps, @@ -1785,12 +1787,12 @@ special_insn: break; case 0xe4: /* inb */ case 0xe5: /* in */ - port = insn_fetch(u8, 1, c-eip); + port = c-src.val; io_dir_in = 1; goto do_io; case 0xe6: /* outb */ case 0xe7: /* out */ - port = insn_fetch(u8, 1, c-eip); + port = c-src.val; io_dir_in = 0; goto do_io; case 0xe8: /* call (near) */ { -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 08/10] Decode soft interrupt instructions.
Do not emulate them yet. Signed-off-by: Gleb Natapov g...@redhat.com --- arch/x86/kvm/x86_emulate.c |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c index 4ebc628..28b244e 100644 --- a/arch/x86/kvm/x86_emulate.c +++ b/arch/x86/kvm/x86_emulate.c @@ -185,7 +185,8 @@ static u32 opcode_table[256] = { 0, ImplicitOps | Stack, 0, 0, ByteOp | DstMem | SrcImm | ModRM | Mov, DstMem | SrcImm | ModRM | Mov, /* 0xC8 - 0xCF */ - 0, 0, 0, ImplicitOps | Stack, 0, 0, 0, 0, + 0, 0, 0, ImplicitOps | Stack, ImplicitOps, ImplicitOps | SrcImmByte, + ImplicitOps, ImplicitOps, /* 0xD0 - 0xD7 */ ByteOp | DstMem | SrcImplicit | ModRM, DstMem | SrcImplicit | ModRM, ByteOp | DstMem | SrcImplicit | ModRM, DstMem | SrcImplicit | ModRM, -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 09/10] Add new mode of instruction emulation: skip.
In the new mode instruction is decoded, but not executed. The EIP is moved to point after the instruction. Signed-off-by: Gleb Natapov g...@redhat.com --- arch/x86/include/asm/kvm_host.h |1 + arch/x86/kvm/x86.c |5 + 2 files changed, 6 insertions(+), 0 deletions(-) diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index 3fc4623..e672ca5 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h @@ -565,6 +565,7 @@ enum emulation_result { #define EMULTYPE_NO_DECODE (1 0) #define EMULTYPE_TRAP_UD (1 1) +#define EMULTYPE_SKIP (1 2) int emulate_instruction(struct kvm_vcpu *vcpu, struct kvm_run *run, unsigned long cr2, u16 error_code, int emulation_type); void kvm_report_emulation_failure(struct kvm_vcpu *cvpu, const char *context); diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 0bb4131..52c7a29 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -2412,6 +2412,11 @@ int emulate_instruction(struct kvm_vcpu *vcpu, } } + if (emulation_type EMULTYPE_SKIP) { + kvm_rip_write(vcpu, vcpu-arch.emulate_ctxt.decode.eip); + return EMULATE_DONE; + } + r = x86_emulate_insn(vcpu-arch.emulate_ctxt, emulate_ops); if (vcpu-arch.pio.string) -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v2 10/10] [AMD] Skip instruction on a task switch only when appropriate.
If a task switch was initiated because off a task gate in IDT and IDT was accessed because of an external even the instruction should not be skipped. Signed-off-by: Gleb Natapov g...@redhat.com --- arch/x86/kvm/svm.c | 11 +-- 1 files changed, 9 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 3ffb695..053f3c5 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -1826,6 +1826,7 @@ static int task_switch_interception(struct vcpu_svm *svm, int reason; int int_type = svm-vmcb-control.exit_int_info SVM_EXITINTINFO_TYPE_MASK; + int int_vec = svm-vmcb-control.exit_int_info SVM_EVTINJ_VEC_MASK; tss_selector = (u16)svm-vmcb-control.exit_info_1; @@ -1841,8 +1842,14 @@ static int task_switch_interception(struct vcpu_svm *svm, reason = TASK_SWITCH_CALL; - if (reason != TASK_SWITCH_GATE || int_type == SVM_EXITINTINFO_TYPE_SOFT) - skip_emulated_instruction(svm-vcpu); + if (reason != TASK_SWITCH_GATE || + int_type == SVM_EXITINTINFO_TYPE_SOFT || + (int_type == SVM_EXITINTINFO_TYPE_EXEPT +(int_vec == OF_VECTOR || int_vec == BP_VECTOR))) { + if (emulate_instruction(svm-vcpu, kvm_run, 0, 0, + EMULTYPE_SKIP) != EMULATE_DONE) + return 0; + } return kvm_task_switch(svm-vcpu, tss_selector, reason); } -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/3] kvm: dont hold pagecount reference for mapped sptes pages.
Izik Eidus wrote: Marcelo Tosatti wrote: On Tue, Mar 31, 2009 at 03:00:02AM +0300, Izik Eidus wrote: When using mmu notifiers, we are allowed to remove the page count reference tooken by get_user_pages to a specific page that is mapped inside the shadow page tables. This is needed so we can balance the pagecount against mapcount checking. (Right now kvm increase the pagecount and does not increase the mapcount when mapping page into shadow page table entry, so when comparing pagecount against mapcount, you have no reliable result.) IMO ifdef'ing CONFIG_MMU_NOTIFIERS here (and keeping the ref if unset) instead of in the backward compat code gives less room for headaches. That was the first version of this patch, Avi preferred not to do it... Avi, You mind if i changed it to use the IFDEF ? -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 1/3] kvm: dont hold pagecount reference for mapped sptes pages.
Izik Eidus wrote: Izik Eidus wrote: Marcelo Tosatti wrote: On Tue, Mar 31, 2009 at 03:00:02AM +0300, Izik Eidus wrote: When using mmu notifiers, we are allowed to remove the page count reference tooken by get_user_pages to a specific page that is mapped inside the shadow page tables. This is needed so we can balance the pagecount against mapcount checking. (Right now kvm increase the pagecount and does not increase the mapcount when mapping page into shadow page table entry, so when comparing pagecount against mapcount, you have no reliable result.) IMO ifdef'ing CONFIG_MMU_NOTIFIERS here (and keeping the ref if unset) instead of in the backward compat code gives less room for headaches. That was the first version of this patch, Avi preferred not to do it... Avi, You mind if i changed it to use the IFDEF ? No, let's not have too many ifdefs in the code. I'll hack it in hack-module.awk. -- error compiling committee.c: too many arguments to function -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 04/10] Complete short/near jcc decoding in decode stage.
Signed-off-by: Gleb Natapov g...@redhat.com --- arch/x86/kvm/x86_emulate.c | 42 ++ 1 files changed, 10 insertions(+), 32 deletions(-) diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c index 8779cf2..14b8ee2 100644 --- a/arch/x86/kvm/x86_emulate.c +++ b/arch/x86/kvm/x86_emulate.c @@ -136,11 +136,11 @@ static u32 opcode_table[256] = { SrcNone | ByteOp | ImplicitOps, SrcNone | ImplicitOps, /* insb, insw/insd */ SrcNone | ByteOp | ImplicitOps, SrcNone | ImplicitOps, /* outsb, outsw/outsd */ /* 0x70 - 0x77 */ - ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps, - ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps, + SrcImmByte, SrcImmByte, SrcImmByte, SrcImmByte, + SrcImmByte, SrcImmByte, SrcImmByte, SrcImmByte, /* 0x78 - 0x7F */ - ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps, - ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps, + SrcImmByte, SrcImmByte, SrcImmByte, SrcImmByte, + SrcImmByte, SrcImmByte, SrcImmByte, SrcImmByte, /* 0x80 - 0x87 */ Group | Group1_80, Group | Group1_81, Group | Group1_82, Group | Group1_83, @@ -232,10 +232,8 @@ static u32 twobyte_table[256] = { /* 0x70 - 0x7F */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x80 - 0x8F */ - ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps, - ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps, - ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps, - ImplicitOps, ImplicitOps, ImplicitOps, ImplicitOps, + SrcImm, SrcImm, SrcImm, SrcImm, SrcImm, SrcImm, SrcImm, SrcImm, + SrcImm, SrcImm, SrcImm, SrcImm, SrcImm, SrcImm, SrcImm, SrcImm, /* 0x90 - 0x9F */ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0xA0 - 0xA7 */ @@ -1539,13 +1537,10 @@ special_insn: return -1; } return 0; - case 0x70 ... 0x7f: /* jcc (short) */ { - int rel = insn_fetch(s8, 1, c-eip); - + case 0x70 ... 0x7f: /* jcc (short) */ if (test_cc(c-b, ctxt-eflags)) - jmp_rel(c, rel); + jmp_rel(c, c-src.val); break; - } case 0x80 ... 0x83: /* Grp1 */ switch (c-modrm_reg) { case 0: @@ -2031,28 +2026,11 @@ twobyte_insn: if (!test_cc(c-b, ctxt-eflags)) c-dst.type = OP_NONE; /* no writeback */ break; - case 0x80 ... 0x8f: /* jnz rel, etc*/ { - long int rel; - - switch (c-op_bytes) { - case 2: - rel = insn_fetch(s16, 2, c-eip); - break; - case 4: - rel = insn_fetch(s32, 4, c-eip); - break; - case 8: - rel = insn_fetch(s64, 8, c-eip); - break; - default: - DPRINTF(jnz: Invalid op_bytes\n); - goto cannot_emulate; - } + case 0x80 ... 0x8f: /* jnz rel, etc*/ if (test_cc(c-b, ctxt-eflags)) - jmp_rel(c, rel); + jmp_rel(c, c-src.val); c-dst.type = OP_NONE; break; - } case 0xa3: bt: /* bt */ c-dst.type = OP_NONE; -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 05/10] Complete decoding of call near in decode stage.
Signed-off-by: Gleb Natapov g...@redhat.com --- arch/x86/kvm/x86_emulate.c | 15 ++- 1 files changed, 2 insertions(+), 13 deletions(-) diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c index 14b8ee2..4a9cd4c 100644 --- a/arch/x86/kvm/x86_emulate.c +++ b/arch/x86/kvm/x86_emulate.c @@ -192,7 +192,7 @@ static u32 opcode_table[256] = { SrcNone | ByteOp | ImplicitOps, SrcNone | ImplicitOps, SrcNone | ByteOp | ImplicitOps, SrcNone | ImplicitOps, /* 0xE8 - 0xEF */ - ImplicitOps | Stack, SrcImm | ImplicitOps, + SrcImm | Stack, SrcImm | ImplicitOps, SrcImm | Src2Imm16, SrcImmByte | ImplicitOps, SrcNone | ByteOp | ImplicitOps, SrcNone | ImplicitOps, SrcNone | ByteOp | ImplicitOps, SrcNone | ImplicitOps, @@ -1781,18 +1781,7 @@ special_insn: io_dir_in = 0; goto do_io; case 0xe8: /* call (near) */ { - long int rel; - switch (c-op_bytes) { - case 2: - rel = insn_fetch(s16, 2, c-eip); - break; - case 4: - rel = insn_fetch(s32, 4, c-eip); - break; - default: - DPRINTF(Call: Invalid op_bytes\n); - goto cannot_emulate; - } + long int rel = c-src.val; c-src.val = (unsigned long) c-eip; jmp_rel(c, rel); emulate_push(ctxt); -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 06/10] Add unsigned byte immediate decode.
Extend Source operand type opcode description field to 4 bites to accommodate new option. Signed-off-by: Gleb Natapov g...@redhat.com --- arch/x86/kvm/x86_emulate.c | 17 +++-- 1 files changed, 11 insertions(+), 6 deletions(-) diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c index 4a9cd4c..0988a13 100644 --- a/arch/x86/kvm/x86_emulate.c +++ b/arch/x86/kvm/x86_emulate.c @@ -59,13 +59,14 @@ #define SrcImm (54) /* Immediate operand. */ #define SrcImmByte (64) /* 8-bit sign-extended immediate operand. */ #define SrcOne (74) /* Implied '1' */ -#define SrcMask (74) +#define SrcImmUByte (84) /* 8-bit unsigned immediate operand. */ +#define SrcMask (0xf4) /* Generic ModRM decode. */ -#define ModRM (17) +#define ModRM (18) /* Destination is only written; never read. */ -#define Mov (18) -#define BitOp (19) -#define MemAbs (110) /* Memory operand is absolute displacement */ +#define Mov (19) +#define BitOp (110) +#define MemAbs (111) /* Memory operand is absolute displacement */ #define String (112) /* String instruction (rep capable) */ #define Stack (113) /* Stack instruction (push/pop) */ #define Group (114) /* Bits 3:5 of modrm byte extend opcode */ @@ -1044,10 +1045,14 @@ done_prefixes: } break; case SrcImmByte: + case SrcImmUByte: c-src.type = OP_IMM; c-src.ptr = (unsigned long *)c-eip; c-src.bytes = 1; - c-src.val = insn_fetch(s8, 1, c-eip); + if ((c-d SrcMask) == SrcImmByte) + c-src.val = insn_fetch(s8, 1, c-eip); + else + c-src.val = insn_fetch(u8, 1, c-eip); break; case SrcOne: c-src.bytes = 1; -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 07/10] Completely decode in/out at decoding stage.
Signed-off-by: Gleb Natapov g...@redhat.com --- arch/x86/kvm/x86_emulate.c |8 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c index 0988a13..c2f55ca 100644 --- a/arch/x86/kvm/x86_emulate.c +++ b/arch/x86/kvm/x86_emulate.c @@ -190,8 +190,8 @@ static u32 opcode_table[256] = { 0, 0, 0, 0, 0, 0, 0, 0, /* 0xE0 - 0xE7 */ 0, 0, 0, 0, - SrcNone | ByteOp | ImplicitOps, SrcNone | ImplicitOps, - SrcNone | ByteOp | ImplicitOps, SrcNone | ImplicitOps, + ByteOp | SrcImmUByte, SrcImmUByte, + ByteOp | SrcImmUByte, SrcImmUByte, /* 0xE8 - 0xEF */ SrcImm | Stack, SrcImm | ImplicitOps, SrcImm | Src2Imm16, SrcImmByte | ImplicitOps, @@ -1777,12 +1777,12 @@ special_insn: break; case 0xe4: /* inb */ case 0xe5: /* in */ - port = insn_fetch(u8, 1, c-eip); + port = c-src.val; io_dir_in = 1; goto do_io; case 0xe6: /* outb */ case 0xe7: /* out */ - port = insn_fetch(u8, 1, c-eip); + port = c-src.val; io_dir_in = 0; goto do_io; case 0xe8: /* call (near) */ { -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 08/10] Decode soft interrupt instructions.
Do not emulate them yet. Signed-off-by: Gleb Natapov g...@redhat.com --- arch/x86/kvm/x86_emulate.c |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c index c2f55ca..d2664fc 100644 --- a/arch/x86/kvm/x86_emulate.c +++ b/arch/x86/kvm/x86_emulate.c @@ -181,7 +181,8 @@ static u32 opcode_table[256] = { 0, ImplicitOps | Stack, 0, 0, ByteOp | DstMem | SrcImm | ModRM | Mov, DstMem | SrcImm | ModRM | Mov, /* 0xC8 - 0xCF */ - 0, 0, 0, ImplicitOps | Stack, 0, 0, 0, 0, + 0, 0, 0, ImplicitOps | Stack, + ImplicitOps, SrcImmByte, ImplicitOps, ImplicitOps, /* 0xD0 - 0xD7 */ ByteOp | DstMem | SrcImplicit | ModRM, DstMem | SrcImplicit | ModRM, ByteOp | DstMem | SrcImplicit | ModRM, DstMem | SrcImplicit | ModRM, -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 09/10] Add new mode of instruction emulation: skip.
In the new mode instruction is decoded, but not executed. The EIP is moved to point after the instruction. Signed-off-by: Gleb Natapov g...@redhat.com --- arch/x86/include/asm/kvm_host.h |1 + arch/x86/kvm/x86.c |5 + 2 files changed, 6 insertions(+), 0 deletions(-) diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index 3fc4623..e672ca5 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h @@ -565,6 +565,7 @@ enum emulation_result { #define EMULTYPE_NO_DECODE (1 0) #define EMULTYPE_TRAP_UD (1 1) +#define EMULTYPE_SKIP (1 2) int emulate_instruction(struct kvm_vcpu *vcpu, struct kvm_run *run, unsigned long cr2, u16 error_code, int emulation_type); void kvm_report_emulation_failure(struct kvm_vcpu *cvpu, const char *context); diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 0bb4131..52c7a29 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -2412,6 +2412,11 @@ int emulate_instruction(struct kvm_vcpu *vcpu, } } + if (emulation_type EMULTYPE_SKIP) { + kvm_rip_write(vcpu, vcpu-arch.emulate_ctxt.decode.eip); + return EMULATE_DONE; + } + r = x86_emulate_insn(vcpu-arch.emulate_ctxt, emulate_ops); if (vcpu-arch.pio.string) -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 10/10] [AMD] Skip instruction on a task switch only when appropriate.
If a task switch was initiated because off a task gate in IDT and IDT was accessed because of an external even the instruction should not be skipped. Signed-off-by: Gleb Natapov g...@redhat.com --- arch/x86/kvm/svm.c | 11 +-- 1 files changed, 9 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c index 3ffb695..053f3c5 100644 --- a/arch/x86/kvm/svm.c +++ b/arch/x86/kvm/svm.c @@ -1826,6 +1826,7 @@ static int task_switch_interception(struct vcpu_svm *svm, int reason; int int_type = svm-vmcb-control.exit_int_info SVM_EXITINTINFO_TYPE_MASK; + int int_vec = svm-vmcb-control.exit_int_info SVM_EVTINJ_VEC_MASK; tss_selector = (u16)svm-vmcb-control.exit_info_1; @@ -1841,8 +1842,14 @@ static int task_switch_interception(struct vcpu_svm *svm, reason = TASK_SWITCH_CALL; - if (reason != TASK_SWITCH_GATE || int_type == SVM_EXITINTINFO_TYPE_SOFT) - skip_emulated_instruction(svm-vcpu); + if (reason != TASK_SWITCH_GATE || + int_type == SVM_EXITINTINFO_TYPE_SOFT || + (int_type == SVM_EXITINTINFO_TYPE_EXEPT +(int_vec == OF_VECTOR || int_vec == BP_VECTOR))) { + if (emulate_instruction(svm-vcpu, kvm_run, 0, 0, + EMULTYPE_SKIP) != EMULATE_DONE) + return 0; + } return kvm_task_switch(svm-vcpu, tss_selector, reason); } -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH v3 03/10] Complete ljmp decoding at decode stage.
Signed-off-by: Gleb Natapov g...@redhat.com --- arch/x86/kvm/x86_emulate.c | 25 + 1 files changed, 5 insertions(+), 20 deletions(-) diff --git a/arch/x86/kvm/x86_emulate.c b/arch/x86/kvm/x86_emulate.c index 71b4bee..8779cf2 100644 --- a/arch/x86/kvm/x86_emulate.c +++ b/arch/x86/kvm/x86_emulate.c @@ -193,7 +193,7 @@ static u32 opcode_table[256] = { SrcNone | ByteOp | ImplicitOps, SrcNone | ImplicitOps, /* 0xE8 - 0xEF */ ImplicitOps | Stack, SrcImm | ImplicitOps, - ImplicitOps, SrcImmByte | ImplicitOps, + SrcImm | Src2Imm16, SrcImmByte | ImplicitOps, SrcNone | ByteOp | ImplicitOps, SrcNone | ImplicitOps, SrcNone | ByteOp | ImplicitOps, SrcNone | ImplicitOps, /* 0xF0 - 0xF7 */ @@ -1805,30 +1805,15 @@ special_insn: } case 0xe9: /* jmp rel */ goto jmp; - case 0xea: /* jmp far */ { - uint32_t eip; - uint16_t sel; - - switch (c-op_bytes) { - case 2: - eip = insn_fetch(u16, 2, c-eip); - break; - case 4: - eip = insn_fetch(u32, 4, c-eip); - break; - default: - DPRINTF(jmp far: Invalid op_bytes\n); - goto cannot_emulate; - } - sel = insn_fetch(u16, 2, c-eip); - if (kvm_load_segment_descriptor(ctxt-vcpu, sel, 9, VCPU_SREG_CS) 0) { + case 0xea: /* jmp far */ + if (kvm_load_segment_descriptor(ctxt-vcpu, c-src2.val, 9, + VCPU_SREG_CS) 0) { DPRINTF(jmp far: Failed to load CS descriptor\n); goto cannot_emulate; } - c-eip = eip; + c-eip = c-src.val; break; - } case 0xeb: jmp: /* jmp rel short */ jmp_rel(c, c-src.val); -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
kvm-autotest: a modified step-file format and steps-data image names
Hello, I've just pushed some new commits of kvm-autotest. One thing that have changed is the way we name steps-data images (and as a result a minor change to the step files format). If you have created your own step-files (and have the automatically-generated steps-data images for them), you need to convert them (both step-files and steps-data image names). Please look at the following link for explanation of why the change is done and for instructions of how to convert your step files. http://kvm.et.redhat.com/page/KVM-Autotest/Steps look at Conversion to the new step file format (April 2009) This mainly affects debugging capability upon a steps type test failure. Thanks, Uri. -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] KVM: Defer remote tlb flushes on invlpg (v4)
Hi Andrea, On Sat, Apr 11, 2009 at 06:48:54PM +0200, Andrea Arcangeli wrote: On Sun, Mar 29, 2009 at 01:36:01PM +0300, Avi Kivity wrote: Marcelo, Andrea? Had to read the code a bit more to understand the reason of the unsync_mmu flush in cr3 overwrite. Avi Kivity wrote: diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 2a36f7f..f0ea56c 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -1184,8 +1184,7 @@ static void mmu_sync_children(struct kvm_vcpu *vcpu, for_each_sp(pages, sp, parents, i) protected |= rmap_write_protect(vcpu-kvm, sp-gfn); - if (protected) - kvm_flush_remote_tlbs(vcpu-kvm); + kvm_flush_remote_tlbs_cond(vcpu-kvm, protected); for_each_sp(pages, sp, parents, i) { kvm_sync_page(vcpu, sp); Ok so because we didn't flush the tlb on the other vcpus when invlpg run, if cr3 overwrite needs to re-sync sptes wrprotecting them, we've to flush the tlb in all vcpus to be sure the possibly writable tlb entry reflecting the old writable spte instantiated before invlpg run, is removed from the physical cpus. We wouldn't find it in for_each_sp because it was rmap_removed, but we'll find something in mmu_unsync_walk (right? we definitely have to find something in mmu_unsync_walk for this to work, the parent sp have to leave child-unsync set even after rmap_remove run in invlpg without flushing the other vcpus tlbs). mmu_sync_children needs to find any _reachable_ sptes that are unsync, read the guest pagetable, and sync the sptes. Before it can inspect the guest pagetable, it needs to write protect it, with rmap_write_protect. In theory it wouldnt be necesarry to call kvm_flush_remote_tlbs_cond(protected) here, but only kvm_flush_remote_tlbs(), since the kvm-remote_tlbs_dirty information is not pertinent to mmu_sync_children. But this is done here to clear remote_tlbs_dirty (after a kvm_flush_remote_tlbs remote_tlbs_dirty is clean), ie: as an optimization. @@ -465,7 +464,7 @@ static void FNAME(invlpg)(struct kvm_vcpu *vcpu, gva_t gva) rmap_remove(vcpu-kvm, sptep); if (is_large_pte(*sptep)) --vcpu-kvm-stat.lpages; - need_flush = 1; + vcpu-kvm-remote_tlbs_dirty = true; } set_shadow_pte(sptep, shadow_trap_nonpresent_pte); break; @@ -475,8 +474,6 @@ static void FNAME(invlpg)(struct kvm_vcpu *vcpu, gva_t gva) break; } - if (need_flush) - kvm_flush_remote_tlbs(vcpu-kvm); spin_unlock(vcpu-kvm-mmu_lock); AFIK to be compliant with lowlevel archs (without ASN it doesn't matter I think as vmx always flush on exit), we have to flush the local tlb here, with set_bit(KVM_REQ_TLB_FLUSH, vcpu-requests). I don't see why it's missing. Or am I wrong? Caller does it: void kvm_mmu_invlpg(struct kvm_vcpu *vcpu, gva_t gva) { vcpu-arch.mmu.invlpg(vcpu, gva); kvm_mmu_flush_tlb(vcpu); ++vcpu-stat.invlpg; } diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 68b217e..12afa50 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -758,10 +758,18 @@ static bool make_all_cpus_request(struct kvm *kvm, unsigned int req) void kvm_flush_remote_tlbs(struct kvm *kvm) { + kvm-remote_tlbs_dirty = false; + smp_wmb(); Still no lock prefix to the asm insn and here it runs outside the mmu_lock, but ok, I tend to agree smp_wmb should be enough to be sure the write is fully finished by the time smb_wmb returns. There's another problem though. CPU0 CPU1 --- - remote_tlbs_dirty = false remote_tlbs_dirty = true smp_tlb_flush set_shadow_pte(sptep, shadow_trap_nonpresent_pte); The flush for the sptep will be lost. What about protecting remote_tlbs_dirty with mmu_lock? Only caller of kvm_flush_remote_tlbs that lacks mmu_notifier is kvm_mmu_zap_all, which is not performance sensitive anyway. @@ -907,8 +913,7 @@ static int kvm_mmu_notifier_clear_flush_young(struct mmu_notifier *mn, young = kvm_age_hva(kvm, address); spin_unlock(kvm-mmu_lock); - if (young) - kvm_flush_remote_tlbs(kvm); + kvm_flush_remote_tlbs_cond(kvm, young); return young; } No need to flush for clear_flush_young method, pages can't be freed there. I mangled over the patch a bit, plus fixed the above smp race, let me know what you think. The the best workload to exercise this is running a VM with lots of VCPUs and 8G of ram with a 32bit guest kernel and then just malloc and touch a byte for each 4096 page allocated by malloc. That will run a flood of invlpg. Then push the system to swap. while :;
kvm-85rc5 Segmentation fault for m = 2046 GB
Required info: Intel Core 2 Duo E6600 kvm version kvm-85rc5 seg faults (rc[13] fine; rc[24]?) Host kernel version: 2.6.29.1 SMP x86_64 (on Fedora 10) Guest: Fedora 11 beta x86_64 (host and guest updated) qemu cmd line: /usr/local/kvm/bin/qemu-system-x86_64 fc11Beta.img -m 2048 Problem still present with either of -no-kvm-irqchip or -no-kvm-pit switch Problem also appears with the -no-kvm switch In trying to make the core file smaller I found the seg fault disappeared for anything less than 2048 and still appeared for other values above 2048. (Interesting thing, m=2046 and 2047 got a little further, window changed size before seg fault). Everything up to 2045 worked. Seg fault occurs quite early, last thing seen is: Press F12 for boot menu followed by segfault about 3.5 to 4 seconds later. Seems to be a problem with http://www.linux-kvm.org/page/Bugs where it says about core files Then get a backtrace of the error with followed by nothing? dmesg shows: (these for m=2048) qemu-system-x86[9392] general protection ip:43c8e9 sp:7fffdfd955d0 error:0 in qemu-system-x86_64[40+1f2000] qemu-system-x86[9394] general protection ip:43c8e9 sp:7fffee13e970 error:0 in qemu-system-x86_64[40+1f2000] qemu-system-x86[9462] general protection ip:43c8e9 sp:7fff21ce3510 error:0 in qemu-system-x86_64[40+1f2000] qemu-system-x86[9522] general protection ip:43c8e9 sp:7fff7b4d4d10 error:0 in qemu-system-x86_64[40+1f2000] qemu-system-x86[9525] general protection ip:43c8e9 sp:7fff11aba2f0 error:0 in qemu-system-x86_64[40+1f2000] (next one m=2046) qemu-system-x86[9540] general protection ip:43c8f4 sp:7fffd6020850 error:0 in qemu-system-x86_64[40+1f2000] (next one m=2047) qemu-system-x86[9314] general protection ip:43c8f4 sp:7fffdcfe1810 error:0 in qemu-system-x86_64[40+1f2000] Don -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: kvm-85rc5 Segmentation fault for m = 2046 GB
On Sun, Apr 12, 2009 at 06:14:12PM -0400, Donald Parsons wrote: Required info: Intel Core 2 Duo E6600 kvm version kvm-85rc5 seg faults (rc[13] fine; rc[24]?) Host kernel version: 2.6.29.1 SMP x86_64 (on Fedora 10) Guest: Fedora 11 beta x86_64 (host and guest updated) qemu cmd line: /usr/local/kvm/bin/qemu-system-x86_64 fc11Beta.img -m 2048 Problem still present with either of -no-kvm-irqchip or -no-kvm-pit switch Problem also appears with the -no-kvm switch In trying to make the core file smaller I found the seg fault disappeared for anything less than 2048 and still appeared for other values above 2048. (Interesting thing, m=2046 and 2047 got a little further, window changed size before seg fault). Everything up to 2045 worked. Seg fault occurs quite early, last thing seen is: Press F12 for boot menu followed by segfault about 3.5 to 4 seconds later. Seems to be a problem with http://www.linux-kvm.org/page/Bugs where it says about core files Then get a backtrace of the error with followed by nothing? # gdb -c core.xxx qemu/x86_64-softmmu/qemu-system-x86_64 (gdb) bt Yes, the page is missing information, will be fixed. dmesg shows: (these for m=2048) qemu-system-x86[9392] general protection ip:43c8e9 sp:7fffdfd955d0 error:0 in qemu-system-x86_64[40+1f2000] qemu-system-x86[9394] general protection ip:43c8e9 sp:7fffee13e970 error:0 in qemu-system-x86_64[40+1f2000] qemu-system-x86[9462] general protection ip:43c8e9 sp:7fff21ce3510 error:0 in qemu-system-x86_64[40+1f2000] qemu-system-x86[9522] general protection ip:43c8e9 sp:7fff7b4d4d10 error:0 in qemu-system-x86_64[40+1f2000] qemu-system-x86[9525] general protection ip:43c8e9 sp:7fff11aba2f0 error:0 in qemu-system-x86_64[40+1f2000] (next one m=2046) qemu-system-x86[9540] general protection ip:43c8f4 sp:7fffd6020850 error:0 in qemu-system-x86_64[40+1f2000] (next one m=2047) qemu-system-x86[9314] general protection ip:43c8f4 sp:7fffdcfe1810 error:0 in qemu-system-x86_64[40+1f2000] Don -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] kvm: Fix overlapping check for memory slots
On Saturday 11 April 2009 17:48:04 Jan Kiszka wrote: This nice little buglet complicates a smarter slot management in qemu user space just slightly. Sigh... When checking for overlapping slots on registration of a new one, kvm currently also considers zero-length (ie. deleted) slots and rejects requests incorrectly. This finally denies user space from joining slots. Fix the check by skipping deleted slots. Signed-off-by: Jan Kiszka jan.kis...@siemens.com --- virt/kvm/kvm_main.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c index 363af32..18f06d2 100644 --- a/virt/kvm/kvm_main.c +++ b/virt/kvm/kvm_main.c @@ -1117,7 +1117,7 @@ int __kvm_set_memory_region(struct kvm *kvm, for (i = 0; i KVM_MEMORY_SLOTS; ++i) { struct kvm_memory_slot *s = kvm-memslots[i]; - if (s == memslot) + if (s == memslot || !s-npages) continue; if (!((base_gfn + npages = s-base_gfn) || (base_gfn = s-base_gfn + s-npages))) Is it necessary to preserve a valid base_gfn/flags/etc for a zeroed slot? Seems kvm_free_physmem_slot didn't clean them. -- regards Yang, Sheng -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html