Re: 2.6.32.12: Build warning due to 78ce64a384 / missing in 2.6.33?

2010-04-27 Thread Avi Kivity
On 04/27/2010 09:17 AM, Gleb Natapov wrote: The fact that 2.6.33.3 does not generate this makes me wonder why it obviously lacks the above patch. Not required or not yet queued? Doesn't make much sense to include it in stable-32, but not stable-33. I think stable-32 just has more

Re: KVM call agenda for Apr 27

2010-04-27 Thread Avi Kivity
On 04/27/2010 01:36 AM, Anthony Liguori wrote: A few comments: 1) The problem was not block watermark itself but generating a notification on the watermark threshold. It's a heuristic and should be implemented based on polling block stats. Polling for an event that never happens is bad

Re: KVM call agenda for Apr 27

2010-04-27 Thread Avi Kivity
On 04/27/2010 11:48 AM, Dor Laor wrote: Here's another option: an nbd-like protocol that remotes all BlockDriver operations except read and write over a unix domain socket. The open operation returns an fd (SCM_RIGHTS strikes again) that is used for read and write. This can be used to implement

Re: KVM call agenda for Apr 27

2010-04-27 Thread Avi Kivity
On 04/27/2010 12:08 PM, Dor Laor wrote: On 04/27/2010 11:56 AM, Avi Kivity wrote: On 04/27/2010 11:48 AM, Dor Laor wrote: Here's another option: an nbd-like protocol that remotes all BlockDriver operations except read and write over a unix domain socket. The open operation returns an fd

Re: KVM call agenda for Apr 27

2010-04-27 Thread Avi Kivity
On 04/27/2010 12:16 PM, Kevin Wolf wrote: Am 27.04.2010 10:56, schrieb Avi Kivity: On 04/27/2010 11:48 AM, Dor Laor wrote: Here's another option: an nbd-like protocol that remotes all BlockDriver operations except read and write over a unix domain socket. The open operation returns

Re: [PATCH 2/2] KVM, Fix QEMU-KVM is killed by guest SRAO MCE

2010-04-27 Thread Avi Kivity
On 04/27/2010 12:25 PM, Huang Ying wrote: On 04/27/2010 10:04 AM, Huang Ying wrote: +static void kvm_send_hwpoison_signal(struct kvm *kvm, gfn_t gfn) +{ + char buf[1]; + void __user *hva; + int r; + + /* Touch the page, so send SIGBUS */ + hva = (void

Re: [PATCH 02/22] KVM: MMU: Make tdp_enabled a mmu-context parameter

2010-04-27 Thread Avi Kivity
On 04/27/2010 01:38 PM, Joerg Roedel wrote: This patch changes the tdp_enabled flag from its global meaning to the mmu-context and renames it to direct_map there. This is necessary for Nested SVM with emulation of Nested Paging where we need an extra MMU context to shadow the Nested Nested Page

Re: [PATCH 11/22] KVM: MMU: Add infrastructure for two-level page walker

2010-04-27 Thread Avi Kivity
On 04/27/2010 01:38 PM, Joerg Roedel wrote: This patch introduces a mmu-callback to translate gpa addresses in the walk_addr code. This is later used to translate l2_gpa addresses into l1_gpa addresses. +static inline gfn_t gpa_to_gfn(gpa_t gpa) +{ + return (gfn_t)gpa PAGE_SHIFT; +} +

Re: [PATCH 12/22] KVM: MMU: Implement nested gva_to_gpa functions

2010-04-27 Thread Avi Kivity
On 04/27/2010 01:38 PM, Joerg Roedel wrote: This patch adds the functions to do a nested l2_gva to l1_gpa page table walk. Signed-off-by: Joerg Roedeljoerg.roe...@amd.com --- arch/x86/include/asm/kvm_host.h |4 arch/x86/kvm/mmu.c |8

Re: [PATCH 13/22] KVM: X86: Add kvm_read_guest_page_tdp function

2010-04-27 Thread Avi Kivity
On 04/27/2010 01:38 PM, Joerg Roedel wrote: This patch adds a function which can read from the guests physical memory or from the guest's guest physical memory. This will be used in the two-dimensional page table walker. Signed-off-by: Joerg Roedeljoerg.roe...@amd.com ---

Re: [PATCH 15/22] KVM: MMU: Introduce kvm_read_guest_page_x86()

2010-04-27 Thread Avi Kivity
On 04/27/2010 01:38 PM, Joerg Roedel wrote: This patch introduces the kvm_read_guest_page_x86 function which reads from the physical memory of the guest. If the guest is running in guest-mode itself with nested paging enabled it will read from the guest's guest physical memory instead. The patch

Re: [PATCH 16/22] KVM: MMU: Track page fault data in struct vcpu

2010-04-27 Thread Avi Kivity
On 04/27/2010 01:38 PM, Joerg Roedel wrote: This patch introduces two fields in vcpu_arch for x86: * fault_address * fault_error_code This will be used to correctly propagate page faults back into the guest when we could have either an ordinary page fault or a nested page

Re: [PATCH 20/22] KVM: SVM: Initialize Nested Nested MMU context on VMRUN

2010-04-27 Thread Avi Kivity
On 04/27/2010 01:38 PM, Joerg Roedel wrote: This patch adds code to initialize the Nested Nested Paging MMU context when the L1 guest executes a VMRUN instruction and has nested paging enabled in its VMCB. struct kvm_mmu_page *sp, diff --git a/arch/x86/kvm/svm.c

Re: [PATCH 0/22] Nested Paging support for Nested SVM v2

2010-04-27 Thread Avi Kivity
On 04/27/2010 01:38 PM, Joerg Roedel wrote: Hi, this is the second and reworked version of my nested paging for nested svm patchset. Changes to the previous version include: * Renamed mmu.tdp_enabled to mmu.direct_map * Introduced two helper functions to read physical memory

Re: KVM call agenda for Apr 27

2010-04-27 Thread Avi Kivity
On 04/27/2010 04:03 PM, Anthony Liguori wrote: On 04/27/2010 03:14 AM, Avi Kivity wrote: On 04/27/2010 01:36 AM, Anthony Liguori wrote: A few comments: 1) The problem was not block watermark itself but generating a notification on the watermark threshold. It's a heuristic and should

Re: [PATCH 1/1] KVM: x86: avoid unnecessary bitmap allocation when memslot is clean

2010-04-27 Thread Avi Kivity
On 04/26/2010 12:58 PM, Takuya Yoshikawa wrote: Although we always allocate a new dirty bitmap in x86's get_dirty_log(), it is only used as a zero-source of copy_to_user() and freed right after that when memslot is clean. This patch uses clear_user() instead of doing this unnecessary zero-source

Re: [PATCH 16/22] KVM: MMU: Track page fault data in struct vcpu

2010-04-27 Thread Avi Kivity
On 04/27/2010 04:28 PM, Joerg Roedel wrote: diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h index d9dfc8c..8426870 100644 --- a/arch/x86/include/asm/kvm_host.h +++ b/arch/x86/include/asm/kvm_host.h @@ -298,6 +298,9 @@ struct kvm_vcpu_arch { /* Used for

Re: [PATCH 13/22] KVM: X86: Add kvm_read_guest_page_tdp function

2010-04-27 Thread Avi Kivity
On 04/27/2010 03:42 PM, Avi Kivity wrote: +{ +gfn_t real_gfn; +gpa_t gpa; + +*error = 0; +gpa = gfn PAGE_SHIFT; This overflows too :) Use gfn_to_gpa(). +real_gfn = mmu-translate_gpa(vcpu, gpa, error); Overflow: sizeof(gpa) sizeof(gfn). -- error compiling

Re: [PATCH 16/22] KVM: MMU: Track page fault data in struct vcpu

2010-04-27 Thread Avi Kivity
On 04/27/2010 04:57 PM, Joerg Roedel wrote: But the nested guest can use pae paging and generate a #NPF with exit_info_2 4GB. So we need to keep the full fault address; if we truncate, the guest might actually resolve the fault and let the nested guest continue. This could only be a

Re: [PATCH 15/22] KVM: MMU: Introduce kvm_read_guest_page_x86()

2010-04-27 Thread Avi Kivity
On 04/27/2010 06:40 PM, Joerg Roedel wrote: Currently its a bit unclear when to use mmu or nested_mmu. With a pointer it would be unclear to the code reader when to use the pointer and when to select the mmu_contexts directly. I think in most cases you'd want full translation, thus the

Re: [PATCH 6/6] don't compute pvclock adjustments if we trust the tsc

2010-04-27 Thread Avi Kivity
On 04/27/2010 04:40 PM, Marcelo Tosatti wrote: On Mon, Apr 26, 2010 at 01:46:28PM -0400, Glauber Costa wrote: If the HV told us we can fully trust the TSC, skip any correction Please drop this. Its not certain what is the best method to reduce contention on the global variable.

Re: [PATCH 1/6] Enable pvclock flags in vcpu_time_info structure

2010-04-27 Thread Avi Kivity
On 04/26/2010 08:46 PM, Glauber Costa wrote: This patch removes one padding byte and transform it into a flags field. New versions of guests using pvclock will query these flags upon each read. Flags, however, will only be interpreted when the guest decides to. It uses the pvclock_valid_flags

Re: [PATCH 4/6] export new cpuid KVM_CAP

2010-04-27 Thread Avi Kivity
On 04/26/2010 08:46 PM, Glauber Costa wrote: Since we're changing the msrs kvmclock uses, we have to communicate that to the guest, through cpuid. We can add a new KVM_CAP to the hypervisor, and then patch userspace to recognize it. And if we ever add a new cpuid bit in the future, we have to

Re: [PATCH 4/6] export new cpuid KVM_CAP

2010-04-27 Thread Avi Kivity
On 04/27/2010 10:09 PM, Glauber Costa wrote: Hmm. We already have an API to get cpuid bits: KVM_GET_SUPPORTED_CPUID2. The nice thing about it is that it will mean -cpu host will work out of the box. Ok, from what I understand, KVM_GET_CPUID2 gets a set of features, and tells userspace

Re: [PATCH 09/23] KVM: x86 emulator: make set_cr() callback return error if it fails

2010-04-28 Thread Avi Kivity
On 04/27/2010 03:15 PM, Gleb Natapov wrote: Make set_cr() callback return error if it fails instead of injecting #GP behind emulator's back. -void kvm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0) +static int _kvm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0) { standard

Re: [PATCH 22/23] KVM: remove unneeded initialization.

2010-04-28 Thread Avi Kivity
On 04/27/2010 03:15 PM, Gleb Natapov wrote: This initialization is no longer needed. Signed-off-by: Gleb Natapovg...@redhat.com --- arch/x86/kvm/x86.c |2 -- 1 files changed, 0 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index ed15b20..29e2d3b

Re: [PATCH 08/23] KVM: x86 emulator: cleanup some direct calls into kvm to use existing callbacks

2010-04-28 Thread Avi Kivity
On 04/27/2010 03:15 PM, Gleb Natapov wrote: Use callbacks from x86_emulate_ops to access segments instead of calling into kvm directly. -static unsigned long seg_base(struct x86_emulate_ctxt *ctxt, int seg) +static unsigned long seg_base(struct x86_emulate_ctxt *ctxt, +

Re: Pulling regularly from QEMU git repository

2010-04-28 Thread Avi Kivity
On 04/28/2010 07:37 AM, Gerhard Wiesinger wrote: Hello, I saw that KVM git repository is not updated from QEMU repository very often. Is it possible to integrate QEMU git tree into KVM git regularly as qemu git tree is very dynamic. E.g. last commit was more than 2 weeks ago. I think it is

Re: [PATCH 2/2] KVM, Fix QEMU-KVM is killed by guest SRAO MCE

2010-04-28 Thread Avi Kivity
On 04/28/2010 05:56 AM, Huang Ying wrote: Just want to use the side effect of copy_from_user, SIGBUS will be sent to current process because the page touched is marked as poisoned. That is, failure is expected, so the return value is not checked. What if the failure doesn't

Re: [PATCH 15/23] KVM: do not inject #PF in (read|write)_emulated() callbacks

2010-04-28 Thread Avi Kivity
On 04/27/2010 03:15 PM, Gleb Natapov wrote: Return error to x86 emulator instead of injection exception behind its back. Signed-off-by: Gleb Natapovg...@redhat.com --- arch/x86/include/asm/kvm_emulate.h |3 +++ arch/x86/kvm/emulate.c | 12 +++- arch/x86/kvm/x86.c

Re: [PATCH 1/1] KVM: x86: avoid unnecessary bitmap allocation when memslot is clean

2010-04-28 Thread Avi Kivity
On 04/28/2010 07:17 AM, Takuya Yoshikawa wrote: (2010/04/27 22:46), Takuya Yoshikawa wrote: (2010/04/27 22:18), Avi Kivity wrote: Furthermore, the reduced allocations seem to produce good effects for other cases too. Actually, I observed that the time for the ioctl was more stable than

Re: [PATCH v3 0/10] KVM MMU: allow more shadow pages become asynchronous

2010-04-28 Thread Avi Kivity
On 04/28/2010 06:54 AM, Xiao Guangrong wrote: Changlog v3: Reviewed-by: Avi Kivity a...@redhat.com -- 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

Re: [PATCH 1/1] KVM: x86: avoid unnecessary bitmap allocation when memslot is clean

2010-04-28 Thread Avi Kivity
On 04/27/2010 04:46 PM, Takuya Yoshikawa wrote: (2010/04/27 22:18), Avi Kivity wrote: Furthermore, the reduced allocations seem to produce good effects for other cases too. Actually, I observed that the time for the ioctl was more stable than the original one and the average time for dirty

Re: [PATCH 11/22] KVM: MMU: Add infrastructure for two-level page walker

2010-04-28 Thread Avi Kivity
On 04/28/2010 01:52 PM, Joerg Roedel wrote: On Tue, Apr 27, 2010 at 03:34:10PM +0300, Avi Kivity wrote: On 04/27/2010 01:38 PM, Joerg Roedel wrote: This patch introduces a mmu-callback to translate gpa addresses in the walk_addr code. This is later used to translate l2_gpa addresses

Re: [PATCH 11/22] KVM: MMU: Add infrastructure for two-level page walker

2010-04-28 Thread Avi Kivity
On 04/28/2010 02:03 PM, Joerg Roedel wrote: On Tue, Apr 27, 2010 at 03:34:10PM +0300, Avi Kivity wrote: On 04/27/2010 01:38 PM, Joerg Roedel wrote: This patch introduces a mmu-callback to translate gpa addresses in the walk_addr code. This is later used to translate l2_gpa addresses

Re: [PATCH] kvm mmu: reduce 50% memory usage

2010-04-28 Thread Avi Kivity
On 04/28/2010 02:57 PM, Lai Jiangshan wrote: I think users will enable tdp when their hardwares support ept or npt. This patch can reduce about 50% kvm mmu memory usage for they. Good one! -- error compiling committee.c: too many arguments to function -- To unsubscribe from this list:

[PATCH 4/5] KVM: VMX: Add facility to atomically switch MSRs on guest entry/exit

2010-04-28 Thread Avi Kivity
Some guest msr values cannot be used on the host (for example. EFER.NX=0), so we need to switch them atomically during guest entry or exit. Add a facility to program the vmx msr autoload registers accordingly. Signed-off-by: Avi Kivity a...@redhat.com --- arch/x86/kvm/vmx.c | 49

[PATCH 3/5] KVM: VMX: Add definitions for guest and host EFER autoswitch vmcs entries

2010-04-28 Thread Avi Kivity
Signed-off-by: Avi Kivity a...@redhat.com --- arch/x86/include/asm/vmx.h |4 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/arch/x86/include/asm/vmx.h b/arch/x86/include/asm/vmx.h index 4497318..9e6779f 100644 --- a/arch/x86/include/asm/vmx.h +++ b/arch/x86/include/asm

[PATCH 2/5] KVM: VMX: Add definition for msr autoload entry

2010-04-28 Thread Avi Kivity
Signed-off-by: Avi Kivity a...@redhat.com --- arch/x86/include/asm/vmx.h |8 +++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/arch/x86/include/asm/vmx.h b/arch/x86/include/asm/vmx.h index fb9a080..4497318 100644 --- a/arch/x86/include/asm/vmx.h +++ b/arch/x86/include

[PATCH 5/5] KVM: VMX: Atomically switch efer if EPT !EFER.NX

2010-04-28 Thread Avi Kivity
When EPT is enabled, we cannot emulate EFER.NX=0 through the shadow page tables. This causes accesses through ptes with bit 63 set to succeed instead of failing a reserved bit check. Signed-off-by: Avi Kivity a...@redhat.com --- arch/x86/kvm/vmx.c | 11 +++ 1 files changed, 11

[PATCH 1/5] KVM: Let vcpu structure alignment be determined at runtime

2010-04-28 Thread Avi Kivity
vmx and svm vcpus have different contents and therefore may have different alignmment requirements. Let each specify its required alignment. Signed-off-by: Avi Kivity a...@redhat.com --- arch/ia64/kvm/vmm.c |2 +- arch/powerpc/kvm/44x.c|2 +- arch/powerpc/kvm/book3s.c |3

[PATCH 0/5] Fix EFER.NX=0 with EPT

2010-04-28 Thread Avi Kivity
the complications described above. Avi Kivity (5): KVM: Let vcpu structure alignment be determined at runtime KVM: VMX: Add definition for msr autoload entry KVM: VMX: Add definitions for guest and host EFER autoswitch vmcs entries KVM: VMX: Add facility to atomically switch MSRs on guest entry/exit

[PATCH 2/5] test: access: consolidate test failure reporting into a function

2010-04-28 Thread Avi Kivity
Signed-off-by: Avi Kivity a...@redhat.com --- kvm/user/test/x86/access.c | 60 +++- 1 files changed, 37 insertions(+), 23 deletions(-) diff --git a/kvm/user/test/x86/access.c b/kvm/user/test/x86/access.c index dbc1213..0906691 100644 --- a/kvm/user/test

[PATCH 1/5] test: access: split off test case formatting from execution

2010-04-28 Thread Avi Kivity
Signed-off-by: Avi Kivity a...@redhat.com --- kvm/user/test/x86/access.c | 10 -- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/kvm/user/test/x86/access.c b/kvm/user/test/x86/access.c index 5eadff8..dbc1213 100644 --- a/kvm/user/test/x86/access.c +++ b/kvm/user/test/x86

[PATCH 4/5] test: access: allow the processor not to set pde.a if a fault occurs

2010-04-28 Thread Avi Kivity
Some processors only set accessed bits if the translation is valid; allow this behaviour. This squelchs errors running with EPT. Signed-off-by: Avi Kivity a...@redhat.com --- kvm/user/test/x86/access.c | 25 - 1 files changed, 20 insertions(+), 5 deletions(-) diff

[PATCH 3/5] test: access: report successful tests optionally

2010-04-28 Thread Avi Kivity
There are so many tests, no point in reporting successful ones. Leave the capability optional in case a failure triggers a kvm or testsuite crash before the report is complete and we need to see which test failed. Signed-off-by: Avi Kivity a...@redhat.com --- kvm/user/test/x86/access.c | 15

[PATCH 5/5] test: access: don't expect fetch fault indication if !efer.nx

2010-04-28 Thread Avi Kivity
Bit 4 of the page-fault error code can only be set if efer.nx=1. Signed-off-by: Avi Kivity a...@redhat.com --- kvm/user/test/x86/access.c |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/kvm/user/test/x86/access.c b/kvm/user/test/x86/access.c index 5addd15..3338fbc

Re: [PATCH] Ignore SRAO MCE if another MCE is being processed

2010-04-28 Thread Avi Kivity
On 04/28/2010 09:08 AM, Huang Ying wrote: There is some test script and document for this in: git://git.kernel.org/pub/scm/utils/cpu/mce/mce-test.git test script is in kvm directory, testing document is kvm/README This is a good candidate for kvm-autotest. We'll get little user

Re: [PATCH] kvm mmu: reduce 50% memory usage

2010-04-30 Thread Avi Kivity
On 04/30/2010 05:25 AM, Lai Jiangshan wrote: It's unrelated to TDP, same issue with shadow. I think the calculation is correct. For example the 4th spte for a level=2 page will yield gfn=4*512. Avi, Marcelo Thank you very much. The calculation I used is correct. Yes. btw, can

Re: [PATCH 1/4] KVM MMU: fix race in invlpg code

2010-04-30 Thread Avi Kivity
On 04/30/2010 12:00 PM, Xiao Guangrong wrote: It has race in invlpg code, like below sequences: A: hold mmu_lock and get 'sp' B: release mmu_lock and do other things C: hold mmu_lock and continue use 'sp' if other path freed 'sp' in stage B, then kernel will crash This patch checks 'sp'

Re: [PATCH 3/4] KVM MMU: allow shadow page become unsync at creating time

2010-04-30 Thread Avi Kivity
On 04/30/2010 12:03 PM, Xiao Guangrong wrote: Allow new shadow page become unsync when is created, then we no need write-protect the 'sp-gfn', this idea is from Avi: |Another interesting case is to create new shadow pages in the unsync |state. That can help when the guest starts a short lived

Re: [PATCH] kvm mmu: reduce 50% memory usage

2010-04-30 Thread Avi Kivity
On 04/30/2010 11:54 AM, Lai Jiangshan wrote: Avi Kivity wrote: On 04/30/2010 05:25 AM, Lai Jiangshan wrote: It's unrelated to TDP, same issue with shadow. I think the calculation is correct. For example the 4th spte for a level=2 page will yield gfn=4*512. Avi

Re: [PATCHv2 00/23] next round of emulator cleanups

2010-04-30 Thread Avi Kivity
On 04/28/2010 07:15 PM, Gleb Natapov wrote: This is the next round of emulator cleanups. Make it even more detached from kvm. First patch introduces IO read cache which is needed to correctly emulate instructions that require more then one IO read exit during emulation. Reviewed-by: Avi

Re: [PATCH 15/23] KVM: do not inject #PF in (read|write)_emulated() callbacks

2010-04-30 Thread Avi Kivity
On 04/28/2010 12:21 PM, Gleb Natapov wrote: On Wed, Apr 28, 2010 at 12:11:41PM +0300, Avi Kivity wrote: On 04/27/2010 03:15 PM, Gleb Natapov wrote: Return error to x86 emulator instead of injection exception behind its back. Signed-off-by: Gleb Natapovg...@redhat.com --- arch/x86

Re: [PATCH 5/5] KVM: VMX: Atomically switch efer if EPT !EFER.NX

2010-04-30 Thread Avi Kivity
On 04/30/2010 08:37 PM, Marcelo Tosatti wrote: Avi, This patch breaks WinVista.64 install. Please back it out then (the entire patchset). -- Do not meddle in the internals of kernels, for they are subtle and quick to panic. -- To unsubscribe from this list: send the line unsubscribe

Re: [PATCH] kvm mmu: reduce 50% memory usage

2010-04-30 Thread Avi Kivity
On 04/29/2010 09:09 PM, Marcelo Tosatti wrote: You missed quadrant on 4mb large page emulation with shadow (see updated patch below). Good catch. Also for some reason i can't understand the assumption does not hold for large sptes with TDP, so reverted for now. It's unrelated to TDP,

Re: [PATCH 4/4] KVM MMU: do not intercept invlpg if 'oos_shadow' is disabled

2010-04-30 Thread Avi Kivity
On 04/30/2010 12:05 PM, Xiao Guangrong wrote: If 'oos_shadow' == 0, intercepting invlpg command is really unnecessary. And it's good for us to compare the performance between enable 'oos_shadow' and disable 'oos_shadow' @@ -74,8 +74,9 @@ static int dbg = 0; module_param(dbg, bool, 0644);

Re: Regression in vga performance between 0.11.1 and 0.12.1.1

2010-04-30 Thread Avi Kivity
On 04/28/2010 10:33 PM, Adam Greenblatt wrote: Hi, I noticed that certain guests (for example, Ubuntu 9.04, Ubuntu 9.10, and the Ubuntu 10.04 release candidate) show dramatically (~100x) slower graphical output when running under qemu-kvm-0.12.1.1 than under qemu-kvm-0.11.1. Other guests,

Re: [PATCH 0/5] Fix EFER.NX=0 with EPT

2010-04-30 Thread Avi Kivity
On 04/29/2010 02:22 AM, Marcelo Tosatti wrote: On Wed, Apr 28, 2010 at 04:47:14PM +0300, Avi Kivity wrote: Currently we run with EFER.NX=1 on the guest even if the guest value is 0. This is fine with shadow, since we check bit 63 when instantiating a page table, and fault if bit 63 is set

[PATCH] KVM: Document KVM_SET_BOOT_CPU_ID

2010-04-30 Thread Avi Kivity
Signed-off-by: Avi Kivity a...@redhat.com --- Documentation/kvm/api.txt | 12 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/Documentation/kvm/api.txt b/Documentation/kvm/api.txt index 0f96e52..159b4ef 100644 --- a/Documentation/kvm/api.txt +++ b/Documentation/kvm

Re: Can I simulate a virtual Dual-Head Graphiccard?

2010-04-30 Thread Avi Kivity
On 04/28/2010 11:08 PM, Axel Kittenberger wrote: Hello, This is a question I was not able to answer with a search. I've been using kvm now quite successfully as server side solution. Now I want to use it on a particular desktop to have a Windows 7 Guest on a native Linux system. Well this

Re: vmwrite_error while installing or booting XP

2010-05-01 Thread Avi Kivity
On 05/01/2010 09:47 AM, Kyle Teague wrote: This error occurs when I try to format the disk during the XP install as well as when I attempt to boot into XP. When I disable virtualization with -no-kvm everything works fine, albeit slow. Linux kernels tried: gentoo-2.6.31-r10 gentoo-2.6.32.r7

Re: VIA Nano support

2010-05-02 Thread Avi Kivity
On 05/02/2010 01:40 AM, Yuhong Bao wrote: It's a known bug in the Nano's vmx implementation. Any details or workarounds? There's a bug in the vm86/vmx interaction that happens to hit kvm. No known workarounds. -- Do not meddle in the internals of kernels, for they are subtle and

Re: What changed since kvm-72 resulting in winNT to fail to boot (STOP 0x0000001E) ?

2010-05-02 Thread Avi Kivity
On 04/30/2010 11:06 PM, Michael Tokarev wrote: I've a bugreport handy, see http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=575439 about the apparent problem booting winNT 4 in kvm 0.12. At least 2 people were hit by this issue. In short, when booting winNT 4.0, it BSODs with error code

[PATCH v2 4/5] KVM: VMX: Add facility to atomically switch MSRs on guest entry/exit

2010-05-02 Thread Avi Kivity
Some guest msr values cannot be used on the host (for example. EFER.NX=0), so we need to switch them atomically during guest entry or exit. Add a facility to program the vmx msr autoload registers accordingly. Signed-off-by: Avi Kivity a...@redhat.com --- arch/x86/kvm/vmx.c | 49

[PATCH v2 3/5] KVM: VMX: Add definitions for guest and host EFER autoswitch vmcs entries

2010-05-02 Thread Avi Kivity
Signed-off-by: Avi Kivity a...@redhat.com --- arch/x86/include/asm/vmx.h |4 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/arch/x86/include/asm/vmx.h b/arch/x86/include/asm/vmx.h index 4497318..9e6779f 100644 --- a/arch/x86/include/asm/vmx.h +++ b/arch/x86/include/asm

[PATCH v2 2/5] KVM: VMX: Add definition for msr autoload entry

2010-05-02 Thread Avi Kivity
Signed-off-by: Avi Kivity a...@redhat.com --- arch/x86/include/asm/vmx.h |8 +++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/arch/x86/include/asm/vmx.h b/arch/x86/include/asm/vmx.h index fb9a080..4497318 100644 --- a/arch/x86/include/asm/vmx.h +++ b/arch/x86/include

[PATCH v2 0/5] Fix EFER.NX=0 with EPT

2010-05-02 Thread Avi Kivity
the complications described above. v2: Fix transition from long mode to legacy mode Avi Kivity (5): KVM: Let vcpu structure alignment be determined at runtime KVM: VMX: Add definition for msr autoload entry KVM: VMX: Add definitions for guest and host EFER autoswitch vmcs entries KVM: VMX: Add

[PATCH v2 5/5] KVM: VMX: Atomically switch efer if EPT !EFER.NX

2010-05-02 Thread Avi Kivity
When EPT is enabled, we cannot emulate EFER.NX=0 through the shadow page tables. This causes accesses through ptes with bit 63 set to succeed instead of failing a reserved bit check. Signed-off-by: Avi Kivity a...@redhat.com --- v2: call vmx_set_efer() in exit_lmode() to update

[PATCH v2 1/5] KVM: Let vcpu structure alignment be determined at runtime

2010-05-02 Thread Avi Kivity
vmx and svm vcpus have different contents and therefore may have different alignmment requirements. Let each specify its required alignment. Signed-off-by: Avi Kivity a...@redhat.com --- arch/ia64/kvm/vmm.c |2 +- arch/powerpc/kvm/44x.c|2 +- arch/powerpc/kvm/book3s.c |3

Re: [PATCH 5/5] KVM: VMX: Atomically switch efer if EPT !EFER.NX

2010-05-02 Thread Avi Kivity
On 04/30/2010 08:56 PM, Avi Kivity wrote: On 04/30/2010 08:37 PM, Marcelo Tosatti wrote: Avi, This patch breaks WinVista.64 install. Please back it out then (the entire patchset). v2 sent out. Problem was switching from long mode to legacy mode. -- error compiling committee.c: too many

Re: [PATCH] intel_txt: enable VMXON check with SMX in KVM

2010-05-02 Thread Avi Kivity
On 04/29/2010 07:09 PM, Shane Wang wrote: Per document, for feature control MSR Bit 1 enables VMXON in SMX operation. If the bit is clear, execution of VMXON in SMX operation causes a general-protection exception. Bit 2 enables VMXON outside SMX operation. If the bit is clear, execution of

Re: [PATCH 1/1] KVM: X86: add the support of XSAVE/XRSTOR to guest

2010-05-02 Thread Avi Kivity
On 04/29/2010 08:22 AM, Dexuan Cui wrote: When the host enables XSAVE/XRSTOR, the patch exposes the XSAVE/XRSTOR related CPUID leaves to guest by fixing up kvm_emulate_cpuid() and the patch allows guest to set CR4.OSXSAVE to enable XSAVE. The patch adds per-vcpu host/guest xstate image/mask and

[PATCH 2/2] x86: Introduce 'struct fpu' and related API

2010-05-02 Thread Avi Kivity
only things. Signed-off-by: Avi Kivity a...@redhat.com --- arch/x86/include/asm/i387.h | 115 -- arch/x86/include/asm/processor.h |6 ++- arch/x86/include/asm/xsave.h |7 +- arch/x86/kernel/i387.c | 102

[PATCH 0/2] x86 FPU API

2010-05-02 Thread Avi Kivity
Currently all fpu accessors are wedded to task_struct. However kvm also uses the fpu in a different context. Introduce an FPU API, and replace the current uses with the new API. While this patchset is oriented towards deeper changes, as a first step it simlifies xsave for kvm. Avi Kivity (2

[PATCH 1/2] x86: eliminate TS_XSAVE

2010-05-02 Thread Avi Kivity
threads. Eliminate this tie-in into the task structure by using an alternative instruction keyed off the XSAVE cpu feature; this results in shorter and faster code, without introducing a global memory reference. Signed-off-by: Avi Kivity a...@redhat.com --- arch/x86/include/asm/i387.h| 20

Re: Booting/installing WindowsNT

2010-05-02 Thread Avi Kivity
On 05/02/2010 07:12 PM, Michael Tokarev wrote: After installing, winNT does not boot without -cpu host, with exactly the same diagnostics as before (0x003E). But: After installing service pack 6, it boots just fine with any -cpu, including the default qemu64. With qemu-kvm-0.11.4 it all

Re: [PATCH 1/2] x86: eliminate TS_XSAVE

2010-05-02 Thread Avi Kivity
On 05/02/2010 08:38 PM, Brian Gerst wrote: On Sun, May 2, 2010 at 10:53 AM, Avi Kivitya...@redhat.com wrote: The fpu code currently uses current-thread_info-status TS_XSAVE as a way to distinguish between XSAVE capable processors and older processors. The decision is not really task

Re: Booting/installing WindowsNT

2010-05-03 Thread Avi Kivity
On 05/03/2010 11:24 AM, Andre Przywara wrote: can you try -cpu kvm64? This should be somewhat in between -cpu host and -cpu qemu64. Also look in dmesg for uncatched rd/wrmsrs. In case you find something there, please try: # modprobe kvm ignore_msrs=1 (You have to unload the modules first)

[PATCH] KVM: Get rid of KVM_REQ_KICK

2010-05-03 Thread Avi Kivity
KVM_REQ_KICK poisons vcpu-requests by having a bit set during normal operation. This causes the fast path check for a clear vcpu-requests to fail all the time, triggering tons of atomic operations. Fix by replacing KVM_REQ_KICK with a vcpu-guest_mode atomic. Signed-off-by: Avi Kivity

[PATCH] KVM: VMX: Avoid writing HOST_CR0 every entry

2010-05-03 Thread Avi Kivity
-by: Avi Kivity a...@redhat.com --- arch/x86/kvm/vmx.c |9 +++-- 1 files changed, 3 insertions(+), 6 deletions(-) diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index 875b785..9cfdc0e 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -753,6 +753,8 @@ static void

Re: [PATCH 1/2] x86: eliminate TS_XSAVE

2010-05-04 Thread Avi Kivity
On 05/04/2010 12:45 AM, H. Peter Anvin wrote: I was trying to avoid a performance regression relative to the current code, as it appears that some care was taken to avoid the memory reference. I agree that it's probably negligible compared to the save/restore code. If the x86 maintainers

Re: [PATCH 16/22] KVM: MMU: Track page fault data in struct vcpu

2010-05-04 Thread Avi Kivity
On 05/03/2010 07:32 PM, Joerg Roedel wrote: On Tue, Apr 27, 2010 at 03:58:36PM +0300, Avi Kivity wrote: So we probably need to upgrade gva_t to a u64. Please send this as a separate patch, and test on i386 hosts. Are there _any_ regular tests of KVM on i386 hosts? For me

Re: [PATCH] virtio-spec: document block CMD and FLUSH

2010-05-04 Thread Avi Kivity
On 05/04/2010 07:38 AM, Rusty Russell wrote: On Fri, 19 Feb 2010 08:52:20 am Michael S. Tsirkin wrote: I took a stub at documenting CMD and FLUSH request types in virtio block. Christoph, could you look over this please? I note that the interface seems full of warts to me, this might be a

Re: 2.6.33.3: possible recursive locking detected

2010-05-04 Thread Avi Kivity
On 05/04/2010 10:03 AM, CaT wrote: I'm currently running 2.6.33.3 in a KVM instance emulating a core2duo on 1 cpu with virtio HDs running on top of a core2duo host running 2.6.33.3. qemu-kvm version 0.12.3. Doesn't appear to be related to kvm. Copying lkml. When doing: echo

Re: Booting/installing WindowsNT

2010-05-04 Thread Avi Kivity
On 05/03/2010 08:03 PM, Michael Tokarev wrote: Michael, can you try to use -cpu host,-vme and see if that makes a difference? With -cpu host,-vme winNT boots just fine as with just -cpu host. I also tried with -cpu qemu64 and kvm64, with +vme and -vme (4 combinations in total) - in all cases

Re: [PATCH 16/22] KVM: MMU: Track page fault data in struct vcpu

2010-05-04 Thread Avi Kivity
On 05/04/2010 12:11 PM, Roedel, Joerg wrote: On Tue, May 04, 2010 at 03:53:57AM -0400, Avi Kivity wrote: On 05/03/2010 07:32 PM, Joerg Roedel wrote: On Tue, Apr 27, 2010 at 03:58:36PM +0300, Avi Kivity wrote: So we probably need to upgrade gva_t to a u64. Please send

Re: KVM: x86: properly update ready_for_interrupt_injection

2010-05-04 Thread Avi Kivity
On 05/04/2010 05:04 AM, Marcelo Tosatti wrote: The recent changes to emulate string instructions without entering guest mode exposed a bug where pending interrupts are not properly reflected in ready_for_interrupt_injection. The result is that userspace overwrites a previously queued interrupt,

Re: [PATCH v2] KVM: x86: avoid unnecessary bitmap allocation when memslot is clean

2010-05-04 Thread Avi Kivity
On 04/28/2010 12:50 PM, Takuya Yoshikawa wrote: Hi Marcelo, Avi, I updated the patch as follows. Changelog: 1. Inserted one r = -ENOMEM; line following Avi's advice. 2. Little change of explanation about performance improvements. I'm now testing and cleaning up my next patch series based

Re: apparent key mapping error for usb keyboard

2010-05-04 Thread Avi Kivity
On 04/27/2010 12:46 PM, Michael Tokarev wrote: I've a debian bugreport that claims to have a fix for apparently wrong keymap for usb keyboard. I noticed this before with ps/2 keyboard too, the sympthoms were that e.g windows keys were not working in guests, but later on that has been fixed.

Re: [PATCH 16/22] KVM: MMU: Track page fault data in struct vcpu

2010-05-04 Thread Avi Kivity
On 05/04/2010 12:37 PM, Roedel, Joerg wrote: This is the lockdep warning I get when I start booting a Linux kernel. It is with the nested-npt patchset but the warning occurs without it too (slightly different backtraces then). [60390.953424]

Re: [PATCH 16/22] KVM: MMU: Track page fault data in struct vcpu

2010-05-04 Thread Avi Kivity
On 05/04/2010 12:45 PM, Avi Kivity wrote: Just a silly bug. kvm_pdptr_read() can cause a guest memory read on svm, in this case with the mmu lock taken. I'll post something to fix it. I guess this was not reported because most svm machines have npt, and this requires npt=0 to trigger

[PATCH] KVM: MMU: Don't read pdptrs with mmu spinlock held in mmu_alloc_roots

2010-05-04 Thread Avi Kivity
On svm, kvm_read_pdptr() may require reading guest memory, which can sleep. Push the spinlock into mmu_alloc_roots(), and only take it after we've read the pdptr. Signed-off-by: Avi Kivity a...@redhat.com --- Marcelo, dropping and re-acquiring the lock before mmu_sync_roots(), is fine, yes

[PATCH] KVM: kvm_pdptr_read() may sleep

2010-05-04 Thread Avi Kivity
Annotate it thusly. Signed-off-by: Avi Kivity a...@redhat.com --- arch/x86/kvm/kvm_cache_regs.h |2 ++ 1 files changed, 2 insertions(+), 0 deletions(-) diff --git a/arch/x86/kvm/kvm_cache_regs.h b/arch/x86/kvm/kvm_cache_regs.h index cff851c..d2a98f8 100644 --- a/arch/x86/kvm

[PATCH] KVM: Fix wallclock version writing race

2010-05-04 Thread Avi Kivity
Wallclock writing uses an unprotected global variable to hold the version; this can cause one guest to interfere with another if both write their wallclock at the same time. Signed-off-by: Avi Kivity a...@redhat.com --- arch/x86/kvm/x86.c | 12 ++-- 1 files changed, 10 insertions(+), 2

Re: [PATCH 16/22] KVM: MMU: Track page fault data in struct vcpu

2010-05-04 Thread Avi Kivity
On 05/04/2010 03:00 PM, Roedel, Joerg wrote: On Tue, May 04, 2010 at 05:50:50AM -0400, Avi Kivity wrote: On 05/04/2010 12:45 PM, Avi Kivity wrote: Just a silly bug. kvm_pdptr_read() can cause a guest memory read on svm, in this case with the mmu lock taken. I'll post something

Re: [RFC][PATCH resend 8/12] asm-generic: bitops: introduce le bit offset macro

2010-05-04 Thread Avi Kivity
On 05/04/2010 06:03 PM, Arnd Bergmann wrote: On Tuesday 04 May 2010, Takuya Yoshikawa wrote: Although we can use *_le_bit() helpers to treat bitmaps le arranged, having le bit offset calculation as a seperate macro gives us more freedom. For example, KVM has le arranged dirty bitmaps for

Re: [PATCH] KVM: Fix wallclock version writing race

2010-05-04 Thread Avi Kivity
On 05/04/2010 03:02 PM, Avi Kivity wrote: Wallclock writing uses an unprotected global variable to hold the version; this can cause one guest to interfere with another if both write their wallclock at the same time. Signed-off-by: Avi Kivitya...@redhat.com This was pointed out by Naphtali

Re: Booting/installing WindowsNT

2010-05-04 Thread Avi Kivity
On 05/04/2010 06:27 PM, Andre Przywara wrote: 3. In all other cases so far it BSoDs with STOP 0x3E error right before displaying that kernel message. MSDN talks about a mulitprocessor configuration error: http://msdn.microsoft.com/en-us/library/ms819006.aspx I suspected the offline CPUs in

Re: [PATCH] KVM: Get rid of KVM_REQ_KICK

2010-05-04 Thread Avi Kivity
On 05/04/2010 07:31 PM, Marcelo Tosatti wrote: On Mon, May 03, 2010 at 05:19:08PM +0300, Avi Kivity wrote: KVM_REQ_KICK poisons vcpu-requests by having a bit set during normal operation. This causes the fast path check for a clear vcpu-requests to fail all the time, triggering tons

<    1   2   3   4   5   6   7   8   9   10   >