[Devel] [PATCH rh7 V2 3/5] kvm/x86: Pass return code of kvm_emulate_hypercall

2016-02-19 Thread Andrey Smetanin
appropriately. Signed-off-by: Andrey Smetanin <asmeta...@virtuozzo.com> Reviewed-by: Roman Kagan <rka...@virtuozzo.com> CC: Gleb Natapov <g...@kernel.org> CC: Paolo Bonzini <pbonz...@redhat.com> CC: Joerg Roedel <j...@8bytes.org> CC: "K. Y. Srinivasan" <k

Re: [Devel] [svt-core] [PATCH rh7 v1 3/5] ms/kvm/x86: Pass return code of kvm_emulate_hypercall

2016-02-19 Thread Andrey Smetanin
On 02/19/2016 02:25 PM, Andrey Smetanin wrote: Pass the return code from kvm_emulate_hypercall on to the caller, in order to allow it to indicate to the userspace that the hypercall has to be handled there. Also adjust all the existing code paths to return 1 to make sure the hypercall isn't

[Devel] [PATCH rh7 v1 4/5] ms/kvm/x86: Reject Hyper-V hypercall continuation

2016-02-19 Thread Andrey Smetanin
Currently we do not support Hyper-V hypercall continuation so reject it. Signed-off-by: Andrey Smetanin <asmeta...@virtuozzo.com> Reviewed-by: Roman Kagan <rka...@virtuozzo.com> CC: Gleb Natapov <g...@kernel.org> CC: Paolo Bonzini <pbonz...@redhat.com> CC: Joerg Roedel <

[Devel] [PATCH rh7 v1 0/5] KVM: Hyper-V VMBus hypercalls

2016-02-19 Thread Andrey Smetanin
lls https://jira.sw.ru/browse/PSBM-44419 Andrey Smetanin (5): ms/kvm/x86: Rename Hyper-V long spin wait hypercall ms/drivers/hv: Move VMBus hypercall codes into Hyper-V UAPI header ms/kvm/x86: Pass return code of kvm_emulate_hypercall ms/kvm/x86: Reject Hyper-V hypercall continuation ms/

[Devel] [PATCH rh7 v1 2/5] ms/drivers/hv: Move VMBus hypercall codes into Hyper-V UAPI header

2016-02-19 Thread Andrey Smetanin
VMBus hypercall codes inside Hyper-V UAPI header will be used by QEMU to implement VMBus host devices support. Signed-off-by: Andrey Smetanin <asmeta...@virtuozzo.com> Acked-by: K. Y. Srinivasan <k...@microsoft.com> Reviewed-by: Roman Kagan <rka...@virtuozzo.com> CC: Gleb Natapo

[Devel] [PATCH rh7 v1 5/5] ms/kvm/x86: Hyper-V VMBus hypercall userspace exit

2016-02-19 Thread Andrey Smetanin
off-by: Andrey Smetanin <asmeta...@virtuozzo.com> Reviewed-by: Roman Kagan <rka...@virtuozzo.com> CC: Gleb Natapov <g...@kernel.org> CC: Paolo Bonzini <pbonz...@redhat.com> CC: Joerg Roedel <j...@8bytes.org> CC: "K. Y. Srinivasan" <k...@microsoft.com> CC: Haiya

[Devel] [PATCH rh7 v1 1/5] ms/kvm/x86: Rename Hyper-V long spin wait hypercall

2016-02-19 Thread Andrey Smetanin
Rename HV_X64_HV_NOTIFY_LONG_SPIN_WAIT by HVCALL_NOTIFY_LONG_SPIN_WAIT, so the name is more consistent with the other hypercalls. Signed-off-by: Andrey Smetanin <asmeta...@virtuozzo.com> Reviewed-by: Roman Kagan <rka...@virtuozzo.com> CC: Gleb Natapov <g...@kernel.org> CC: Pa

[Devel] [PATCH rh7 v1 3/5] ms/kvm/x86: Pass return code of kvm_emulate_hypercall

2016-02-19 Thread Andrey Smetanin
appropriately. Signed-off-by: Andrey Smetanin <asmeta...@virtuozzo.com> Reviewed-by: Roman Kagan <rka...@virtuozzo.com> CC: Gleb Natapov <g...@kernel.org> CC: Paolo Bonzini <pbonz...@redhat.com> CC: Joerg Roedel <j...@8bytes.org> CC: "K. Y. Srinivasan" <k

Re: [Devel] [PATCH rh7 v1 05/36] kvm/x86: Use is_64_bit_mode() helper

2016-02-16 Thread Andrey Smetanin
Use is_64_bit_mode() helper' -- Best regards, Konstantin Khorenko, Virtuozzo Linux Kernel Team On 02/10/2016 06:17 PM, Andrey Smetanin wrote: Signed-off-by: Andrey Smetanin <asmeta...@virtuozzo.com> --- arch/x86/kvm/hyperv.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) d

Re: [Devel] [PATCH rh7 v1 02/36] kvm/x86: Vcpu based page access routines usage

2016-02-16 Thread Andrey Smetanin
o, Virtuozzo Linux Kernel Team On 02/10/2016 06:17 PM, Andrey Smetanin wrote: Signed-off-by: Andrey Smetanin <asmeta...@virtuozzo.com> --- arch/x86/kvm/hyperv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c index

[Devel] [PATCH rh7 v1 06/36] ms/kvm/x86: Hyper-V HV_X64_MSR_RESET msr

2016-02-10 Thread Andrey Smetanin
HV_X64_MSR_RESET msr is used by Hyper-V based Windows guest to reset guest VM by hypervisor. Necessary to support loading of winhv.sys in guest, which in turn is required to support Windows VMBus. ms commit e516cebb4f2b2057a5a421fea589079502acfff6. Signed-off-by: Andrey Smetanin <asm

[Devel] [PATCH rh7 v1 08/36] ms/kvm/x86: Hyper-V HV_X64_MSR_VP_RUNTIME support

2016-02-10 Thread Andrey Smetanin
vcpu task. Necessary to support loading of winhv.sys in guest, which in turn is required to support Windows VMBus. ms commit 9eec50b8bbe1535c440a1ee88c1958f78fc55957. Signed-off-by: Andrey Smetanin <asmeta...@virtuozzo.com> Reviewed-by: Roman Kagan <rka...@virtuozzo.com> Signed-off

[Devel] [PATCH rh7 v1 20/36] ms/drivers/hv: Move struct hv_message into UAPI Hyper-V x86 header

2016-02-10 Thread Andrey Smetanin
This struct is required for Hyper-V SynIC timers implementation inside KVM and for upcoming Hyper-V VMBus support by userspace(QEMU). So place it into Hyper-V UAPI header. ms commit - 5b423efe11e822e092e8c911a6bad17eadf718eb. Signed-off-by: Andrey Smetanin <asmeta...@virtuozzo.com> Acked

[Devel] [PATCH rh7 v1 17/36] ms/kvm/x86: Hyper-V kvm exit

2016-02-10 Thread Andrey Smetanin
: * added KVM_EXIT_HYPERV types and structs notes into docs Signed-off-by: Andrey Smetanin <asmeta...@virtuozzo.com> Reviewed-by: Roman Kagan <rka...@virtuozzo.com> Signed-off-by: Denis V. Lunev <d...@openvz.org> CC: Gleb Natapov <g...@kernel.org> CC: Paolo Bonzini <pbonz...@

[Devel] [PATCH rh7 v1 05/36] kvm/x86: Use is_64_bit_mode() helper

2016-02-10 Thread Andrey Smetanin
Signed-off-by: Andrey Smetanin <asmeta...@virtuozzo.com> --- arch/x86/kvm/hyperv.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c index 8102d69..a8160d2 100644 --- a/arch/x86/kvm/hyperv.c +++ b/arch/x86/kvm/hyperv.c @@

[Devel] [PATCH rh7 v1 09/36] ms/kvm/eventfd: avoid loop inside irqfd_update()

2016-02-10 Thread Andrey Smetanin
The loop(for) inside irqfd_update() is unnecessary because any other value for irq_entry.type will just trigger schedule_work(>inject) in irqfd_wakeup. ms commit 351dc6477cd35136ce4668401b1b1332a62908a8. Signed-off-by: Andrey Smetanin <asmeta...@virtuozzo.com> Reviewed-by: Roman K

[Devel] [PATCH rh7 v1 01/36] kvm/x86: Coding style fixes

2016-02-10 Thread Andrey Smetanin
Signed-off-by: Andrey Smetanin <asmeta...@virtuozzo.com> --- arch/x86/kvm/hyperv.c | 14 +++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c index 625223b..5828875 100644 --- a/arch/x86/kvm/hyperv.c +++ b/arch/x

[Devel] [PATCH rh7 v1 21/36] ms/drivers/hv: Move struct hv_timer_message_payload into UAPI Hyper-V x86 header

2016-02-10 Thread Andrey Smetanin
This struct is required for Hyper-V SynIC timers implementation inside KVM and for upcoming Hyper-V VMBus support by userspace(QEMU). So place it into Hyper-V UAPI header. ms commit - c71acc4c74dddeeede69fdd4f0b1a124f9df. Signed-off-by: Andrey Smetanin <asmeta...@virtuozzo.com> CC

[Devel] [PATCH rh7 v1 16/36] ms/kvm/x86: Hyper-V synthetic interrupt controller

2016-02-10 Thread Andrey Smetanin
PERV_SYNIC and KVM_IRQ_ROUTING_HV_SINT notes into docs Changes v2: * do not use posted interrupts for Hyper-V SynIC AutoEOI vectors * add Hyper-V SynIC vectors into EOI exit bitmap * Hyper-V SyniIC SINT msr write logic simplified Signed-off-by: Andrey Smetanin <asmeta...@virtuozzo.com> Reviewed-by: Roman Kagan <r

[Devel] [PATCH rh7 v1 19/36] ms/drivers/hv: Move HV_SYNIC_STIMER_COUNT into Hyper-V UAPI x86 header

2016-02-10 Thread Andrey Smetanin
This constant is required for Hyper-V SynIC timers MSR's support by userspace(QEMU). ms commit - 4f39bcfd1c132522380138a323f9af7902766301. Signed-off-by: Andrey Smetanin <asmeta...@virtuozzo.com> Acked-by: K. Y. Srinivasan <k...@microsoft.com> Reviewed-by: Roman Kagan <rka...@vi

[Devel] [PATCH rh7 v1 12/36] ms/kvm/irqchip: allow only multiple irqchip routes per GSI

2016-02-10 Thread Andrey Smetanin
Any other irq routing types (MSI, S390_ADAPTER, upcoming Hyper-V SynIC) map one-to-one to GSI. ms commit f33143d80907602deb1b96db42da93507ed03b31. Signed-off-by: Andrey Smetanin <asmeta...@virtuozzo.com> Reviewed-by: Roman Kagan <rka...@virtuozzo.com> Signed-off-by: Denis

[Devel] [PATCH rh7 v1 03/36] kvm/x86: get(set)_msr_hyperv() -> kvm_hv_get(set)_msr() rename

2016-02-10 Thread Andrey Smetanin
Signed-off-by: Andrey Smetanin <asmeta...@virtuozzo.com> --- arch/x86/kvm/hyperv.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c index 32d8d00..1467ba1 100644 --- a/arch/x86/kvm/hyperv.c +++ b/arch/x

[Devel] [PATCH rh7 v1 13/36] ms/drivers/hv: share Hyper-V SynIC constants with userspace

2016-02-10 Thread Andrey Smetanin
Moved Hyper-V synic contants from guest Hyper-V drivers private header into x86 arch uapi Hyper-V header. Added Hyper-V synic msr's flags into x86 arch uapi Hyper-V header. ms commit c75efa974e013640496620f26f0b532cb5cb17f9. Signed-off-by: Andrey Smetanin <asmeta...@virtuozzo.com> Re

[Devel] [PATCH rh7 v1 15/36] ms/kvm/x86: per-vcpu apicv deactivation support

2016-02-10 Thread Andrey Smetanin
on the module parameter and CPU capability, and consulted whenever an APICv-specific action is performed. ms commit - d62caabb41f33d96333f9ef15e09cd26e1c12760. Signed-off-by: Andrey Smetanin <asmeta...@virtuozzo.com> Reviewed-by: Roman Kagan <rka...@virtuozzo.com> Signed-off-by: Denis

[Devel] [PATCH rh7 v1 30/36] ms/kvm/x86: Hyper-V unify stimer_start() and stimer_restart()

2016-02-10 Thread Andrey Smetanin
This will be used in future to start Hyper-V SynIC timer in several places by one logic in one function. ms commit - f808495da56f28e94c6448125158f1175009fcfc. Changes v2: * drop stimer->count == 0 check inside stimer_start() * comment stimer_start() assumptions Signed-off-by: Andrey Smeta

[Devel] [PATCH rh7 v1 11/36] ms/kvm/eventfd: add arch-specific set_irq

2016-02-10 Thread Andrey Smetanin
c9a5eccac1abf50649949f15754a7635f263a1ff. Signed-off-by: Andrey Smetanin <asmeta...@virtuozzo.com> Reviewed-by: Roman Kagan <rka...@virtuozzo.com> Signed-off-by: Denis V. Lunev <d...@openvz.org> CC: Vitaly Kuznetsov <vkuzn...@redhat.com> CC: "K. Y. Srinivasan" <k...@microsoft.com> CC:

[Devel] [PATCH rh7 v1 29/36] ms/kvm/x86: Drop stimer_stop() function

2016-02-10 Thread Andrey Smetanin
The function stimer_stop() is called in one place so remove the function and replace it's call by function content. ms commit - 019b9781ccd667d4160f3636c8735e3baa08. Signed-off-by: Andrey Smetanin <asmeta...@virtuozzo.com> Reviewed-by: Roman Kagan <rka...@virtuozzo.com> CC: Gle

[Devel] [PATCH rh7 v1 33/36] ms/kvm/x86: Skip SynIC vector check for QEMU side

2016-02-10 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. ms commit - 7be58a6488a9d36886d9423a1ed54fe104c7b182. Signed-off-by: Andrey Smetanin <asmeta...@virtuozzo.com> Reviewed-by: Roman Kagan <rka...@virtuozzo.com> CC: Gle

[Devel] [PATCH rh7 v1 32/36] ms/kvm/x86: Hyper-V fix SynIC timer disabling condition

2016-02-10 Thread Andrey Smetanin
3.1): "It is not permitted to set the SINTx field to zero for an enabled timer. If attempted, the timer will be marked disabled (that is, bit 0 cleared) immediately." ms commit - 23a3b201fd187f1e7af573b3794c3c5ebf7d2c06. Signed-off-by: Andrey Smetanin <asmeta...@virtuozzo.com> Revie

[Devel] [PATCH rh7 v1 10/36] ms/kvm/eventfd: factor out kvm_notify_acked_gsi()

2016-02-10 Thread Andrey Smetanin
Factor out kvm_notify_acked_gsi() helper to iterate over EOI listeners and notify those matching the given gsi. It will be reused in the upcoming Hyper-V SynIC implementation. ms commit ba1aefcd6db5536d3eb3ca3ce7bd6786960140ea. Signed-off-by: Andrey Smetanin <asmeta...@virtuozzo.com> Re

[Devel] [PATCH rh7 v1 27/36] ms/kvm/x86: Remove Hyper-V SynIC timer stopping

2016-02-10 Thread Andrey Smetanin
e timer then never fires. The patch fixes such situation by not stopping Hyper-V SynIC timer at all, because it's safe to restart it without stop in vcpu context and timer callback always returns HRTIMER_NORESTART. ms commit - 481d2bcc8454a44811db2bb68ac216fc6c5a23db. Signed-off-by: Andre

[Devel] [PATCH rh7 v1 25/36] ms/kvm/x86: Hyper-V SynIC message slot pending clearing at SINT ack

2016-02-10 Thread Andrey Smetanin
. Signed-off-by: Andrey Smetanin <asmeta...@virtuozzo.com> Reviewed-by: Roman Kagan <rka...@virtuozzo.com> CC: Gleb Natapov <g...@kernel.org> CC: Paolo Bonzini <pbonz...@redhat.com> CC: "K. Y. Srinivasan" <k...@microsoft.com> CC: Haiyang Zhang <haiya...

[Devel] [PATCH rh7 v1 23/36] ms/kvm/x86: Added Hyper-V vcpu_to_hv_vcpu()/hv_vcpu_to_vcpu() helpers

2016-02-10 Thread Andrey Smetanin
ms commit - 0ae80384b257b0a1ffa4e5d9eab2eb559bb063c5. Signed-off-by: Andrey Smetanin <asmeta...@virtuozzo.com> Reviewed-by: Roman Kagan <rka...@virtuozzo.com> CC: Gleb Natapov <g...@kernel.org> CC: Paolo Bonzini <pbonz...@redhat.com> CC: "K. Y. Srinivasan" <

[Devel] [PATCH rh7 v1 35/36] ms/kvm/x86: Hyper-V SynIC tracepoints

2016-02-10 Thread Andrey Smetanin
Trace the following Hyper SynIC events: * set msr * set sint irq * ack sint * sint irq eoi ms commit - 18659a9cb1885d00dd428f8857f7f628e54a45ee. Signed-off-by: Andrey Smetanin <asmeta...@virtuozzo.com> CC: Gleb Natapov <g...@kernel.org> CC: Paolo Bonzini <pbonz...@redhat.com&g

[Devel] [PATCH rh7 v1 36/36] ms/kvm/x86: Hyper-V SynIC timers tracepoints

2016-02-10 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 ms commit - ac3e5fcae8ca658e7dcc3fdcd50af7e4779f58c1. Signed-off-by: Andrey

[Devel] [PATCH rh7 v1 18/36] ms/drivers/hv: replace enum hv_message_type by u32

2016-02-10 Thread Andrey Smetanin
enum hv_message_type inside struct hv_message, hv_post_message is not size portable. Replace enum by u32. ms commit - 7797dcf63f11b6e1d34822daf2317223d0f4ad46. Signed-off-by: Andrey Smetanin <asmeta...@virtuozzo.com> CC: Gleb Natapov <g...@kernel.org> CC: Paolo Bonzini <pbonz...

[Devel] [PATCH rh7 v1 31/36] ms/kvm/x86: Reorg stimer_expiration() to better control timer restart

2016-02-10 Thread Andrey Smetanin
. Signed-off-by: Andrey Smetanin <asmeta...@virtuozzo.com> Reviewed-by: Roman Kagan <rka...@virtuozzo.com> CC: Gleb Natapov <g...@kernel.org> CC: Paolo Bonzini <pbonz...@redhat.com> CC: Roman Kagan <rka...@virtuozzo.com> CC: Denis V. Lunev <d...@openvz.org> CC: qemu-d

[Devel] [PATCH rh7 v1 26/36] ms/kvm/x86: Hyper-V SynIC timers

2016-02-10 Thread Andrey Smetanin
d is shortened until the timer catches up) will be implemented later. ms commit - 1f4b34f825e8cef6f493d06b46605384785b3d16. Changes v2: * Use remainder to calculate periodic timer expiration time Signed-off-by: Andrey Smetanin <asmeta...@virtuozzo.com> Reviewed-by: Roman Kagan <rka...@virtu

[Devel] [PATCH rh7 v1 24/36] ms/kvm/x86: Hyper-V internal helper to read MSR HV_X64_MSR_TIME_REF_COUNT

2016-02-10 Thread Andrey Smetanin
This helper will be used also in Hyper-V SynIC timers implementation. ms commit - 93bf4172481c4b2a8544c83a687946252563edd0. Signed-off-by: Andrey Smetanin <asmeta...@virtuozzo.com> Reviewed-by: Roman Kagan <rka...@virtuozzo.com> CC: Gleb Natapov <g...@kernel.org> CC: Pa

[Devel] [PATCH rh7 v1 07/36] ms/kvm/x86: Hyper-V HV_X64_MSR_VP_INDEX export for QEMU.

2016-02-10 Thread Andrey Smetanin
commit 11c4b1ca719eaaa5ca6fe0e80bb009f3f2012fd2. Signed-off-by: Andrey Smetanin <asmeta...@virtuozzo.com> Reviewed-by: Roman Kagan <rka...@virtuozzo.com> Signed-off-by: Denis V. Lunev <d...@openvz.org> CC: Paolo Bonzini <pbonz...@redhat.com> CC: Gleb Natapov <g...@kerne

[Devel] [PATCH rh7 v1 04/36] kvm/x86: Align logging messages to MS one

2016-02-10 Thread Andrey Smetanin
Signed-off-by: Andrey Smetanin <asmeta...@virtuozzo.com> --- arch/x86/kvm/hyperv.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c index 1467ba1..8102d69 100644 --- a/arch/x86/kvm/hyperv.c +++ b/arch/x86/kvm/hy

[Devel] [PATCH rh7 v1 22/36] ms/kvm/x86: Rearrange func's declarations inside Hyper-V header

2016-02-10 Thread Andrey Smetanin
This rearrangement places functions declarations together according to their functionality, so future additions will be simplier. ms commit - e18eaeed2b056094a5626288d47ceefc740c90e5. Signed-off-by: Andrey Smetanin <asmeta...@virtuozzo.com> Reviewed-by: Roman Kagan <rka...@virtuozz

[Devel] [PATCH rh7 v1 34/36] ms/kvm/x86: Update SynIC timers on guest entry only

2016-02-10 Thread Andrey Smetanin
to be processed after KVM_REQ_CLOCK_UPDATE). ms commit - f3b138c5d89a1f74a2b46adaa1067aea9a7e3cbb. Signed-off-by: Andrey Smetanin <asmeta...@virtuozzo.com> Reviewed-by: Roman Kagan <rka...@virtuozzo.com> CC: Gleb Natapov <g...@kernel.org> CC: Paolo Bonzini <pbonz...@redhat.com&

[Devel] [PATCH rh7 v1 02/36] kvm/x86: Vcpu based page access routines usage

2016-02-10 Thread Andrey Smetanin
Signed-off-by: Andrey Smetanin <asmeta...@virtuozzo.com> --- arch/x86/kvm/hyperv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/hyperv.c b/arch/x86/kvm/hyperv.c index 5828875..32d8d00 100644 --- a/arch/x86/kvm/hyperv.c +++ b/arch/x86/kvm/hyperv.c @@ -

[Devel] [PATCH rh7 v1 00/36] Hyper-V SynIC support

2016-02-10 Thread Andrey Smetanin
patches contains: * Hyper-V RESET, VP_INDEX, VP_RUNTIME msr's support * Hyper-V synthetic interrupt controller(SynIC) * Hyper-V SynIC timers https://jira.sw.ru/browse/PSBM-32435 Andrey Smetanin (36): kvm/x86: Coding style fixes kvm/x86: Vcpu based page access routines usage kvm/x86: get

[Devel] [PATCH rh7 4/7] ms/kvm/x86: Move Hyper-V specific fields into new per vm/vcpu Hyper-V structures

2015-09-29 Thread Andrey Smetanin
ms commit - e83d58874ba1de74c13d3c6b05f95a023c860d25 Signed-off-by: Andrey Smetanin <asmeta...@virtuozzo.com> Signed-off-by: Denis V. Lunev <d...@openvz.org> Reviewed-by: Peter Hornyack <peterhorny...@google.com> CC: Paolo Bonzini <pbonz...@redhat.com> CC: Gleb Natapov

[Devel] [PATCH rh7 6/7] ms/KVM: Add KVM_EXIT_SYSTEM_EVENT to user space API header

2015-09-29 Thread Andrey Smetanin
From: Anup Patel Currently, we don't have an exit reason to notify user space about a system-level event (for e.g. system reset or shutdown) triggered by the VCPU. This patch adds exit reason KVM_EXIT_SYSTEM_EVENT for this purpose. We can also inform user space about the

[Devel] [PATCH rh7 5/7] ms/kvm/x86: added hyper-v crash msrs into kvm hyperv context

2015-09-29 Thread Andrey Smetanin
Added kvm Hyper-V context hv crash variables as storage of Hyper-V crash msrs. ms commit - e7d9513b60e87f62e41090fa3a26eca796924346 Signed-off-by: Andrey Smetanin <asmeta...@virtuozzo.com> Signed-off-by: Denis V. Lunev <d...@openvz.org> Reviewed-by: Peter Hornyack <peterhorny...

[Devel] [PATCH rh7 1/7] ms/kvm: add hyper-v crash msrs values

2015-09-29 Thread Andrey Smetanin
Added Hyper-V crash msrs values - HV_X64_MSR_CRASH*. ms commit - a88464a8b0ffb2f8dfb69d3ab982169578b50f22 Signed-off-by: Andrey Smetanin <asmeta...@virtuozzo.com> Signed-off-by: Denis V. Lunev <d...@openvz.org> Reviewed-by: Peter Hornyack <peterhorny...@google.com> CC: Pa

[Devel] [PATCH rh7 7/7] ms/kvm/x86: add sending hyper-v crash notification to user space

2015-09-29 Thread Andrey Smetanin
Signed-off-by: Andrey Smetanin <asmeta...@virtuozzo.com> Signed-off-by: Denis V. Lunev <d...@openvz.org> Reviewed-by: Peter Hornyack <peterhorny...@google.com> CC: Paolo Bonzini <pbonz...@redhat.com> CC: Gleb Natapov <g...@kernel.org> Signed-off-by: Paol

[Devel] [PATCH rh7 0/7] Hyper-V pvpanic equivalent

2015-09-29 Thread Andrey Smetanin
is to provide functionality equal to pvpanic device without QEMU guest agent for Windows. The idea is borrowed from Linux HyperV bus driver and validated against Windows 2k12. Andrey Smetanin (6): kvm: add hyper-v crash msrs values kvm/x86: move Hyper-V MSR's/hypercall code into hyperv.c file kvm

[Devel] [PATCH rh7 3/7] ms/kvm: introduce vcpu_debug = kvm_debug + vcpu context

2015-09-29 Thread Andrey Smetanin
vcpu_debug is useful macro like kvm_debug but additionally includes vcpu context inside output. ms commit - ee86dbc6e327062396748162b95309388c19faab Signed-off-by: Andrey Smetanin <asmeta...@virtuozzo.com> Signed-off-by: Denis V. Lunev <d...@openvz.org> Reviewed-by: Peter Hornyack

[Devel] [PATCH rh7 2/7] ms/kvm/x86: move Hyper-V MSR's/hypercall code into hyperv.c file

2015-09-29 Thread Andrey Smetanin
x86.c to hyperv.c. ms commit - e83d58874ba1de74c13d3c6b05f95a023c860d25 Signed-off-by: Andrey Smetanin <asmeta...@virtuozzo.com> Signed-off-by: Denis V. Lunev <d...@openvz.org> Reviewed-by: Peter Hornyack <peterhorny...@google.com> CC: Paolo Bonzini <pbonz...@redhat.com

[Devel] [PATCH rh7] ploop: added into pvd header new close signatures

2015-06-02 Thread Andrey Smetanin
pvd header m_DiskInUse field extended to store additinal SIGNATURE_DISK_CLOSED_V21 value(will be used by backup software). Disk in use checks replaced by pvd_header_is_disk_in_use(). https://jira.sw.ru/browse/PSBM-33882 Signed-off-by: Andrey Smetanin asmeta...@virtuozzo.com --- drivers/block

[Devel] [PATCH rh7 1/2] ploop: add a separate queue for discard bio-s (v2)

2015-05-21 Thread Andrey Smetanin
When I created support of discard requests, process_bio_queue is called from ploop_thread. So I use ploop_quiesceploop_relax for synchronization. Now it is called from ploop_make_request too, so my synchronization doesn't work any more. The race was added by

[Devel] [PATCH rh7 2/2] ploop: fix busyloop on secondary discard bio

2015-05-21 Thread Andrey Smetanin
After diff-ploop-add-a-separate-queue-for-discard-bio-s, ploop_thread() skips processing previously queued discard bio-s if any discard bio is already under processing (fbd-fbd_dbl is not empty). ploop_wait() must take care about such a case, otherwise a busyloop may happen: ploop_thread()

[Devel] [PATCH rh7 01/38] ploop: fix accounting ploop_io_images_size

2015-05-19 Thread Andrey Smetanin
ploop_io_images_size is a global counter supposed to be total sum of io-size for all io structs. However, actual size of image can be used by userspace. E.g. when userspace grows lower delta for merge operartion. This means that by the time ploop_dio_close() is called, actual size may differ

[Devel] [PATCH rh7 05/38] ploop: prevent disclosure 4 bytes of the stack kernel

2015-05-19 Thread Andrey Smetanin
Memory leak (4 bytes) in the ploop_getdevice_ioc function. 217401 +static int ploop_getdevice_ioc(unsigned long arg) 217402 +{ 217403 + int err; 217404 + int index = 0; 217405 + struct rb_node *n; 217406 +

[Devel] [PATCH rh7 07/38] ploop: rework accounting images_size

2015-05-19 Thread Andrey Smetanin
The way how we kept ploop_io_images_size up-to-date (should be always equal to total number of bytes of all loaded image files) was very prone to errors: first delta loaded kept actual io-size, then backup delta was initialized with io-size=0; since then, if first delta was unloaded before the

[Devel] [PATCH rh7 09/38] ploop: fix sync delay for sync requests

2015-05-19 Thread Andrey Smetanin
In case of sync requests coming through allocate-new-block path, it is incorrect to delay wakeup of fsync-thread. Sync request should always be processed as soon as possible. https://jira.sw.ru/browse/PSBM-22381 Signed-off-by: Maxim Patlasov mpatla...@parallels.com ---

[Devel] [PATCH rh7 11/38] ploop: skip writes of zeroes to unallocated blocks by default

2015-05-19 Thread Andrey Smetanin
Reading from unallocated blocks returns zeroes = we can safely skip writes of zeroes to unallocated blocks. As a lot of tests do dd if=/dev/zero ..., this optimization is valuable. Feature enabled, test results: [root@p2 ~]# echo 1 /sys/block/ploop37803/ptune/check_zeros [root@p2 ~]# dd

[Devel] [PATCH rh7 13/38] ploop: fix a race condition on relocation of blocks

2015-05-19 Thread Andrey Smetanin
map_release() are not atomic, because it calls atomic_read and atomic_dec_and_test. Looks like it was designed to be called under plo-lock. https://jira.sw.ru/browse/PSBM-23905 Signed-off-by: Andrey Vagin ava...@openvz.org Acked-by: Maxim Patlasov mpatla...@parallels.com ---

[Devel] [PATCH rh7 17/38] ploop: add ioctl to limit size of top delta (v2)

2015-05-19 Thread Andrey Smetanin
customer created an online backup = backup.tib file. Most probably the .tib file is inconsistent and in order to correctly access data inside we need to replay the journal. = We have to provide to container a bundle of .tib file (read-only) and a tiny read-writeable ploop delta - journal

[Devel] [PATCH rh7 22/38] ploop: put top-delta back if merge failed

2015-05-19 Thread Andrey Smetanin
Before merge, we move top-delta to a temporary plo-trans_map list. Since then, it's not present in the main plo-map list anymore. If merge failed, we must put it back to plo-map. Otherwise the delta will be lost forever (visible in /sys/block/ploop*/pdelta/*, but not accessible from ploop).

[Devel] [PATCH rh7 25/38] ploop: make manual abort transition verbose

2015-05-19 Thread Andrey Smetanin
Signed-off-by: Dmitry Monakhov dmonak...@openvz.org --- drivers/block/ploop/sysfs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/block/ploop/sysfs.c b/drivers/block/ploop/sysfs.c index 3ef53ac..07a4829 100644 --- a/drivers/block/ploop/sysfs.c +++ b/drivers/block/ploop/sysfs.c @@

[Devel] [PATCH rh7 26/38] ploop: warning on disk full condition

2015-05-19 Thread Andrey Smetanin
People complain that it's not always obvious why an app in CT gets -ENOSPC while there remains some space on host filesystem. The patch adds time ratelimited printk about disk full condition. Maximal rate is 1 per hour. https://bugzilla.openvz.org/show_bug.cgi?id=3045 Signed-off-by: Maxim

[Devel] [PATCH rh7 27/38] ploop: add a separate queue for discard bio-s (v2)

2015-05-19 Thread Andrey Smetanin
When I created support of discard requests, process_bio_queue is called from ploop_thread. So I use ploop_quiesceploop_relax for synchronization. Now it is called from ploop_make_request too, so my synchronization doesn't work any more. The race was added by

[Devel] [PATCH rh7 30/38] ploop: added ploop_req_delay_fua_possible() func that detects possible delaying of upcoming FUA to index update stage

2015-05-19 Thread Andrey Smetanin
previously written(without FUA) data. Performance: Overall(includes EXT4 resize upto 16T) resize performance degradated by -5% of time. https://jira.sw.ru/browse/PSBM-31222 https://jira.sw.ru/browse/PSBM-31225 https://jira.sw.ru/browse/PSBM-31321 Signed-off-by: Andrey Smetanin asmeta

[Devel] [PATCH rh7 31/38] ploop: define struct ploop_request-state flags to force pre FLUSH before write IO and FUA/fsync at I/O complete

2015-05-19 Thread Andrey Smetanin
to mark req to FLUSH previously written(without FUA) data. Performance: Overall(includes EXT4 resize upto 16T) resize performance degradated by -5% of time. https://jira.sw.ru/browse/PSBM-31222 https://jira.sw.ru/browse/PSBM-31225 https://jira.sw.ru/browse/PSBM-31321 Signed-off-by: Andrey Smetanin

[Devel] [PATCH rh7 33/38] ploop: do preflush or postfua according force FUA/flush flags, and delay FUA if possible but add force FLUSH to req if so

2015-05-19 Thread Andrey Smetanin
to mark req to FLUSH previously written(without FUA) data. Performance: Overall(includes EXT4 resize upto 16T) resize performance degradated by -5% of time. https://jira.sw.ru/browse/PSBM-31222 https://jira.sw.ru/browse/PSBM-31225 https://jira.sw.ru/browse/PSBM-31321 Signed-off-by: Andrey Smetanin

[Devel] [PATCH rh7 37/38] ploop: force FUA of nullified blocks for BAT grow

2015-05-19 Thread Andrey Smetanin
of nullified blocks. This patch does it by marking preq via PLOOP_REQ_FORCE_FUA flag. https://jira.sw.ru/browse/PSBM-31969 Signed-off-by: Andrey Smetanin asmeta...@parallels.com Acked-by: Andrew Vagin ava...@parallels.com --- drivers/block/ploop/map.c | 10 +++--- 1 file changed, 7 insertions

[Devel] [PATCH rh7 04/38] ploop: prevent dangerous ploop-umount

2015-05-19 Thread Andrey Smetanin
Umounting ploop device if inner fs is still mounted on it leads to numerous complains in kernel logs like: VFS: Busy inodes after unmount. sb = 880108987000, fs type = ext4, sb count = 2, sb-s_root = / and is not what user expected. The patch adds some protection from dummy userspace

[Devel] [PATCH rh7 06/38] ploop: report holes in pio_direct (v2)

2015-05-19 Thread Andrey Smetanin
We have not implemented the support of sparce files yet. Let's at least print a message more descriptive than common: [ 3460.838071] ploop_set_error=-22 on ploop44006 Changed in v2: - used ploop_msg_once for reporting partially uninitialized extent https://jira.sw.ru/browse/PSBM-20770

[Devel] [PATCH rh7 08/38] ploop: fix iblk-to-sector calculations

2015-05-19 Thread Andrey Smetanin
iblk stands for image-file block number. Its size is the same as u32. The size of 'sector' is the same as long. While converting the former to the latter like this: sec = iblk shift, we must always cast 'iblk' to long. And we actually do in most cases. The patch fixes a place in io_direct module

[Devel] [PATCH rh7 12/38] ploop: support 4K block-size of host block-device

2015-05-19 Thread Andrey Smetanin
Avoid 512-bytes reads/writes. They were used by 'expanded' format module to get and save format header. Let's use 4K reads/writes instead. Customer's problem: [root@pcstest10 ~]# ploop mount /vz3/test.hdd add delta dev=/dev/ploop19025 img=/vz3/test.hdd (rw) Can't add image /vz3/test.hdd:

[Devel] [PATCH rh7 16/38] ploop: prioritize BAT operations

2015-05-19 Thread Andrey Smetanin
Ploop uses -read_page and -write_page methods of pio_direct to read/write index table. These operations are rare and usually someone is blocked on them. Let's give them a priority by setting SYNCIO flag. Signed-off-by: Maxim Patlasov mpatla...@parallels.com --- drivers/block/ploop/io_direct.c |

[Devel] [PATCH rh7 20/38] ploop: expose open_count to sysfs

2015-05-19 Thread Andrey Smetanin
The patch shows number of opened instances of ploop-device (plo-open_count) in /sys/block/ploopN/pstate/open_count. This will allow userspace to decide whether a ploop-device is used by someone (e.g. backup) by scanning the open_count for all ploop-devices. https://jira.sw.ru/browse/PSBM-24754

[Devel] [PATCH rh7 32/38] ploop: direct: to support truly FLUSH/FUA of req we need mark first bio FLUSH, write all bios and mark last bio as FLUSH/FUA

2015-05-19 Thread Andrey Smetanin
to mark req to FLUSH previously written(without FUA) data. Performance: Overall(includes EXT4 resize upto 16T) resize performance degradated by -5% of time. https://jira.sw.ru/browse/PSBM-31222 https://jira.sw.ru/browse/PSBM-31225 https://jira.sw.ru/browse/PSBM-31321 Signed-off-by: Andrey Smetanin

[Devel] [PATCH rh7 34/38] ploop: make image fsync at I/O complete if it's required by FUA/fsync force flag or by req-req_rw

2015-05-19 Thread Andrey Smetanin
to mark req to FLUSH previously written(without FUA) data. Performance: Overall(includes EXT4 resize upto 16T) resize performance degradated by -5% of time. https://jira.sw.ru/browse/PSBM-31222 https://jira.sw.ru/browse/PSBM-31225 https://jira.sw.ru/browse/PSBM-31321 Signed-off-by: Andrey Smetanin

[Devel] [PATCH rh7 36/38] ploop: mark reloc reqs to force FUA/fsync(kaio) for index update I/O

2015-05-19 Thread Andrey Smetanin
to mark req to FLUSH previously written(without FUA) data. Performance: Overall(includes EXT4 resize upto 16T) resize performance degradated by -5% of time. https://jira.sw.ru/browse/PSBM-31222 https://jira.sw.ru/browse/PSBM-31225 https://jira.sw.ru/browse/PSBM-31321 Signed-off-by: Andrey Smetanin

[Devel] [PATCH rh7 02/38] ploop: fix dio_fsync wait

2015-05-19 Thread Andrey Smetanin
we MUST wait for writeback to finish before file-f_op-fsync. https://jira.sw.ru/browse/PSBM-18049 Signed-off-by: Dmitry Monakhov dmonak...@openvz.org Acked-by: Maxim V. Patlasov mpatla...@parallels.com --- drivers/block/ploop/io_direct.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-)

[Devel] [PATCH rh7 03/38] ploop: check new size of block device on ioctl(GROW)

2015-05-19 Thread Andrey Smetanin
Return error if userspace attepmts to grow block device above limits imposed by ploop1 formats. https://jira.sw.ru/browse/PSBM-21027 Signed-off-by: Maxim Patlasov mpatla...@parallels.com --- drivers/block/ploop/fmt_ploop1.c | 4 drivers/block/ploop/ploop1_image.h | 13 + 2

[Devel] [PATCH rh7 15/38] ploop: fix race in ploop_tracker_init()

2015-05-19 Thread Andrey Smetanin
ploop_tracker_init() may acquire current alloc_head only after quiescing ploop. Otherwise a race is possible: 1) we acuire an alloc_head: e.end = (u64)ploop_top_delta(plo)-io.alloc_head (plo-cluster_log + 9); 2) then the alloc_head is advanced due to submit_alloc writes 3) we turn write

[Devel] [PATCH rh7 18/38] ploop: bug on bad fiemap (v2)

2015-05-19 Thread Andrey Smetanin
Based on crash analysis, one of extents from ploop em-tree is bad: 883fe6230ae0 start = 19380224 end = 19447808 block_start = 0 refs = { counter = 1 } ploop never calculates em-block_start other than by direct assigning: em-block_start = fi_extent.fe_physical 9; The patch

[Devel] [PATCH rh7 21/38] ploop: fix spurious hole complains

2015-05-19 Thread Andrey Smetanin
Spurious complains were triggered by fiemap-ahead logic of pio_direct module. Fix it by suppressing complains if fiemap behind EOF failed. Also print more details about a hole. Signed-off-by: Maxim Patlasov mpatla...@parallels.com Acked-by: Andrew Vagin ava...@parallels.com ---

[Devel] [PATCH rh7 23/38] ploop: roll back alloc_head on ENOSPC

2015-05-19 Thread Andrey Smetanin
The first thing dio_submit_alloc() does is incrementing io-alloc_head. In case of errors it doesn't roll back io-alloc_head becuase ploop will go to aborted state anyway and any write requests will fail immediately. But there is one exception: in case of ENOSPC, dio_submit_alloc() must decrement

[Devel] [PATCH rh7 24/38] ploop: zero blocks on reuse

2015-05-19 Thread Andrey Smetanin
There is a check_zero feature allowing to skip zero writes if image-block is not allocated yet for given preq-req_cluster. But this means that inner-fs will hope to read zero from that range afterwards. Hence, while allocating the image-block we *must* zero it. We always do so in submit_alloc, but

[Devel] [PATCH rh7 28/38] ploop: notify blktrace about bio completions

2015-05-19 Thread Andrey Smetanin
Signed-off-by: Andrey Smetanin asmeta...@virtuozzo.com --- drivers/block/ploop/dev.c | 14 -- drivers/block/ploop/freeblks.c | 4 +++- include/linux/ploop/compat.h | 6 +- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/drivers/block/ploop/dev.c b/drivers

[Devel] [PATCH rh7 29/38] ploop: fix busyloop on secondary discard bio

2015-05-19 Thread Andrey Smetanin
After diff-ploop-add-a-separate-queue-for-discard-bio-s, ploop_thread() skips processing previously queued discard bio-s if any discard bio is already under processing (fbd-fbd_dbl is not empty). ploop_wait() must take care about such a case, otherwise a busyloop may happen: ploop_thread()

[Devel] [PATCH rh7 35/38] ploop: mark reloc reqs to force FUA before write of relocated data

2015-05-19 Thread Andrey Smetanin
to mark req to FLUSH previously written(without FUA) data. Performance: Overall(includes EXT4 resize upto 16T) resize performance degradated by -5% of time. https://jira.sw.ru/browse/PSBM-31222 https://jira.sw.ru/browse/PSBM-31225 https://jira.sw.ru/browse/PSBM-31321 Signed-off-by: Andrey Smetanin

[Devel] [PATCH rh7 38/38] ploop: added printk of function, line, backtrace before ploop_set_error

2015-05-19 Thread Andrey Smetanin
-by: Andrey Smetanin asmeta...@virtuozzo.com --- drivers/block/ploop/dev.c| 32 +++- drivers/block/ploop/fmt_ploop1.c | 2 +- drivers/block/ploop/io_direct.c | 20 ++-- drivers/block/ploop/io_kaio.c| 16 drivers/block/ploop

[Devel] [PATCH rh7 10/38] ploop: reverse order of fdatawait and fsync fop

2015-05-19 Thread Andrey Smetanin
dio_fsync_thread must call filemap_fdatawrite() before file-f_op-fsync(). Otherwise: 8,06 82 0.003095587 12328 D WS 441706496 + 512 [ploop19054] 8,06 83 0.003103726 12328 D WS 441707008 + 512 [ploop19054] 8,06 84 0.003108627 12328 D WS

[Devel] [PATCH rh7] ploop: add a separate queue for discard bio-s (v2)

2015-05-13 Thread Andrey Smetanin
(no logic changes) port for RHEL7 of Andrew Vagin original patch (RHEL6). Signed-off-by: Andrew Vagin ava...@openvz.org Signed-off-by: Andrey Smetanin asmeta...@odin.com --- drivers/block/ploop/dev.c | 54 ++ drivers/block/ploop/freeblks.c | 5 drivers