01 Aug, 2010
40 commits
-
Otherwise we might try to deliver a timer interrupt to a cpu that
can't possibly handle it.Signed-off-by: Chris Lalancette
Signed-off-by: Marcelo Tosatti -
If the guest wants to accept timer interrupts on a CPU other
than the BSP, we need to remove this gate.Signed-off-by: Chris Lalancette
Signed-off-by: Marcelo Tosatti -
We really want to "kvm_set_irq" during the hrtimer callback,
but that is risky because that is during interrupt context.
Instead, offload the work to a workqueue, which is a bit safer
and should provide most of the same functionality.Signed-off-by: Chris Lalancette
Signed-off-by: Marcelo Tosatti -
emulate pusha instruction only writeback the last
EDI register, but the other registers which need
to be writeback is ignored. This patch fixed it.Signed-off-by: Wei Yongjun
Signed-off-by: Marcelo Tosatti -
Fix a slight error with assertion in local APIC code.
Signed-off-by: Zachary Amsden
Signed-off-by: Marcelo Tosatti -
While we mark the parent's unsync_child_bitmap, if the parent is already
unsynced, it no need walk it's parent, it can reduce some unnecessary
workloadSigned-off-by: Xiao Guangrong
Signed-off-by: Marcelo Tosatti -
In current code, some page's unsync_child_bitmap is not cleared completely
in mmu_sync_children(), for example, if two PDPEs shard one PDT, one of
PDPE's unsync_child_bitmap is not cleared.Currently, it not harm anything just little overload, but it's the prepare
work for the later patchSigned-off-by: Xiao Guangrong
Signed-off-by: Marcelo Tosatti -
Decrease sp->unsync_children after clear unsync_child_bitmap bit
Signed-off-by: Xiao Guangrong
Signed-off-by: Marcelo Tosatti -
If the sync-sp just sync transient, don't mark its pte notrap
Signed-off-by: Xiao Guangrong
Signed-off-by: Marcelo Tosatti -
The sync page is already write protected in mmu_sync_children(), don't
write protected it againSigned-off-by: Xiao Guangrong
Signed-off-by: Marcelo Tosatti -
Using wrap function to cleanup page dirty judgment
Signed-off-by: Xiao Guangrong
Signed-off-by: Marcelo Tosatti -
Rename 'page' and 'shadow_page' to 'sp' to better fit the context
Signed-off-by: Xiao Guangrong
Signed-off-by: Marcelo Tosatti -
This patch enable save/restore of xsave state.
Signed-off-by: Sheng Yang
Signed-off-by: Marcelo Tosatti -
Fix compile warning:
CC [M] arch/powerpc/kvm/powerpc.o
arch/powerpc/kvm/powerpc.c: In function 'kvm_arch_vcpu_ioctl_run':
arch/powerpc/kvm/powerpc.c:290: warning: 'gpr' may be used uninitialized in this function
arch/powerpc/kvm/powerpc.c:290: note: 'gpr' was declared hereSigned-off-by: Denis Kirjanov
Signed-off-by: Marcelo Tosatti -
On Intel, we call skip_emulated_instruction() even if we injected a #GP,
resulting in the #GP pointing at the wrong address.Fix by injecting the exception and skipping the instruction at the same place,
so we can do just one or the other.Signed-off-by: Avi Kivity
Signed-off-by: Marcelo Tosatti -
On Intel, we call skip_emulated_instruction() even if we injected a #GP,
resulting in the #GP pointing at the wrong address.Fix by injecting the exception and skipping the instruction at the same place,
so we can do just one or the other.Signed-off-by: Avi Kivity
Signed-off-by: Marcelo Tosatti -
On Intel, we call skip_emulated_instruction() even if we injected a #GP,
resulting in the #GP pointing at the wrong address.Fix by injecting the exception and skipping the instruction at the same place,
so we can do just one or the other.Signed-off-by: Avi Kivity
Signed-off-by: Marcelo Tosatti -
This patch enable guest to use XSAVE/XRSTOR instructions.
We assume that host_xcr0 would use all possible bits that OS supported.
And we loaded xcr0 in the same way we handled fpu - do it as late as we can.
Signed-off-by: Dexuan Cui
Signed-off-by: Sheng Yang
Reviewed-by: Marcelo Tosatti
Signed-off-by: Avi Kivity -
Signed-off-by: Avi Kivity
-
No real bugs in this one.
Signed-off-by: Andi Kleen
Signed-off-by: Avi Kivity -
When the user passed in a NULL mask pass this on from the ioctl
handler.Found by gcc 4.6's new warnings.
Signed-off-by: Andi Kleen
Signed-off-by: Avi Kivity -
delay local tlb flush until enter guest moden, it can reduce vpid flush
frequency and reduce remote tlb flush IPI(if KVM_REQ_TLB_FLUSH bit is
already set, IPI is not sent)Signed-off-by: Xiao Guangrong
Signed-off-by: Avi Kivity -
Use kvm_mmu_flush_tlb() function instead of calling
kvm_x86_ops->tlb_flush(vcpu) directly.Signed-off-by: Xiao Guangrong
Signed-off-by: Avi Kivity -
This remote tlb flush is no necessary since we have synced while
sp is zappedSigned-off-by: Xiao Guangrong
Signed-off-by: Avi Kivity -
fix:
[ INFO: suspicious rcu_dereference_check() usage. ]
---------------------------------------------------
include/linux/kvm_host.h:258 invoked rcu_dereference_check() without protection!other info that might help us debug this:
rcu_scheduler_active = 1, debug_locks = 1
1 lock held by qemu-system-x86/3796:
#0: (&vcpu->mutex){+.+.+.}, at: [] vcpu_load+0x1a/0x66 [kvm]stack backtrace:
Pid: 3796, comm: qemu-system-x86 Not tainted 2.6.34 #25
Call Trace:
[] lockdep_rcu_dereference+0x9d/0xa5
[] gfn_to_memslot_unaliased+0x65/0xa0 [kvm]
[] gfn_to_hva+0x22/0x4c [kvm]
[] kvm_write_guest_page+0x2a/0x7f [kvm]
[] kvm_clear_guest_page+0x1a/0x1c [kvm]
[] init_rmode+0x3b/0x180 [kvm_intel]
[] vmx_set_cr0+0x350/0x4d3 [kvm_intel]
[] kvm_arch_vcpu_ioctl_set_sregs+0x122/0x31a [kvm]
[] kvm_vcpu_ioctl+0x578/0xa3d [kvm]
[] ? cpu_clock+0x2d/0x40
[] ? fget_light+0x244/0x28e
[] ? trace_hardirqs_off_caller+0x1f/0x10e
[] vfs_ioctl+0x32/0xa6
[] do_vfs_ioctl+0x47f/0x4b8
[] ? sub_preempt_count+0xa3/0xb7
[] ? fget_light+0x266/0x28e
[] ? fget_light+0x111/0x28e
[] sys_ioctl+0x47/0x6a
[] system_call_fastpath+0x16/0x1bSigned-off-by: Xiao Guangrong
Signed-off-by: Avi Kivity -
The name "pid_sync_vcpu_all" isn't appropriate since it just affect
a single vpid, so rename it to vpid_sync_vcpu_single().Signed-off-by: Gui Jianfeng
Signed-off-by: Avi Kivity -
Add all-context INVVPID type support.
Signed-off-by: Gui Jianfeng
Signed-off-by: Avi Kivity -
collect remote tlb flush in kvm_mmu_pte_write() path
Signed-off-by: Xiao Guangrong
Signed-off-by: Avi Kivity -
Now, we can safely to traverse sp hlish
Signed-off-by: Xiao Guangrong
Signed-off-by: Avi Kivity -
Using kvm_mmu_prepare_zap_page() and kvm_mmu_zap_page() instead of
kvm_mmu_zap_page() that can reduce remote tlb flush IPISigned-off-by: Xiao Guangrong
Signed-off-by: Avi Kivity -
In the later patch, we will modify sp's zapping way like below:
kvm_mmu_prepare_zap_page A
kvm_mmu_prepare_zap_page B
kvm_mmu_prepare_zap_page C
....
kvm_mmu_commit_zap_page[ zaped multiple sps only need to call kvm_mmu_commit_zap_page once ]
In __kvm_mmu_free_some_pages() function, the free page number is
getted form 'vcpu->kvm->arch.n_free_mmu_pages' in loop, it will
hinders us to apply kvm_mmu_prepare_zap_page() and kvm_mmu_commit_zap_page()
since kvm_mmu_prepare_zap_page() not free sp.Signed-off-by: Xiao Guangrong
Signed-off-by: Avi Kivity -
Using kvm_mmu_prepare_zap_page() and kvm_mmu_commit_zap_page() to
split kvm_mmu_zap_page() function, then we can:- traverse hlist safely
- easily to gather remote tlb flush which occurs during page zappedThose feature can be used in the later patches
Signed-off-by: Xiao Guangrong
Signed-off-by: Avi Kivity -
Introduce for_each_gfn_sp() and for_each_gfn_indirect_valid_sp() to
cleanup hlist traverseingSigned-off-by: Xiao Guangrong
Signed-off-by: Avi Kivity -
In kvm_mmu_unprotect_page(), the invalid sp can be skipped
Signed-off-by: Xiao Guangrong
Signed-off-by: Avi Kivity -
According to SDM, we need check whether single-context INVVPID type is supported
before issuing invvpid instruction.Signed-off-by: Gui Jianfeng
Reviewed-by: Sheng Yang
Signed-off-by: Marcelo Tosatti -
Should use linux/uaccess.h instead of asm/uaccess.h
Signed-off-by: Lai Jiangshan
Signed-off-by: Marcelo Tosatti -
The type of '*new.rmap' is not 'struct page *', fix it
Signed-off-by: Lai Jiangshan
Signed-off-by: Marcelo Tosatti -
We only support 4 levels EPT pagetable now.
Signed-off-by: Sheng Yang
Signed-off-by: Marcelo Tosatti -
This patch adds a file that documents the usage of KVM-specific
MSRs.Signed-off-by: Glauber Costa
Reviewed-by: Randy Dunlap
Signed-off-by: Marcelo Tosatti -
Instead of instantiating a whole thread_struct on the stack use only the
required parts of it.Signed-off-by: Andreas Schwab
Tested-by: Alexander Graf
Signed-off-by: Marcelo Tosatti