RE: [RFC 0/2] VFIO SRIOV support

2015-12-23 Thread Ilya Lesokhin
Hi Alex, Regarding driver_override, as far as I know you can only use it on devices that were already discovered. Since the devices do not exist before the call to pci_enable_sriov(...) and are already probed after the call it wouldn't really help us. I would have to unbind them from their

[PATCH v1 6/6] kvm/x86: Update SynIC timers on guest entry only

2015-12-23 Thread Andrey Smetanin
Consolidate updating the Hyper-V SynIC timers in a single place: on guest entry in processing KVM_REQ_HV_STIMER request. This simplifies the overall logic, and makes sure the most current state of msrs and guest clock is used for arming the timers (to achieve that, KVM_REQ_HV_STIMER has to be

[PATCH v1 1/6] kvm/x86: Drop stimer_stop() function

2015-12-23 Thread Andrey Smetanin
The function stimer_stop() is called in one place so remove the function and replace it's call by function content. Signed-off-by: Andrey Smetanin Reviewed-by: Roman Kagan CC: Gleb Natapov CC: Paolo Bonzini

[PATCH v1 2/6] kvm/x86: Hyper-V unify stimer_start() and stimer_restart()

2015-12-23 Thread Andrey Smetanin
This will be used in future to start Hyper-V SynIC timer in several places by one logic in one function. Signed-off-by: Andrey Smetanin Reviewed-by: Roman Kagan CC: Gleb Natapov CC: Paolo Bonzini CC: Roman

[PATCH v1 3/6] kvm/x86: Reorg stimer_expiration() to better control timer restart

2015-12-23 Thread Andrey Smetanin
Split stimer_expiration() into two parts - timer expiration message sending and timer restart/cleanup based on timer state(config). This also fixes a bug where a one-shot timer message whose delivery failed once would get lost for good. Signed-off-by: Andrey Smetanin

[PATCH v1 0/6] KVM: Hyper-V SynIC timers migration fixes

2015-12-23 Thread Andrey Smetanin
During testing of Windows 2012R2 guest migration with Hyper-V SynIC timers enabled we found several bugs which lead to restoring guest in a hung state. This patch series provides several fixes to make the migration of guest with Hyper-V SynIC timers enabled succeed. The series applies on top of

[PATCH v1 5/6] kvm/x86: Skip SynIC vector check for QEMU side

2015-12-23 Thread Andrey Smetanin
QEMU zero-inits Hyper-V SynIC vectors. We should allow that, and don't reject zero values if set by the host. Signed-off-by: Andrey Smetanin Reviewed-by: Roman Kagan CC: Gleb Natapov CC: Paolo Bonzini CC:

[PATCH v1 4/6] kvm/x86: Hyper-V fix SynIC timer disabling condition

2015-12-23 Thread Andrey Smetanin
Hypervisor Function Specification(HFS) doesn't require to disable SynIC timer at timer config write if timer->count = 0. So drop this check, this allow to load timers MSR's during migration restore, because config are set before count in QEMU side. Also fix condition according to HFS

[PATCH v2 08/11] KVM: MMU: use page track for non-leaf shadow pages

2015-12-23 Thread Xiao Guangrong
non-leaf shadow pages are always write protected, it can be the user of page track Signed-off-by: Xiao Guangrong --- arch/x86/kvm/mmu.c | 26 +- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/arch/x86/kvm/mmu.c

[PATCH v2 06/11] KVM: MMU: let page fault handler be aware tracked page

2015-12-23 Thread Xiao Guangrong
The page fault caused by write access on the write tracked page can not be fixed, it always need to be emulated. page_fault_handle_page_track() is the fast path we introduce here to skip holding mmu-lock and shadow page table walking However, if the page table is not present, it is worth making

[PATCH v2 11/11] KVM: MMU: apply page track notifier

2015-12-23 Thread Xiao Guangrong
Register the notifier to receive write track event so that we can update our shadow page table It makes kvm_mmu_pte_write() be the callback of the notifier, no function is changed Signed-off-by: Xiao Guangrong --- arch/x86/include/asm/kvm_host.h | 5 +++--

[PATCH v2 10/11] KVM: MMU: clear write-flooding on the fast path of tracked page

2015-12-23 Thread Xiao Guangrong
If the page fault is caused by write access on write tracked page, the real shadow page walking is skipped, we lost the chance to clear write flooding for the page structure current vcpu is using Fix it by locklessly waking shadow page table to clear write flooding on the shadow page structure

[PATCH v2 07/11] KVM: page track: add notifier support

2015-12-23 Thread Xiao Guangrong
Notifier list is introduced so that any node wants to receive the track event can register to the list Two APIs are introduced here: - kvm_page_track_register_notifier(): register the notifier to receive track event - kvm_page_track_unregister_notifier(): stop receiving track event by

[PATCH v2 04/11] KVM: page track: add the framework of guest page tracking

2015-12-23 Thread Xiao Guangrong
The array, gfn_track[mode][gfn], is introduced in memory slot for every guest page, this is the tracking count for the gust page on different modes. If the page is tracked then the count is increased, the page is not tracked after the count reaches zero We use 'unsigned short' as the tracking

[PATCH v2 09/11] KVM: MMU: simplify mmu_need_write_protect

2015-12-23 Thread Xiao Guangrong
Now, all non-leaf shadow page are page tracked, if gfn is not tracked there is no non-leaf shadow page of gfn is existed, we can directly make the shadow page of gfn to unsync Signed-off-by: Xiao Guangrong --- arch/x86/kvm/mmu.c | 26 -- 1

[PATCH v2 05/11] KVM: page track: introduce kvm_page_track_{add,remove}_page

2015-12-23 Thread Xiao Guangrong
These two functions are the user APIs: - kvm_page_track_add_page(): add the page to the tracking pool after that later specified access on that page will be tracked - kvm_page_track_remove_page(): remove the page from the tracking pool, the specified access on the page is not tracked after

[PATCH v2 00/11] KVM: x86: track guest page access

2015-12-23 Thread Xiao Guangrong
Changelog in v2: - fix a issue that the track memory of memslot is freed if we only move the memslot or change the flags of memslot - do not track the gfn which is not mapped in memslots - introduce the nolock APIs at the begin of the patchset - use 'unsigned short' as the track counter to

[PATCH v2 01/11] KVM: MMU: rename has_wrprotected_page to mmu_gfn_lpage_is_disallowed

2015-12-23 Thread Xiao Guangrong
kvm_lpage_info->write_count is used to detect if the large page mapping for the gfn on the specified level is allowed, rename it to disallow_lpage to reflect its purpose, also we rename has_wrprotected_page() to mmu_gfn_lpage_is_disallowed() to make the code more clearer Later we will extend this

[PATCH v2 03/11] KVM: MMU: introduce kvm_mmu_slot_gfn_write_protect

2015-12-23 Thread Xiao Guangrong
Split rmap_write_protect() and introduce the function to abstract the write protection based on the slot This function will be used in the later patch Signed-off-by: Xiao Guangrong --- arch/x86/kvm/mmu.c | 16 +++- arch/x86/kvm/mmu.h | 2 ++ 2 files

[PATCH v2 02/11] KVM: MMU: introduce kvm_mmu_gfn_{allow,disallow}_lpage

2015-12-23 Thread Xiao Guangrong
Abstract the common operations from account_shadowed() and unaccount_shadowed(), then introduce kvm_mmu_gfn_disallow_lpage() and kvm_mmu_gfn_allow_lpage() These two functions will be used by page tracking in the later patch Signed-off-by: Xiao Guangrong ---

[PATCH] vfio/iommu_type1: make use of info.flags

2015-12-23 Thread Pierre Morel
The flags entry is there to tell the user that some optional information is available. Since we report the iova_pgsizes signal it to the user by setting the flags to VFIO_IOMMU_INFO_PGSIZES. Signed-off-by: Pierre Morel --- drivers/vfio/vfio_iommu_type1.c | 2 +- 1

Re: [RFC 0/2] VFIO SRIOV support

2015-12-23 Thread Alex Williamson
On Wed, 2015-12-23 at 07:43 +, Ilya Lesokhin wrote: > Hi Alex, > Regarding driver_override, as far as I know you can only use it on > devices that were already discovered. Since the devices do not exist > before the call to pci_enable_sriov(...) > and are already probed after the call  it

[PATCH v1 1/2] kvm/x86: Hyper-V SynIC tracepoints

2015-12-23 Thread Andrey Smetanin
Trace the following Hyper SynIC events: * set msr * set sint irq * ack sint * sint irq eoi Signed-off-by: Andrey Smetanin CC: Gleb Natapov CC: Paolo Bonzini CC: Roman Kagan CC: Denis V. Lunev

[PATCH v1 2/2] kvm/x86: Hyper-V SynIC timers tracepoints

2015-12-23 Thread Andrey Smetanin
Trace the following Hyper SynIC timers events: * periodic timer start * one-shot timer start * timer callback * timer expiration and message delivery result * timer config setup * timer count setup * timer cleanup Signed-off-by: Andrey Smetanin CC: Gleb Natapov

[PATCH v1 0/2] KVM: Hyper-V SynIC tracepoints

2015-12-23 Thread Andrey Smetanin
The patches adds tracepoints inside Hyper-V SynIC and SynIC timers code. The series applies on top of 'kvm/x86: Update SynIC timers on guest entry only' previously sent. Signed-off-by: Andrey Smetanin CC: Gleb Natapov CC: Paolo Bonzini

Re: [PATCH v2 2/2] KVM: x86: Add lowest-priority support for vt-d posted-interrupts

2015-12-23 Thread Radim Krčmář
2015-12-16 09:37+0800, Feng Wu: > Use vector-hashing to deliver lowest-priority interrupts for > VT-d posted-interrupts. > > Signed-off-by: Feng Wu > --- > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c > @@ -10702,8 +10702,16 @@ static int vmx_update_pi_irte(struct kvm

Re: [PATCH v2 1/2] KVM: x86: Use vector-hashing to deliver lowest-priority interrupts

2015-12-23 Thread rkrc...@redhat.com
2015-12-23 02:12+, Wu, Feng: >> From: rkrc...@redhat.com [mailto:rkrc...@redhat.com] >> 2015-12-22 07:19+, Wu, Feng: >> >> From: Yang Zhang [mailto:yang.zhang...@gmail.com] >> >> On 2015/12/22 14:59, Wu, Feng wrote: >> >> >> From: Yang Zhang [mailto:yang.zhang...@gmail.com] >> >> >> On

Re: [PATCH v2 1/2] KVM: x86: Use vector-hashing to deliver lowest-priority interrupts

2015-12-23 Thread Radim Krčmář
2015-12-16 09:37+0800, Feng Wu: > Use vector-hashing to deliver lowest-priority interrupts, As an > example, modern Intel CPUs in server platform use this method to > handle lowest-priority interrupts. > > Signed-off-by: Feng Wu > --- > diff --git a/arch/x86/kvm/irq_comm.c

Re: [PATCH v2 2/2] KVM: x86: Add lowest-priority support for vt-d posted-interrupts

2015-12-23 Thread rkrc...@redhat.com
2015-12-22 14:42+0800, Yang Zhang: > On 2015/12/22 12:36, Wu, Feng wrote: >>>From: Yang Zhang [mailto:yang.zhang...@gmail.com] >>>On 2015/12/21 9:55, Wu, Feng wrote: >From: linux-kernel-ow...@vger.kernel.org [mailto:linux-kernel- >On 2015/12/16 9:37, Feng Wu wrote: >>diff --git

Re: [Qemu-devel] [PATCH] SeaBios: Fix reset procedure reentrancy problem on qemu-kvm platform

2015-12-23 Thread Kevin O'Connor
On Wed, Dec 23, 2015 at 06:40:12AM +, Gonglei (Arei) wrote: > > From: Kevin O'Connor [mailto:ke...@koconnor.net] > > On Tue, Dec 22, 2015 at 02:14:12AM +, Gonglei (Arei) wrote: > > > Sorry, it doesn't work. What's worse is we cannot stop SeaBIOS stuck by > > > Setting

Re: kvmclock doesn't work, help?

2015-12-23 Thread Marcelo Tosatti
On Mon, Dec 21, 2015 at 02:49:25PM -0800, Andy Lutomirski wrote: > On Fri, Dec 18, 2015 at 1:49 PM, Marcelo Tosatti wrote: > > On Fri, Dec 18, 2015 at 12:25:11PM -0800, Andy Lutomirski wrote: > >> [cc: John Stultz -- maybe you have ideas on how this should best > >> integrate

Re: kvmclock doesn't work, help?

2015-12-23 Thread Andy Lutomirski
On Wed, Dec 23, 2015 at 11:27 AM, Marcelo Tosatti wrote: > On Mon, Dec 21, 2015 at 02:49:25PM -0800, Andy Lutomirski wrote: >> On Fri, Dec 18, 2015 at 1:49 PM, Marcelo Tosatti wrote: >> > (busy spin is equally problematic as IPI for realtime guests). >>

Guest crash (with Call trace): schedule_timeout

2015-12-23 Thread Dâniel Fraga
I'm using Secure Dragon VPS (KVM) and I'm running Debian 8.1. Sometimes I get the following Call trace. Is it an issue with my installation or is it a problem with the KVM on their side? The Secure Dragon support asked me to reinstall the OS "since no other client is complaining" but

RE: [RFC 0/2] VFIO SRIOV support

2015-12-23 Thread Ilya Lesokhin
> -Original Message- > From: Alex Williamson [mailto:alex.william...@redhat.com] > Sent: Wednesday, December 23, 2015 6:28 PM > To: Ilya Lesokhin ; kvm@vger.kernel.org; linux- > p...@vger.kernel.org > Cc: bhelg...@google.com; Noa Osherovich ; Haggai