Re: Internal error, emulation failure when trying to boot Win7 install

2014-01-08 Thread Marcelo Tosatti
On Tue, Jan 07, 2014 at 07:48:41PM +0100, Guido Winkelmann wrote: > Hi, > > When trying to boot a Windows 7 install from a local virtual disks, qemu > stops > with the messages: > > KVM internal error. Suberror: 1 > emulation failure Can you please enable the following tracepoints via the #

Re: [PATCH] Check use I/O bitmap first before unconditional I/O exit

2014-01-08 Thread Marcelo Tosatti
On Mon, Dec 30, 2013 at 03:56:29PM -0500, Zhihui Zhang wrote: > According to Table C-1 of Intel SDM 3C, a VM exit happens on an I/O > instruction when > "use I/O bitmaps" VM-execution control was 0 _and_ the "unconditional I/O > exiting" > VM-execution control was 1. So we can't just check "uncon

Re: [PATCH kvm-next 1/2] kvm: make local functions static

2014-01-08 Thread Marcelo Tosatti
On Sun, Dec 29, 2013 at 12:12:29PM -0800, Stephen Hemminger wrote: > Running 'make namespacecheck' found lots of functions that > should be declared static, since only used in one file. > > Signed-off-by: Stephen Hemminger Applied both, thanks. -- To unsubscribe from this list: send the line "u

Re: [PATCH] kvm: x86: Fix debug typo error in lapic

2014-01-08 Thread Marcelo Tosatti
On Thu, Jan 02, 2014 at 05:14:11PM +0800, Chen Fan wrote: > fix the 'vcpi' typos when apic_debug is enabled. > > Signed-off-by: Chen Fan > --- > arch/x86/kvm/lapic.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) Applied, thanks. -- To unsubscribe from this list: send the line "

Re: [PATCH] Move translate_gpa() initialization for the nested context into init_kvm_nested_mmu()

2014-01-08 Thread Marcelo Tosatti
On Mon, Dec 30, 2013 at 08:22:21PM -0500, Zhihui Zhang wrote: > This is the right place to set the function pointer. In addition, change > function name > from translate_nested_gpa() to translate_gpa_nested() to match the naming > convention of > other functions (e.g., paging64_gva_to_gpa_nested(

KVM: x86: fix tsc catchup issue with tsc scaling

2014-01-06 Thread Marcelo Tosatti
events. Signed-off-by: Marcelo Tosatti Index: linux-2.6.git/arch/x86/kvm/x86.c === --- linux-2.6.git.orig/arch/x86/kvm/x86.c +++ linux-2.6.git/arch/x86/kvm/x86.c @@ -1484,7 +1484,7 @@ static int kvm_guest_time_update(struct un

KVM: x86: limit PIT timer frequency

2014-01-06 Thread Marcelo Tosatti
Limit PIT timer frequency similarly to the limit applied by LAPIC timer. Cc: sta...@kernel.org Signed-off-by: Marcelo Tosatti diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c index 412a5aa..518d864 100644 --- a/arch/x86/kvm/i8254.c +++ b/arch/x86/kvm/i8254.c @@ -37,6 +37,7

Re: KVM: VMX: fix use after free of vmx->loaded_vmcs

2014-01-03 Thread Marcelo Tosatti
On Fri, Jan 03, 2014 at 08:27:07PM +0100, Jan Kiszka wrote: > On 2014-01-03 20:00, Marcelo Tosatti wrote: > > > > After free_loaded_vmcs executes, the "loaded_vmcs" structure > > is kfreed, and now vmx->loaded_vmcs points to a kfreed area. > > Subs

KVM: x86: handle invalid root_hpa everywhere

2014-01-03 Thread Marcelo Tosatti
Rom Freiman notes other code paths vulnerable to bug fixed by 989c6b34f6a9480e397b. Signed-off-by: Marcelo Tosatti diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 31a5702..e50425d 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -2832,6 +2832,9 @@ static bool

KVM: VMX: fix use after free of vmx->loaded_vmcs

2014-01-03 Thread Marcelo Tosatti
g.cgi?id=1047892 Signed-off-by: Marcelo Tosatti diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c index da7837e..2efa33f0 100644 --- a/arch/x86/kvm/vmx.c +++ b/arch/x86/kvm/vmx.c @@ -7332,8 +7332,8 @@ static void vmx_free_vcpu(struct kvm_vcpu *vcpu) struct vcpu_vmx *vmx = to_vmx(vcpu);

nested_free_all_saved_vmcss freeing vmx->vmcs01?

2014-01-03 Thread Marcelo Tosatti
Am i missing something, or should nested_free_all_saved_vmcss not call if (vmx->loaded_vmcs != &vmx->vmcs01) free_loaded_vmcs(&vmx->vmcs01); ? -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majord...@vger.kernel.org More ma

[GIT PULL] KVM fixes for 3.13-rc6

2014-01-02 Thread Marcelo Tosatti
Linus, Please pull from git://git.kernel.org/pub/scm/virt/kvm/kvm.git master To receive the following KVM bug fixes Jan Kiszka (2): KVM: x86: Fix APIC map calculation after re-enabling KVM: nVMX: Unconditionally uninit the MMU on nested vmexit arch/x86/kvm/lapic.c |8 ---

Re: [RFC PATCH v3 1/2] add support for Hyper-V reference time counter

2014-01-02 Thread Marcelo Tosatti
On Thu, Jan 02, 2014 at 05:08:07PM +0100, Peter Lieven wrote: > > Not using irq disable/enable pairs. The subtraction is not dependant on > > any particular time. > > > > local_irq_disable(); > > now_ns = get_kernel_ns(); > > local_irq_enable(); > >

Re: [RFC PATCH v3 1/2] add support for Hyper-V reference time counter

2014-01-02 Thread Marcelo Tosatti
On Thu, Jan 02, 2014 at 02:15:48PM +0100, Peter Lieven wrote: > Am 11.12.2013 19:53, schrieb Marcelo Tosatti: > > On Sun, Dec 08, 2013 at 10:33:38PM +1100, Vadim Rozenfeld wrote: > >> Signed-off: Peter Lieven > >> Signed-off: Gleb Natapov > >> Signed-off:

Re: [PULL 00/15] KVM/{arm,arm64} updates for 3.14

2014-01-02 Thread Marcelo Tosatti
On Sat, Dec 28, 2013 at 11:15:32AM +, Marc Zyngier wrote: > Hi Marcelo, > > Could you please pull the following tag into kvm/next? > > It contains the long overdue GIC+timer save/restore interface for > KVM/arm, and a couple of other less important changes for KVM/arm64. > > Thanks, > >

Re: [PATCH] KVM: nVMX: Unconditionally uninit the MMU on nested vmexit

2014-01-02 Thread Marcelo Tosatti
On Sat, Dec 28, 2013 at 04:31:52PM +0100, Jan Kiszka wrote: > Three reasons for doing this: 1. arch.walk_mmu points to arch.mmu anyway > in case nested EPT wasn't in use. 2. this aligns VMX with SVM. But 3. is > most important: nested_cpu_has_ept(vmcs12) queries the VMCS page, and if > one guest VC

Re: [RFC PATCH V1 0/6] mm: add a new option MREMAP_DUP to mmrep syscall

2013-12-31 Thread Marcelo Tosatti
On Tue, Dec 31, 2013 at 08:06:51PM +0800, Xiao Guangrong wrote: > > On Dec 31, 2013, at 4:23 AM, Marcelo Tosatti wrote: > > > On Tue, Dec 17, 2013 at 01:59:04PM +0800, Xiao Guangrong wrote: > >> > >> CCed KVM guys. > >> > >> On 05/10/2013 01

Re: [PATCH] KVM: x86: Fix APIC map calculation after re-enabling

2013-12-30 Thread Marcelo Tosatti
On Sun, Dec 29, 2013 at 02:29:30AM +0100, Jan Kiszka wrote: > From: Jan Kiszka > > Update arch.apic_base before triggering recalculate_apic_map. Otherwise > the recalculation will work against the previous state of the APIC and > will fail to build the correct map when an APIC is hardware-enabled

Re: [PATCH] [trivial] doc: kvm: Fix typo in doc/virtual/kvm

2013-12-30 Thread Marcelo Tosatti
On Sat, Dec 21, 2013 at 10:14:09AM -0800, Randy Dunlap wrote: > On 12/21/13 08:21, Masanari Iida wrote: > > Correct spelling typo in Documentations/virtual/kvm > > > > Signed-off-by: Masanari Iida > > Acked-by: Randy Dunlap > > Thanks. Applied, thanks. -- To unsubscribe from this list: send

Re: [RFC PATCH V1 0/6] mm: add a new option MREMAP_DUP to mmrep syscall

2013-12-30 Thread Marcelo Tosatti
On Tue, Dec 17, 2013 at 01:59:04PM +0800, Xiao Guangrong wrote: > > CCed KVM guys. > > On 05/10/2013 01:11 PM, Stefan Hajnoczi wrote: > > On Fri, May 10, 2013 at 4:28 AM, wenchao wrote: > >> 于 2013-5-9 22:13, Mel Gorman 写道: > >> > >>> On Thu, May 09, 2013 at 05:50:05PM +0800, wenchaoli...@gmail.

Re: [RFC][PATCH] KVM: nVMX: Leave VMX mode on apparent CPU reset

2013-12-30 Thread Marcelo Tosatti
On Mon, Dec 30, 2013 at 06:02:17PM -0200, Marcelo Tosatti wrote: > On Mon, Dec 16, 2013 at 10:32:34AM +0100, Jan Kiszka wrote: > > As long as we do not expose all the VMX related states to user space, > > there is no way to properly reset a VCPU when VMX is enabled. Emulate >

Re: [RFC][PATCH] KVM: nVMX: Leave VMX mode on apparent CPU reset

2013-12-30 Thread Marcelo Tosatti
On Mon, Dec 16, 2013 at 10:32:34AM +0100, Jan Kiszka wrote: > As long as we do not expose all the VMX related states to user space, > there is no way to properly reset a VCPU when VMX is enabled. Emulate > this for now by catching host-side clearings of the feature control MSR. > This allows to reb

Re: [RFC][PATCH] KVM: nVMX: Leave VMX mode on apparent CPU reset

2013-12-30 Thread Marcelo Tosatti
On Mon, Dec 16, 2013 at 10:32:34AM +0100, Jan Kiszka wrote: > As long as we do not expose all the VMX related states to user space, > there is no way to properly reset a VCPU when VMX is enabled. Emulate > this for now by catching host-side clearings of the feature control MSR. > This allows to reb

Re: KVM: MMU: handle invalid root_hpa at __direct_map

2013-12-27 Thread Marcelo Tosatti
On Sun, Dec 22, 2013 at 12:56:49PM -0200, Marcelo Tosatti wrote: > On Sun, Dec 22, 2013 at 11:17:21AM +0200, Rom Freiman wrote: > > Hello everyone, > > > > I've been chasing this bug for a while. > > > > According to my research, this bug fix is works fine

Re: [PATCH] KVM: SVM: Fix reading of DR6

2013-12-27 Thread Marcelo Tosatti
On Thu, Dec 19, 2013 at 02:24:59PM +0100, Jan Kiszka wrote: > In contrast to VMX, SVM dose not automatically transfer DR6 into the > VCPU's arch.dr6. So if we face a DR6 read, we must consult a new vendor > hook to obtain the current value. > > Fixes a regression of 020df0794f. > > Signed-off-by:

Re: KVM: MMU: handle invalid root_hpa at __direct_map

2013-12-22 Thread Marcelo Tosatti
On Sun, Dec 22, 2013 at 11:17:21AM +0200, Rom Freiman wrote: > Hello everyone, > > I've been chasing this bug for a while. > > According to my research, this bug fix is works fine for > 3.11.9-200.fc19.x86_64 kernel version (and I also came to almost similar > solution and really solved the crash

Re: KVM: MMU: handle invalid root_hpa at __direct_map

2013-12-20 Thread Marcelo Tosatti
On Fri, Dec 20, 2013 at 05:15:02PM +0800, Xiao Guangrong wrote: > On 12/20/2013 01:28 AM, Marcelo Tosatti wrote: > > > > It is possible for __direct_map to be called on invalid root_hpa > > (-1), two examples: > > > > 1) try_async_pf -> can_do_async

KVM: MMU: handle invalid root_hpa at __direct_map

2013-12-19 Thread Marcelo Tosatti
u_reset_context. Check for this possibility, let fault exception be regenerated. BZ: https://bugzilla.redhat.com/show_bug.cgi?id=924916 Signed-off-by: Marcelo Tosatti diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 40772ef..31a5702 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/m

mempath prefault: fix off-by-one error

2013-12-18 Thread Marcelo Tosatti
Fix off-by-one error (noticed by Andrea Arcangeli). Signed-off-by: Marcelo Tosatti diff --git a/exec.c b/exec.c index f4b9ef2..1be5252 100644 --- a/exec.c +++ b/exec.c @@ -1000,7 +1000,7 @@ static void *file_ram_alloc(RAMBlock *block, } /* MAP_POPULATE silently ignores

Re: [RFC PATCH v3 2/2] add support for Hyper-V partition reference time enlightenment

2013-12-11 Thread Marcelo Tosatti
On Sun, Dec 08, 2013 at 10:33:39PM +1100, Vadim Rozenfeld wrote: > The following patch allows to activate a partition reference > time enlightenment that is based on the host platform's support > for an Invariant Time Stamp Counter (iTSC). > > v2 -> v3 > Handle TSC sequence, scale, and offest chan

Re: [RFC PATCH v3 1/2] add support for Hyper-V reference time counter

2013-12-11 Thread Marcelo Tosatti
On Sun, Dec 08, 2013 at 10:33:38PM +1100, Vadim Rozenfeld wrote: > Signed-off: Peter Lieven > Signed-off: Gleb Natapov > Signed-off: Vadim Rozenfeld > > v1 -> v2 > 1. mark TSC page dirty as suggested by > Eric Northup and Gleb > 2. disable local irq when calling get_kernel_ns, > as i

Re: [RFC PATCH v3 2/2] add support for Hyper-V partition reference time enlightenment

2013-12-11 Thread Marcelo Tosatti
On Tue, Dec 10, 2013 at 10:23:17PM +1100, Vadim Rozenfeld wrote: > On Mon, 2013-12-09 at 15:32 +0100, Paolo Bonzini wrote: > > Il 08/12/2013 12:33, Vadim Rozenfeld ha scritto: > > > + tsc_ref.tsc_sequence = > > > + boot_cpu_has(X86_FEATURE_CONSTANT_TSC) ? 1 : 0; > > > +

Re: [RFC PATCH v3 1/2] add support for Hyper-V reference time counter

2013-12-11 Thread Marcelo Tosatti
On Wed, Dec 11, 2013 at 04:53:05PM -0200, Marcelo Tosatti wrote: > On Sun, Dec 08, 2013 at 10:33:38PM +1100, Vadim Rozenfeld wrote: > > Signed-off: Peter Lieven > > Signed-off: Gleb Natapov > > Signed-off: Vadim Rozenfeld > > > > v1 -> v2 > &

Re: [PATCH] target-i386: clear guest TSC on reset

2013-12-06 Thread Marcelo Tosatti
On Fri, Dec 06, 2013 at 05:24:18PM +0900, Fernando Luis Vázquez Cao wrote: > On 12/06/2013 01:38 AM, Paolo Bonzini wrote: > >Il 05/12/2013 17:17, Marcelo Tosatti ha scritto: > >>>>I agree it is a bit ugly, but in my testing QEMU seemed to loop over all > >>>&

Re: [PATCH v3 07/15] KVM: MMU: introduce nulls desc

2013-12-05 Thread Marcelo Tosatti
On Thu, Dec 05, 2013 at 11:30:27PM +0800, Xiao Guangrong wrote: > In some cases, the lockless walker will do endless-walking on desc and > without rewalk, consider this case: > > there are two descs: desc1 and desc2 who is pointed by desc1->next: > desc1->next = desc2. > > CPU 0

Re: [PATCH v3 07/15] KVM: MMU: introduce nulls desc

2013-12-05 Thread Marcelo Tosatti
On Thu, Dec 05, 2013 at 11:30:27PM +0800, Xiao Guangrong wrote: > > Is it not the case that simply moving to the slow path once a maximum of > > rewalks has been reached enough? (looks a like a good solution). > > In some cases, the lockless walker will do endless-walking on desc and > without rew

Re: [PATCH] target-i386: clear guest TSC on reset

2013-12-05 Thread Marcelo Tosatti
On Thu, Dec 05, 2013 at 02:40:00PM -0200, Marcelo Tosatti wrote: > On Thu, Dec 05, 2013 at 05:02:02PM +0100, Paolo Bonzini wrote: > > Il 05/12/2013 16:42, Fernando Luis Vazquez Cao ha scritto: > > > (2013/12/05 22:53), Paolo Bonzini wrote: > > >> Il 05/12/2013 14:15

Re: [PATCH] target-i386: clear guest TSC on reset

2013-12-05 Thread Marcelo Tosatti
On Thu, Dec 05, 2013 at 05:02:02PM +0100, Paolo Bonzini wrote: > Il 05/12/2013 16:42, Fernando Luis Vazquez Cao ha scritto: > > (2013/12/05 22:53), Paolo Bonzini wrote: > >> Il 05/12/2013 14:15, Fernando Luis Vazquez Cao ha scritto: > >>> /* > >>> * KVM is yet unable to synchroni

Re: [PATCH] target-i386: clear guest TSC on reset

2013-12-05 Thread Marcelo Tosatti
On Fri, Dec 06, 2013 at 12:42:44AM +0900, Fernando Luis Vazquez Cao wrote: > (2013/12/05 22:53), Paolo Bonzini wrote: > > Il 05/12/2013 14:15, Fernando Luis Vazquez Cao ha scritto: > >> /* > >> * KVM is yet unable to synchronize TSC values of multiple VCPUs > >> on > >>

Re: [PATCH] target-i386: clear guest TSC on reset

2013-12-05 Thread Marcelo Tosatti
> > TSC (Time Stamp Counter MSR 10H) should be cleared on > > reset. Due to this erratum the TSC is not affected by warm > > reset." > > > > Cc: sta...@vger.kernel.org > > Cc: Will Auld > > Cc: Marcelo Tosatti > > Signed-off-by:

Re: [PATCH v3 07/15] KVM: MMU: introduce nulls desc

2013-12-05 Thread Marcelo Tosatti
GOn Tue, Dec 03, 2013 at 03:10:48PM +0800, Xiao Guangrong wrote: > On 11/28/2013 04:53 PM, Xiao Guangrong wrote: > > On 11/27/2013 03:31 AM, Marcelo Tosatti wrote: > >> On Tue, Nov 26, 2013 at 11:21:37AM +0800, Xiao Guangrong wrote: > >>> On 11/26/2013 02:12 AM, Ma

Re: [PATCH v3 07/15] KVM: MMU: introduce nulls desc

2013-11-26 Thread Marcelo Tosatti
On Tue, Nov 26, 2013 at 11:21:37AM +0800, Xiao Guangrong wrote: > On 11/26/2013 02:12 AM, Marcelo Tosatti wrote: > > On Mon, Nov 25, 2013 at 02:29:03PM +0800, Xiao Guangrong wrote: > >>>> Also, there is no guarantee of termination (as long as sptes are > >>>>

Re: [PATCH v3 07/15] KVM: MMU: introduce nulls desc

2013-11-26 Thread Marcelo Tosatti
On Tue, Nov 26, 2013 at 11:10:19AM +0800, Xiao Guangrong wrote: > On 11/25/2013 10:23 PM, Marcelo Tosatti wrote: > > On Mon, Nov 25, 2013 at 02:48:37PM +0200, Avi Kivity wrote: > >> On Mon, Nov 25, 2013 at 8:11 AM, Xiao Guangrong > >> wrote: > >>> >

Re: [PATCHv2] KVM: optimize apic interrupt delivery

2013-11-26 Thread Marcelo Tosatti
On Tue, Nov 26, 2013 at 06:24:13PM +0200, Michael S. Tsirkin wrote: > On Wed, Sep 12, 2012 at 08:13:54AM -0700, Paul E. McKenney wrote: > > On Wed, Sep 12, 2012 at 03:44:26PM +0300, Gleb Natapov wrote: > > > On Wed, Sep 12, 2012 at 03:36:57PM +0300, Avi Kivity wrote: > > > > On 09/12/2012 03:34 PM,

Re: [PATCH v3 07/15] KVM: MMU: introduce nulls desc

2013-11-25 Thread Marcelo Tosatti
On Mon, Nov 25, 2013 at 02:29:03PM +0800, Xiao Guangrong wrote: > >> Also, there is no guarantee of termination (as long as sptes are > >> deleted with the correct timing). BTW, can't see any guarantee of > >> termination for rculist nulls either (a writer can race with a lockless > >> reader indef

Re: [PATCH v3 07/15] KVM: MMU: introduce nulls desc

2013-11-25 Thread Marcelo Tosatti
GOn Mon, Nov 25, 2013 at 04:29:28PM +0200, Gleb Natapov wrote: > On Mon, Nov 25, 2013 at 12:23:51PM -0200, Marcelo Tosatti wrote: > > On Mon, Nov 25, 2013 at 02:48:37PM +0200, Avi Kivity wrote: > > > On Mon, Nov 25, 2013 at 8:11 AM, Xiao Guangrong > > > wrote: > >

Re: [PATCH v3 07/15] KVM: MMU: introduce nulls desc

2013-11-25 Thread Marcelo Tosatti
On Mon, Nov 25, 2013 at 02:11:31PM +0800, Xiao Guangrong wrote: > > On Nov 23, 2013, at 3:14 AM, Marcelo Tosatti wrote: > > > On Wed, Oct 23, 2013 at 09:29:25PM +0800, Xiao Guangrong wrote: > >> It likes nulls list and we use the pte-list as the nulls which can help

Re: [PATCH v3 07/15] KVM: MMU: introduce nulls desc

2013-11-25 Thread Marcelo Tosatti
On Mon, Nov 25, 2013 at 02:48:37PM +0200, Avi Kivity wrote: > On Mon, Nov 25, 2013 at 8:11 AM, Xiao Guangrong > wrote: > > > > On Nov 23, 2013, at 3:14 AM, Marcelo Tosatti wrote: > > > > I'm not really following, but note that parent_pte predates EPT (and &

Re: [PATCH v3 07/15] KVM: MMU: introduce nulls desc

2013-11-22 Thread Marcelo Tosatti
On Wed, Oct 23, 2013 at 09:29:25PM +0800, Xiao Guangrong wrote: > It likes nulls list and we use the pte-list as the nulls which can help us to > detect whether the "desc" is moved to anther rmap then we can re-walk the rmap > if that happened > > kvm->slots_lock is held when we do lockless walkin

Re: [PATCH 04/12] KVM: MMU: log dirty page after marking spte writable

2013-11-20 Thread Marcelo Tosatti
On Wed, Nov 20, 2013 at 10:20:09PM +0800, Xiao Guangrong wrote: > > But what guarantee does userspace require, from GET_DIRTY_LOG, while vcpus > > are > > executing? > > Aha. Single calling GET_DIRTY_LOG is useless since new dirty page can be > generated > when GET_DIRTY_LOG is being returned.

Re: [PATCH 04/12] KVM: MMU: log dirty page after marking spte writable

2013-11-19 Thread Marcelo Tosatti
On Tue, Nov 19, 2013 at 10:29:20PM -0200, Marcelo Tosatti wrote: > A call to GET_DIRTY_LOG guarantees to return correct information about > dirty pages before invocation of the previous GET_DIRTY_LOG call. > Can you explain why it is OK to relax this rule? That is, this might be OK, b

Re: [PATCH 04/12] KVM: MMU: log dirty page after marking spte writable

2013-11-19 Thread Marcelo Tosatti
On Wed, Aug 07, 2013 at 12:06:49PM +0800, Xiao Guangrong wrote: > On 08/07/2013 09:48 AM, Marcelo Tosatti wrote: > > On Tue, Jul 30, 2013 at 09:02:02PM +0800, Xiao Guangrong wrote: > >> Make sure we can see the writable spte before the dirt bitmap is visible > >

Re: [PATCH v3 06/15] KVM: MMU: redesign the algorithm of pte_list

2013-11-18 Thread Marcelo Tosatti
move the entry: when a spte is deleted, we move the entry in the first >desc to that position > > Both of these also can reduce cache miss > > Signed-off-by: Xiao Guangrong Reviewed-by: Marcelo Tosatti -- To unsubscribe from this list: send the line "unsubscribe kvm&q

Re: [PATCH v3 04/15] KVM: MMU: flush tlb out of mmu lock when write-protect the sptes

2013-11-18 Thread Marcelo Tosatti
On Fri, Nov 15, 2013 at 03:09:13PM +0800, Xiao Guangrong wrote: > On 11/15/2013 02:39 AM, Marcelo Tosatti wrote: > > On Thu, Nov 14, 2013 at 01:15:24PM +0800, Xiao Guangrong wrote: > >> > >> Hi Marcelo, > >> > >> On 11/14/2013 08:36 AM, Marcelo Tosa

Re: [PATCH v3 04/15] KVM: MMU: flush tlb out of mmu lock when write-protect the sptes

2013-11-14 Thread Marcelo Tosatti
On Thu, Nov 14, 2013 at 01:15:24PM +0800, Xiao Guangrong wrote: > > Hi Marcelo, > > On 11/14/2013 08:36 AM, Marcelo Tosatti wrote: > > > > > Any code location which reads the writable bit in the spte and assumes if > > its not > > set, that the tran

Re: [PATCH v3 05/15] KVM: MMU: update spte and add it into rmap before dirty log

2013-11-14 Thread Marcelo Tosatti
ons(+), 18 deletions(-) Reviewed-by: Marcelo Tosatti -- 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 v3 04/15] KVM: MMU: flush tlb out of mmu lock when write-protect the sptes

2013-11-13 Thread Marcelo Tosatti
On Wed, Oct 23, 2013 at 09:29:22PM +0800, Xiao Guangrong wrote: > Now we can flush all the TLBs out of the mmu lock without TLB corruption when > write-proect the sptes, it is because: > - we have marked large sptes readonly instead of dropping them that means we > just change the spte from writa

Re: [PATCH v3 02/15] KVM: MMU: lazily drop large spte

2013-11-12 Thread Marcelo Tosatti
LE_LEVEL level) can be fast fixed > > Signed-off-by: Xiao Guangrong Reviewed-by: Marcelo Tosatti -- 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 v3 03/15] KVM: MMU: flush tlb if the spte can be locklessly modified

2013-11-12 Thread Marcelo Tosatti
!!! At this point, the shadow page can still > be > writable due to the corrupt tlb entry > Flush all TLB > > Signed-off-by: Xiao Guangrong Reviewed-by: Marcelo Tosatti -- To unsubscribe from this list: send the line "unsubscribe kvm"

Re: [PATCH v3 01/15] KVM: MMU: properly check last spte in fast_page_fault()

2013-11-11 Thread Marcelo Tosatti
/locking.txt to get more detail. >*/ > - ret = fast_pf_fix_direct_spte(vcpu, iterator.sptep, spte); > + ret = fast_pf_fix_direct_spte(vcpu, sp, iterator.sptep, spte); > exit: > trace_fast_page_fault(vcpu, gva, error_code, iterator.sptep, >

Re: [PATCH v2] KVM: IOMMU: hva align mapping page size

2013-11-04 Thread Marcelo Tosatti
p */ > + while (__gfn_to_hva_memslot(slot, gfn) & (page_size - 1)) > + page_size >>= 1; > + > /* >* Pin all pages we are about to map in memory. This is > * important because we unmap and un

Re: intel-iommu: iova_to_phys: fill in bits from iova when large pte

2013-11-04 Thread Marcelo Tosatti
On Mon, Nov 04, 2013 at 10:07:54AM -0700, Greg Edwards wrote: > On Fri, Nov 01, 2013 at 06:45:12PM -0700, Marcelo Tosatti wrote: > > > > intel_iommu_iova_to_phys returns incorrect physical address > > when iova is translated by large pte. > > > > Fill in bits fro

intel-iommu: iova_to_phys: fill in bits from iova when large pte

2013-11-01 Thread Marcelo Tosatti
intel_iommu_iova_to_phys returns incorrect physical address when iova is translated by large pte. Fill in bits from iova when creating the physical address. Signed-off-by: Marcelo Tosatti diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 15e9b57..f8f2988 100644

Re: BUG unpinning 1 GiB huge pages with KVM PCI assignment

2013-11-01 Thread Marcelo Tosatti
On Fri, Nov 01, 2013 at 12:01:26PM -0600, Greg Edwards wrote: > >> Is it expected the same pages might be mapped in multiple memslots? I > >> noticed the gfn overlap check in __kvm_set_memory_region(). > >> > >> It appears pfn_to_dma_pte() is behaving as expected, given half the huge > >> page is

Re: [PATCH] KVM: IOMMU: hva align mapping page size

2013-11-01 Thread Marcelo Tosatti
On Fri, Nov 01, 2013 at 10:08:55AM -0600, Greg Edwards wrote: > When determining the page size we could use to map with the IOMMU, the > page size should be aligned with the hva, not the gfn. The gfn may not > reflect the real alignment within the hugetlbfs file. > > Most of the time, this works

Re: BUG unpinning 1 GiB huge pages with KVM PCI assignment

2013-11-01 Thread Marcelo Tosatti
On Tue, Oct 29, 2013 at 05:19:43PM -0600, Greg Edwards wrote: > On Mon, Oct 28, 2013 at 12:37:56PM -0700, Greg Edwards wrote: > > Using KVM PCI assignment with 1 GiB huge pages trips a BUG in 3.12.0-rc7, > > e.g. > > > > # qemu-system-x86_64 \ > > -m 8192 \ > > -mem-path /var/lib/hugetlbfs

Re: [PATCH 2/2] KVM: x86: fix KVM_SET_XCRS loop

2013-10-17 Thread Marcelo Tosatti
On Thu, Oct 17, 2013 at 04:50:47PM +0200, Paolo Bonzini wrote: > The loop was always using 0 as the index. This means that > any rubbish after the first element of the array went undetected. > It seems reasonable to assume that no KVM userspace did that. It is not a typo, look at __kvm_set_xcr wh

Re: [patch 0/2] generic kernel watchdog reset at pvclock read (v2)

2013-10-16 Thread Marcelo Tosatti
On Wed, Oct 16, 2013 at 02:25:00PM -0400, Don Zickus wrote: > On Fri, Oct 11, 2013 at 09:39:24PM -0300, Marcelo Tosatti wrote: > > v2: > > - do not create hung_task.h, move defines to sched.h (Don Zickus) > > - switch patch order (Paolo) > > As long as it solves kvm&

Re: [PATCH v2 12/15] KVM: MMU: allow locklessly access shadow page table out of vcpu thread

2013-10-16 Thread Marcelo Tosatti
On Wed, Oct 16, 2013 at 12:12:11PM +0300, Gleb Natapov wrote: > On Tue, Oct 15, 2013 at 07:21:19PM -0300, Marcelo Tosatti wrote: > > On Tue, Oct 15, 2013 at 06:57:05AM +0300, Gleb Natapov wrote: > > > > > > > > Why is it safe to allow access, by the lockless pa

Re: [PATCH v2 12/15] KVM: MMU: allow locklessly access shadow page table out of vcpu thread

2013-10-15 Thread Marcelo Tosatti
On Tue, Oct 15, 2013 at 06:57:05AM +0300, Gleb Natapov wrote: > > > > Why is it safe to allow access, by the lockless page write protect > > side, to spt pointer for shadow page A that can change to a shadow page > > pointer of shadow page B? > > > > Write protect spte of any page at will? Or ve

Re: [PATCH v2 12/15] KVM: MMU: allow locklessly access shadow page table out of vcpu thread

2013-10-14 Thread Marcelo Tosatti
On Sat, Oct 12, 2013 at 08:53:56AM +0300, Gleb Natapov wrote: > On Fri, Oct 11, 2013 at 05:30:17PM -0300, Marcelo Tosatti wrote: > > On Fri, Oct 11, 2013 at 08:38:31AM +0300, Gleb Natapov wrote: > > > > n_max_mmu_pages is not a suitable limit to throttle freeing of pages via

[patch 0/2] generic kernel watchdog reset at pvclock read (v2)

2013-10-11 Thread Marcelo Tosatti
v2: - do not create hung_task.h, move defines to sched.h (Don Zickus) - switch patch order (Paolo) -- 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 2/2] hung_task: add method to reset detector

2013-10-11 Thread Marcelo Tosatti
In certain occasions it is possible for a hung task detector positive to be false: continuation from a paused VM, for example. Add a method to reset detection, similar as is done with other kernel watchdogs. Signed-off-by: Marcelo Tosatti Index: kvm/kernel/hung_task.c

[patch 1/2] pvclock: detect watchdog reset at pvclock read

2013-10-11 Thread Marcelo Tosatti
Implement reset of kernel watchdogs at pvclock read time. This avoids adding special code to every watchdog. This is possible for watchdogs which measure time based on sched_clock() or ktime_get() variants. Suggested by Don Zickus. Signed-off-by: Marcelo Tosatti Index: kvm/arch/x86/kernel

Re: [PATCH v2 12/15] KVM: MMU: allow locklessly access shadow page table out of vcpu thread

2013-10-11 Thread Marcelo Tosatti
On Fri, Oct 11, 2013 at 08:38:31AM +0300, Gleb Natapov wrote: > > n_max_mmu_pages is not a suitable limit to throttle freeing of pages via > > RCU (its too large). If the free memory watermarks are smaller than > > n_max_mmu_pages for all guests, OOM is possible. > > > Ah, yes. I am not saying n_

Re: [PATCH v2 12/15] KVM: MMU: allow locklessly access shadow page table out of vcpu thread

2013-10-10 Thread Marcelo Tosatti
On Thu, Oct 10, 2013 at 10:16:46PM +0300, Gleb Natapov wrote: > On Thu, Oct 10, 2013 at 01:42:22PM -0300, Marcelo Tosatti wrote: > > On Thu, Oct 10, 2013 at 03:08:45PM +0300, Gleb Natapov wrote: > > > On Wed, Oct 09, 2013 at 10:47:10PM -0300, Marcelo Tosatti wrote: > >

Re: [PATCH v2 12/15] KVM: MMU: allow locklessly access shadow page table out of vcpu thread

2013-10-10 Thread Marcelo Tosatti
On Thu, Oct 10, 2013 at 03:08:45PM +0300, Gleb Natapov wrote: > On Wed, Oct 09, 2013 at 10:47:10PM -0300, Marcelo Tosatti wrote: > > > >> Gleb has a idea that uses RCU_DESTORY to protect the shadow page table > > > >> and encodes the page-level into th

Re: [PATCH v2 12/15] KVM: MMU: allow locklessly access shadow page table out of vcpu thread

2013-10-09 Thread Marcelo Tosatti
On Wed, Oct 09, 2013 at 06:45:47PM +0800, Xiao Guangrong wrote: > On 10/09/2013 09:56 AM, Marcelo Tosatti wrote: > > On Tue, Oct 08, 2013 at 12:02:32PM +0800, Xiao Guangrong wrote: > >> > >> Hi Marcelo, > >> > >> On Oct 8, 2013, at 9:23 AM, Marcelo T

Re: [patch 2/3] pvclock: detect watchdog reset at pvclock read

2013-10-09 Thread Marcelo Tosatti
On Wed, Oct 09, 2013 at 09:55:19AM -0400, Don Zickus wrote: > On Tue, Oct 08, 2013 at 07:08:11PM -0300, Marcelo Tosatti wrote: > > On Tue, Oct 08, 2013 at 09:37:05AM -0400, Don Zickus wrote: > > > On Mon, Oct 07, 2013 at 10:05:17PM -0300, Marcelo Tosatti wrote: > > >

Re: [patch 2/3] pvclock: detect watchdog reset at pvclock read

2013-10-08 Thread Marcelo Tosatti
On Tue, Oct 08, 2013 at 11:58:10AM +0200, Paolo Bonzini wrote: > Il 08/10/2013 03:05, Marcelo Tosatti ha scritto: > > +void pvclock_touch_watchdogs(void) > > +{ > > + touch_softlockup_watchdog_sync(); > > + clocksource_touch_watchdog();

Re: [PATCH v2 12/15] KVM: MMU: allow locklessly access shadow page table out of vcpu thread

2013-10-08 Thread Marcelo Tosatti
On Tue, Oct 08, 2013 at 12:02:32PM +0800, Xiao Guangrong wrote: > > Hi Marcelo, > > On Oct 8, 2013, at 9:23 AM, Marcelo Tosatti wrote: > > >> > >> + if (kvm->arch.rcu_free_shadow_page) { > >> + kvm_mmu_isolate_pages(invalid_list); >

Re: [patch 2/3] pvclock: detect watchdog reset at pvclock read

2013-10-08 Thread Marcelo Tosatti
On Tue, Oct 08, 2013 at 09:37:05AM -0400, Don Zickus wrote: > On Mon, Oct 07, 2013 at 10:05:17PM -0300, Marcelo Tosatti wrote: > > Implement reset of kernel watchdogs at pvclock read time. This avoids > > adding special code to every watchdog. > > > > This is possible

Re: [PATCH v2 12/15] KVM: MMU: allow locklessly access shadow page table out of vcpu thread

2013-10-07 Thread Marcelo Tosatti
On Thu, Sep 05, 2013 at 06:29:15PM +0800, Xiao Guangrong wrote: > It is easy if the handler is in the vcpu context, in that case we can use > walk_shadow_page_lockless_begin() and walk_shadow_page_lockless_end() that > disable interrupt to stop shadow page being freed. But we are on the ioctl > con

[patch 2/3] pvclock: detect watchdog reset at pvclock read

2013-10-07 Thread Marcelo Tosatti
Implement reset of kernel watchdogs at pvclock read time. This avoids adding special code to every watchdog. This is possible for watchdogs which measure time based on sched_clock() or ktime_get() variants. Suggested by Don Zickus. Signed-off-by: Marcelo Tosatti Index: kvm/arch/x86/kernel

[patch 0/3] generic kernel watchdog reset at pvclock read

2013-10-07 Thread Marcelo Tosatti
See individual patches for details. -- 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 3/3] 01-hung-task-watchdog-reset 02-kvmclock-touch-watchdog-on-kvmclock-read series

2013-10-07 Thread Marcelo Tosatti
Please ignore patch 3/3 - there is 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 1/3] hung_task: add method to reset detector

2013-10-07 Thread Marcelo Tosatti
In certain occasions it is possible for a hung task detector positive to be false: continuation from a paused VM, for example. Add a method to reset detection, similar as is done with other kernel watchdogs. Signed-off-by: Marcelo Tosatti Index: kvm/kernel/hung_task.c

[patch 3/3] 01-hung-task-watchdog-reset 02-kvmclock-touch-watchdog-on-kvmclock-read series

2013-10-07 Thread Marcelo Tosatti
-- 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 v2 05/15] KVM: MMU: flush tlb out of mmu lock when write-protect the sptes

2013-09-30 Thread Marcelo Tosatti
On Thu, Sep 05, 2013 at 06:29:08PM +0800, Xiao Guangrong wrote: > Now we can flush all the TLBs out of the mmu lock without TLB corruption when > write-proect the sptes, it is because: > - we have marked large sptes readonly instead of dropping them that means we > just change the spte from writa

Re: [PATCH v2 03/15] KVM: MMU: lazily drop large spte

2013-09-30 Thread Marcelo Tosatti
On Thu, Sep 05, 2013 at 06:29:06PM +0800, Xiao Guangrong wrote: > Currently, kvm zaps the large spte if write-protected is needed, the later > read can fault on that spte. Actually, we can make the large spte readonly > instead of making them un-present, the page fault caused by read access can > b

Re: [PATCH v2 02/15] KVM: MMU: properly check last spte in fast_page_fault()

2013-09-30 Thread Marcelo Tosatti
On Thu, Sep 05, 2013 at 06:29:05PM +0800, Xiao Guangrong wrote: > Using sp->role.level instead of @level since @level is not got from the > page table hierarchy > > There is no issue in current code since the fast page fault currently only > fixes the fault caused by dirty-log that is always on th

[uq/master qemu PATCH] fix steal time MSR vmsd callback to proper opaque type

2013-09-03 Thread Marcelo Tosatti
Convert steal time MSR vmsd callback pointer to proper X86CPU type. Signed-off-by: Marcelo Tosatti diff --git a/target-i386/machine.c b/target-i386/machine.c index dc81cde..e568da2 100644 --- a/target-i386/machine.c +++ b/target-i386/machine.c @@ -330,9 +330,9 @@ static bool pv_eoi_msr_needed

Re: KVM: x86: update masterclock when kvmclock_offset is calculated

2013-09-03 Thread Marcelo Tosatti
On Tue, Sep 03, 2013 at 12:42:40PM +0200, Paolo Bonzini wrote: > Il 03/09/2013 05:03, Marcelo Tosatti ha scritto: > > > Here is the code I was thinking of: > > > > > > spin_lock(&ka->pvclock_gtod_sync_lock); > > > m

Re: KVM: x86: update masterclock when kvmclock_offset is calculated

2013-09-02 Thread Marcelo Tosatti
On Wed, Aug 28, 2013 at 02:37:20PM +0200, Paolo Bonzini wrote: > Il 28/08/2013 04:52, Marcelo Tosatti ha scritto: > > On Thu, Aug 22, 2013 at 07:05:20PM +0200, Paolo Bonzini wrote: > >> Il 20/08/2013 20:20, Marcelo Tosatti ha scritto: > >>> > >>> The

Re: [PATCH v2] kvm: warn if num cpus is greater than num recommended

2013-09-01 Thread Marcelo Tosatti
On Fri, Aug 23, 2013 at 03:24:37PM +0200, Andrew Jones wrote: > The comment in kvm_max_vcpus() states that it's using the recommended > procedure from the kernel API documentation to get the max number > of vcpus that kvm supports. It is, but by always returning the > maximum number supported. The

Re: KVM: x86: update masterclock when kvmclock_offset is calculated

2013-08-27 Thread Marcelo Tosatti
On Fri, Aug 23, 2013 at 12:00:46PM +0200, Paolo Bonzini wrote: > Il 22/08/2013 19:05, Paolo Bonzini ha scritto: > > Il 20/08/2013 20:20, Marcelo Tosatti ha scritto: > >> > >> The offset to add to the hosts monotonic time, kvmclock_offset, is > >> calc

Re: KVM: x86: update masterclock when kvmclock_offset is calculated

2013-08-27 Thread Marcelo Tosatti
On Thu, Aug 22, 2013 at 07:05:20PM +0200, Paolo Bonzini wrote: > Il 20/08/2013 20:20, Marcelo Tosatti ha scritto: > > > > The offset to add to the hosts monotonic time, kvmclock_offset, is > > calculated against the monotonic time at KVM_SET_CLOCK ioctl time. > >

KVM: x86: update masterclock when kvmclock_offset is calculated (v2)

2013-08-27 Thread Marcelo Tosatti
calculate kvmclock_offset. Signed-off-by: Marcelo Tosatti diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index d21bce5..0a93354 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -1457,6 +1457,29 @@ static void pvclock_update_vm_gtod_copy(struct kvm *kvm) #endif } +static void

KVM: x86: update masterclock when kvmclock_offset is calculated

2013-08-20 Thread Marcelo Tosatti
calculate kvmclock_offset. Signed-off-by: Marcelo Tosatti Index: linux-2.6-kvmclock-fixes/arch/x86/kvm/x86.c === --- linux-2.6-kvmclock-fixes.orig/arch/x86/kvm/x86.c +++ linux-2.6-kvmclock-fixes/arch/x86/kvm/x86.c @@ -3806,6 +3806,7 @@ long

Re: [uq/master PATCH] kvm: i386: fix LAPIC TSC deadline timer save/restore

2013-08-19 Thread Marcelo Tosatti
On Mon, Aug 19, 2013 at 08:57:58PM +0200, Paolo Bonzini wrote: > Il 19/08/2013 19:13, Marcelo Tosatti ha scritto: > > > > The configuration of the timer represented by MSR_IA32_TSCDEADLINE depends > > on: > > > > - APIC LVT Timer register. > > - TSC valu

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