Mohammed Gamal | 1 Sep 03:14 2009
Picon

[[PATCH v2]] VMX: Enhance invalid guest state emulation

- Change returned handle_invalid_guest_state() to return relevant exit codes
- Move triggering the emulation from vmx_vcpu_run() to vmx_handle_exit()
- Return to userspace instead of repeatedly trying to emulate
instructions that have already failed

Signed-off-by: Mohammed Gamal <m.gamal005 <at> gmail.com>
---
 arch/x86/kvm/vmx.c |   31 +++++++++++++++----------------
 1 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 78101dd..34bfd87 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
 <at>  <at>  -107,7 +107,6  <at>  <at>  struct vcpu_vmx {
 	} rmode;
 	int vpid;
 	bool emulation_required;
-	enum emulation_result invalid_state_emulation_result;

 	/* Support for vnmi-less CPUs */
 	int soft_vnmi_blocked;
 <at>  <at>  -3318,22 +3317,24  <at>  <at>  static int handle_nmi_window(struct kvm_vcpu *vcpu)
 	return 1;
 }

-static void handle_invalid_guest_state(struct kvm_vcpu *vcpu)
+static int handle_invalid_guest_state(struct kvm_vcpu *vcpu)
 {
-	struct vcpu_vmx *vmx = to_vmx(vcpu);
(Continue reading)

Mohammed Gamal | 1 Sep 03:15 2009
Picon

[PATCH v2] VMX: Enhance invalid guest state emulation

- Change returned handle_invalid_guest_state() to return relevant exit codes
- Move triggering the emulation from vmx_vcpu_run() to vmx_handle_exit()
- Return to userspace instead of repeatedly trying to emulate
instructions that have already failed

Signed-off-by: Mohammed Gamal <m.gamal005 <at> gmail.com>
---
 arch/x86/kvm/vmx.c |   31 +++++++++++++++----------------
 1 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 78101dd..34bfd87 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
 <at>  <at>  -107,7 +107,6  <at>  <at>  struct vcpu_vmx {
 	} rmode;
 	int vpid;
 	bool emulation_required;
-	enum emulation_result invalid_state_emulation_result;

 	/* Support for vnmi-less CPUs */
 	int soft_vnmi_blocked;
 <at>  <at>  -3318,22 +3317,24  <at>  <at>  static int handle_nmi_window(struct kvm_vcpu *vcpu)
 	return 1;
 }

-static void handle_invalid_guest_state(struct kvm_vcpu *vcpu)
+static int handle_invalid_guest_state(struct kvm_vcpu *vcpu)
 {
-	struct vcpu_vmx *vmx = to_vmx(vcpu);
(Continue reading)

Mohammed Gamal | 1 Sep 03:24 2009
Picon

[PATCH 1/2][RESEND] Update kvm.h in qemu-kvm tree

Update struct kvm_run and KVM_EXIT_* constants to match the one in the
kernel-space tree

Signed-off-by: Mohammed Gamal <m.gamal005 <at> gmail.com>
---
 kvm/include/linux/kvm.h |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/kvm/include/linux/kvm.h b/kvm/include/linux/kvm.h
index ff1025d..801865d 100644
--- a/kvm/include/linux/kvm.h
+++ b/kvm/include/linux/kvm.h
 <at>  <at>  -135,6 +135,10  <at>  <at>  struct kvm_pit_config {
 #define KVM_EXIT_S390_RESET       14
 #define KVM_EXIT_DCR              15
 #define KVM_EXIT_NMI              16
+#define KVM_EXIT_INTERNAL_ERROR   17
+
+/* For KVM_EXIT_INTERNAL_ERROR */
+#define KVM_INTERNAL_ERROR_EMULATION 1

 /* for KVM_RUN, returned by mmap(vcpu_fd, offset=0) */
 struct kvm_run {
 <at>  <at>  -221,6 +225,9  <at>  <at>  struct kvm_run {
 			__u32 data;
 			__u8  is_write;
 		} dcr;
+		struct {
+			__u32 suberror;
+		} internal;
(Continue reading)

Mohammed Gamal | 1 Sep 03:24 2009
Picon

[PATCH 2/2][RESEND] Handle emulation failure in userspace

Since we return to userspace from KVM on invalid state emulation failure, let
qemu handle it.

Signed-off-by: Mohammed Gamal <m.gamal005 <at> gmail.com>
---
 qemu-kvm.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/qemu-kvm.c b/qemu-kvm.c
index b59e403..a1648e0 100644
--- a/qemu-kvm.c
+++ b/qemu-kvm.c
 <at>  <at>  -1029,6 +1029,14  <at>  <at>  int kvm_run(kvm_vcpu_context_t vcpu, void *env)
             r = kvm_s390_handle_reset(kvm, vcpu, run);
             break;
 #endif
+	case KVM_EXIT_INTERNAL_ERROR:
+	    kvm_show_regs(vcpu);
+	    fprintf(stderr, "\nKVM internal error. Suberror: %d\n",
+		    run->internal.suberror);
+	    if (run->internal.suberror == KVM_INTERNAL_ERROR_EMULATION)
+		fprintf(stderr, "emulation failure, check dmesg for details\n");
+	    abort();
+	    break;
         default:
             if (kvm_arch_run(vcpu)) {
                 fprintf(stderr, "unhandled vm exit: 0x%x\n", run->exit_reason);
--

-- 
1.6.0.4

(Continue reading)

Mohammed Gamal | 1 Sep 03:26 2009
Picon

[PATCH][RESEND] x86 emulator: Add pusha and popa instructions

This adds pusha and popa instructions (opcodes 0x60-0x61), this enables booting
MINIX with invalid guest state emulation on.

Signed-off-by: Mohammed Gamal <m.gamal005 <at> gmail.com>
---
 arch/x86/kvm/emulate.c |   52 +++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 51 insertions(+), 1 deletions(-)

diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index db0820d..9be2e6e 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
 <at>  <at>  -139,7 +139,8  <at>  <at>  static u32 opcode_table[256] = {
 	DstReg | Stack, DstReg | Stack, DstReg | Stack, DstReg | Stack,
 	DstReg | Stack, DstReg | Stack, DstReg | Stack, DstReg | Stack,
 	/* 0x60 - 0x67 */
-	0, 0, 0, DstReg | SrcMem32 | ModRM | Mov /* movsxd (x86/64) */ ,
+	ImplicitOps | Stack | No64, ImplicitOps | Stack | No64,
+	0, DstReg | SrcMem32 | ModRM | Mov /* movsxd (x86/64) */ ,
 	0, 0, 0, 0,
 	/* 0x68 - 0x6F */
 	SrcImm | Mov | Stack, 0, SrcImmByte | Mov | Stack, 0,
 <at>  <at>  -1225,6 +1226,47  <at>  <at>  static int emulate_pop_sreg(struct x86_emulate_ctxt *ctxt,
 	return rc;
 }

+static void emulate_pusha(struct x86_emulate_ctxt *ctxt)
+{
+	struct decode_cache *c = &ctxt->decode;
+	unsigned long old_esp = c->regs[VCPU_REGS_RSP];
(Continue reading)

Xin, Xiaohui | 1 Sep 07:04 2009
Picon

RE: [PATCHv5 3/3] vhost_net: a kernel-level virtio server

> One way to share the effort is to make vmdq queues available as normal 
kernel interfaces.  It would take quite a bit of work, but the end 
result is that no other components need to be change, and it makes vmdq 
useful outside kvm.  It also greatly reduces the amount of integration 
work needed throughout the stack (kvm/qemu/libvirt).

Yes. The common queue pair interface which we want to present will also apply to normal hardware, and try to
leave other components unknown.

Thanks
Xiaohui

-----Original Message-----
From: Avi Kivity [mailto:avi <at> redhat.com] 
Sent: Tuesday, September 01, 2009 1:52 AM
To: Xin, Xiaohui
Cc: mst <at> redhat.com; netdev <at> vger.kernel.org; virtualization <at> lists.linux-foundation.org;
kvm <at> vger.kernel.org; linux-kernel <at> vger.kernel.org; mingo <at> elte.hu; linux-mm <at> kvack.org;
akpm <at> linux-foundation.org; hpa <at> zytor.com; gregory.haskins <at> gmail.com
Subject: Re: [PATCHv5 3/3] vhost_net: a kernel-level virtio server

On 08/31/2009 02:42 PM, Xin, Xiaohui wrote:
> Hi, Michael
> That's a great job. We are now working on support VMDq on KVM, and since the VMDq hardware presents L2
sorting based on MAC addresses and VLAN tags, our target is to implement a zero copy solution using VMDq. We
stared from the virtio-net architecture. What we want to proposal is to use AIO combined with direct I/O:
> 1) Modify virtio-net Backend service in Qemu to submit aio requests composed from virtqueue.
> 2) Modify TUN/TAP device to support aio operations and the user space buffer directly mapping into the
host kernel.
> 3) Let a TUN/TAP device binds to single rx/tx queue from the NIC.
(Continue reading)

Xin, Xiaohui | 1 Sep 08:58 2009
Picon

[RFC] Virtual Machine Device Queues(VMDq) support on KVM

              [RFC] Virtual Machine Device Queues (VMDq) support on KVM

Network adapter with VMDq technology presents multiple pairs of tx/rx queues,
and renders network L2 sorting mechanism based on MAC addresses and VLAN tags
for each tx/rx queue pair. Here we present a generic framework, in which network
traffic to/from a tx/rx queue pair can be directed from/to a KVM guest without
any software copy.

Actually this framework can apply to traditional network adapters which have
just one tx/rx queue pair. And applications using the same user/kernel interface
can utilize this framework to send/receive network traffic directly thru a tx/rx
queue pair in a network adapter.

We use virtio-net architecture to illustrate the framework.

|--------------------|     pop               add_buf    |----------------|
|    Qemu process    |  <---------    TX   <----------  | Guest Kernel   |
|                    |  --------->         ---------->  |                |
|    Virtio-net      |     push              get_buf    |                |
|  (Backend service) |  --------->    RX   ---------->  |  Virtio-net    |
|                    |  <---------         <----------  |    driver      |
|                    |     push              get_buf    |                |
|--------------------|                                  |----------------|
                   |
                   |
                   | AIO (read & write) combined with Direct I/O
                   |   (which substitute synced file operations)
|-----------------------------------------------------------------------|
|     Host kernel  | read: copy-less with directly mapped user          |
|                  |       space to kernel, payload directly DMAed      |
(Continue reading)

Lukáš Doktor | 1 Sep 10:49 2009
Picon

Re: [KVM-AUTOTEST PATCH 1/2] Add KSM test

I'm sorry but thunderbird apparently crippled the path. Resending as the 
attachment.
Lukáš Doktor | 1 Sep 10:50 2009
Picon

Re: [KVM-AUTOTEST PATCH 2/2] Add KSM test

I'm sorry but thunderbird apparently crippled the path. Resending as the 
attachment.
Avi Kivity | 1 Sep 11:03 2009
Picon

[PATCH] KVM: VMX: Check cpl before emulating debug register access

Debug registers may only be accessed from cpl 0.  Unfortunately, vmx will
code to emulate the instruction even though it was issued from guest
userspace, possibly leading to an unexpected trap later.

Cc: stable <at> kernel.org
Signed-off-by: Avi Kivity <avi <at> redhat.com>
---
 arch/x86/include/asm/kvm_host.h |    1 +
 arch/x86/kvm/vmx.c              |    2 ++
 arch/x86/kvm/x86.c              |   13 +++++++++++++
 3 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index a3f637f..6046e6f 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
 <at>  <at>  -621,6 +621,7  <at>  <at>  void kvm_queue_exception(struct kvm_vcpu *vcpu, unsigned nr);
 void kvm_queue_exception_e(struct kvm_vcpu *vcpu, unsigned nr, u32 error_code);
 void kvm_inject_page_fault(struct kvm_vcpu *vcpu, unsigned long cr2,
 			   u32 error_code);
+bool kvm_require_cpl(struct kvm_vcpu *vcpu, int required_cpl);

 int kvm_pic_set_irq(void *opaque, int irq, int level);

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 78101dd..05cd554 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
 <at>  <at>  -2931,6 +2931,8  <at>  <at>  static int handle_dr(struct kvm_vcpu *vcpu)
 	unsigned long val;
(Continue reading)


Gmane