[PATCH] idr: fix invalid ptr dereference on item delete

2018-05-10 Thread Roman Kagan
IDR_FREE tag. As a result, on an attempt to remove an index!=0 entry from such an IDR, radix_tree_delete_item doesn't return early and calls __radix_tree_delete with invalid parameters which are then dereferenced. Reported-by: syzbot+35666cba7f0a337e2...@syzkaller.appspotmail.com Signed-off-by: Roman

[PATCH] idr: fix invalid ptr dereference on item delete

2018-05-10 Thread Roman Kagan
IDR_FREE tag. As a result, on an attempt to remove an index!=0 entry from such an IDR, radix_tree_delete_item doesn't return early and calls __radix_tree_delete with invalid parameters which are then dereferenced. Reported-by: syzbot+35666cba7f0a337e2...@syzkaller.appspotmail.com Signed-off-by: Roman

Re: [PATCH] KVM: hyperv: idr_find needs RCU protection

2018-05-08 Thread Roman Kagan
cu_read_lock/unlock; the result is still protected by > vcpu->kvm->srcu. > > Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> > --- > arch/x86/kvm/hyperv.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) Reviewed-by: Roman Kagan <rka...@virtuozzo.com>

Re: [PATCH] KVM: hyperv: idr_find needs RCU protection

2018-05-08 Thread Roman Kagan
cu_read_lock/unlock; the result is still protected by > vcpu->kvm->srcu. > > Signed-off-by: Paolo Bonzini > --- > arch/x86/kvm/hyperv.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) Reviewed-by: Roman Kagan

Re: WARNING in __mutex_unlock_slowpath

2018-05-08 Thread Roman Kagan
On Mon, May 07, 2018 at 07:19:04PM +0200, Paolo Bonzini wrote: > On 29/04/2018 19:00, syzbot wrote: > > syzbot hit the following crash on upstream commit > > bf8f5de17442bba5f811e7e724980730e079ee11 (Sat Apr 28 17:05:04 2018 +) > > MAINTAINERS: add myself as maintainer of AFFS > > syzbot

Re: WARNING in __mutex_unlock_slowpath

2018-05-08 Thread Roman Kagan
On Mon, May 07, 2018 at 07:19:04PM +0200, Paolo Bonzini wrote: > On 29/04/2018 19:00, syzbot wrote: > > syzbot hit the following crash on upstream commit > > bf8f5de17442bba5f811e7e724980730e079ee11 (Sat Apr 28 17:05:04 2018 +) > > MAINTAINERS: add myself as maintainer of AFFS > > syzbot

Re: [PATCH 0/5] KVM: x86: hyperv: PV TLB flush for Windows guests

2018-04-03 Thread Roman Kagan
On Mon, Apr 02, 2018 at 06:10:54PM +0200, Vitaly Kuznetsov wrote: > This is both a new feature and a bugfix. > > Bugfix description: > > It was found that Windows 2016 guests on KVM crash when they have > 64 > vCPUs, non-flat topology (>1 core/thread per socket; in case it has >64 > sockets

Re: [PATCH 0/5] KVM: x86: hyperv: PV TLB flush for Windows guests

2018-04-03 Thread Roman Kagan
On Mon, Apr 02, 2018 at 06:10:54PM +0200, Vitaly Kuznetsov wrote: > This is both a new feature and a bugfix. > > Bugfix description: > > It was found that Windows 2016 guests on KVM crash when they have > 64 > vCPUs, non-flat topology (>1 core/thread per socket; in case it has >64 > sockets

Re: [PATCH v2 1/5] x86/kvm: rename HV_X64_MSR_APIC_ASSIST_PAGE to HV_X64_MSR_VP_ASSIST_PAGE

2018-03-07 Thread Roman Kagan
On Wed, Mar 07, 2018 at 05:19:44PM +0100, Radim Krčmář wrote: > 2018-02-26 18:11+0100, Vitaly Kuznetsov: > > From: Ladi Prosek > > > > The assist page has been used only for the paravirtual EOI so far, hence > > the "APIC" in the MSR name. Renaming to match the Hyper-V TLFS

Re: [PATCH v2 1/5] x86/kvm: rename HV_X64_MSR_APIC_ASSIST_PAGE to HV_X64_MSR_VP_ASSIST_PAGE

2018-03-07 Thread Roman Kagan
On Wed, Mar 07, 2018 at 05:19:44PM +0100, Radim Krčmář wrote: > 2018-02-26 18:11+0100, Vitaly Kuznetsov: > > From: Ladi Prosek > > > > The assist page has been used only for the paravirtual EOI so far, hence > > the "APIC" in the MSR name. Renaming to match the Hyper-V TLFS where it's > > called

Re: [PATCH v2 3/3] x86/kvm/hyper-v: inject #GP only when invalid SINTx vector is unmasked

2018-03-01 Thread Roman Kagan
Polling bit (bit 18) is set to 1, then they > ignore the value of Vector. Make KVM act accordingly. > > Signed-off-by: Vitaly Kuznetsov <vkuzn...@redhat.com> > --- > Changes since v1: > - Drop 'polling' bit check for now as we don't support this mode. We'll > ne

Re: [PATCH v2 3/3] x86/kvm/hyper-v: inject #GP only when invalid SINTx vector is unmasked

2018-03-01 Thread Roman Kagan
Polling bit (bit 18) is set to 1, then they > ignore the value of Vector. Make KVM act accordingly. > > Signed-off-by: Vitaly Kuznetsov > --- > Changes since v1: > - Drop 'polling' bit check for now as we don't support this mode. We'll > need to bring some form of this chec

Re: [PATCH 1/3] x86/kvm/hyper-v: add reenlightenment MSRs support

2018-02-28 Thread Roman Kagan
| 21 + > arch/x86/kvm/x86.c | 12 +++- > 3 files changed, 36 insertions(+), 1 deletion(-) Reviewed-by: Roman Kagan <rka...@virtuozzo.com>

Re: [PATCH 1/3] x86/kvm/hyper-v: add reenlightenment MSRs support

2018-02-28 Thread Roman Kagan
+++ > arch/x86/kvm/x86.c | 12 +++- > 3 files changed, 36 insertions(+), 1 deletion(-) Reviewed-by: Roman Kagan

Re: [PATCH 3/3] x86/kvm/hyper-v: inject #GP only when invalid SINTx vector is unmasked

2018-02-28 Thread Roman Kagan
On Wed, Feb 28, 2018 at 04:35:59PM +0100, Vitaly Kuznetsov wrote: > Roman Kagan <rka...@virtuozzo.com> writes: > > > On Wed, Feb 28, 2018 at 02:44:01PM +0100, Vitaly Kuznetsov wrote: > >> Hyper-V 2016 on KVM with SynIC enabled doesn't boot with the following > >

Re: [PATCH 3/3] x86/kvm/hyper-v: inject #GP only when invalid SINTx vector is unmasked

2018-02-28 Thread Roman Kagan
On Wed, Feb 28, 2018 at 04:35:59PM +0100, Vitaly Kuznetsov wrote: > Roman Kagan writes: > > > On Wed, Feb 28, 2018 at 02:44:01PM +0100, Vitaly Kuznetsov wrote: > >> Hyper-V 2016 on KVM with SynIC enabled doesn't boot with the following > >> trace: > >>

Re: [PATCH 3/3] x86/kvm/hyper-v: inject #GP only when invalid SINTx vector is unmasked

2018-02-28 Thread Roman Kagan
On Wed, Feb 28, 2018 at 02:44:01PM +0100, Vitaly Kuznetsov wrote: > Hyper-V 2016 on KVM with SynIC enabled doesn't boot with the following > trace: > > kvm_entry:vcpu 0 > kvm_exit: reason MSR_WRITE rip 0xf8000131c1e5 info 0 0 > kvm_hv_synic_set_msr: vcpu_id

Re: [PATCH 3/3] x86/kvm/hyper-v: inject #GP only when invalid SINTx vector is unmasked

2018-02-28 Thread Roman Kagan
On Wed, Feb 28, 2018 at 02:44:01PM +0100, Vitaly Kuznetsov wrote: > Hyper-V 2016 on KVM with SynIC enabled doesn't boot with the following > trace: > > kvm_entry:vcpu 0 > kvm_exit: reason MSR_WRITE rip 0xf8000131c1e5 info 0 0 > kvm_hv_synic_set_msr: vcpu_id

Re: [PATCH 2/3] x86/kvm/hyper-v: remove stale entries from vec_bitmap/auto_eoi_bitmap on vector change

2018-02-28 Thread Roman Kagan
uznetsov <vkuzn...@redhat.com> > --- > arch/x86/include/uapi/asm/hyperv.h | 2 ++ > arch/x86/kvm/hyperv.c | 32 ++-- > 2 files changed, 24 insertions(+), 10 deletions(-) Reviewed-by: Roman Kagan <rka...@virtuozzo.com>

Re: [PATCH 2/3] x86/kvm/hyper-v: remove stale entries from vec_bitmap/auto_eoi_bitmap on vector change

2018-02-28 Thread Roman Kagan
> --- > arch/x86/include/uapi/asm/hyperv.h | 2 ++ > arch/x86/kvm/hyperv.c | 32 ++-- > 2 files changed, 24 insertions(+), 10 deletions(-) Reviewed-by: Roman Kagan

Re: [PATCH 3/6] x86/hyper-v: reenlightenment notifications support

2017-12-11 Thread Roman Kagan
On Mon, Dec 11, 2017 at 10:56:33AM +0100, Vitaly Kuznetsov wrote: > Roman Kagan <rka...@virtuozzo.com> writes: > > On Fri, Dec 08, 2017 at 11:49:57AM +0100, Vitaly Kuznetsov wrote: > >> +void register_hv_tsc_update(void (*cb)(void)) > >> +{ > > > &g

Re: [PATCH 3/6] x86/hyper-v: reenlightenment notifications support

2017-12-11 Thread Roman Kagan
On Mon, Dec 11, 2017 at 10:56:33AM +0100, Vitaly Kuznetsov wrote: > Roman Kagan writes: > > On Fri, Dec 08, 2017 at 11:49:57AM +0100, Vitaly Kuznetsov wrote: > >> +void register_hv_tsc_update(void (*cb)(void)) > >> +{ > > > > The function name seems

Re: [PATCH 3/6] x86/hyper-v: reenlightenment notifications support

2017-12-08 Thread Roman Kagan
On Fri, Dec 08, 2017 at 11:49:57AM +0100, Vitaly Kuznetsov wrote: > Hyper-V supports Live Migration notification. This is supposed to be used > in conjunction with TSC emulation: when we are migrated to a host with > different TSC frequency for some short period host emulates our accesses > to TSC

Re: [PATCH 3/6] x86/hyper-v: reenlightenment notifications support

2017-12-08 Thread Roman Kagan
On Fri, Dec 08, 2017 at 11:49:57AM +0100, Vitaly Kuznetsov wrote: > Hyper-V supports Live Migration notification. This is supposed to be used > in conjunction with TSC emulation: when we are migrated to a host with > different TSC frequency for some short period host emulates our accesses > to TSC

Re: [PATCH 6/6] x86/kvm: support Hyper-V reenlightenment

2017-12-08 Thread Roman Kagan
On Fri, Dec 08, 2017 at 11:50:00AM +0100, Vitaly Kuznetsov wrote: > When we run nested KVM on Hyper-V guests we need to update masterclocks for > all guests when L1 migrates to a host with different TSC frequency. > Implement the procedure in the following way: > - Pause all guests. > - Tell our

Re: [PATCH 6/6] x86/kvm: support Hyper-V reenlightenment

2017-12-08 Thread Roman Kagan
On Fri, Dec 08, 2017 at 11:50:00AM +0100, Vitaly Kuznetsov wrote: > When we run nested KVM on Hyper-V guests we need to update masterclocks for > all guests when L1 migrates to a host with different TSC frequency. > Implement the procedure in the following way: > - Pause all guests. > - Tell our

Re: [PATCH 12/15] hyperv: move VMBus connection ids to uapi

2017-01-09 Thread Roman Kagan
On Mon, Jan 09, 2017 at 12:40:48AM -0800, h...@zytor.com wrote: > On January 9, 2017 12:32:23 AM PST, Roman Kagan <rka...@virtuozzo.com> wrote: > >On Mon, Jan 02, 2017 at 09:19:57AM +0100, Paolo Bonzini wrote: > >> On 28/12/2016 18:09, Roman Kagan wrote: > >>

Re: [PATCH 12/15] hyperv: move VMBus connection ids to uapi

2017-01-09 Thread Roman Kagan
On Mon, Jan 09, 2017 at 12:40:48AM -0800, h...@zytor.com wrote: > On January 9, 2017 12:32:23 AM PST, Roman Kagan wrote: > >On Mon, Jan 02, 2017 at 09:19:57AM +0100, Paolo Bonzini wrote: > >> On 28/12/2016 18:09, Roman Kagan wrote: > >> > Am I correct assuming that Q

Re: [PATCH 12/15] hyperv: move VMBus connection ids to uapi

2017-01-09 Thread Roman Kagan
On Mon, Jan 02, 2017 at 09:19:57AM +0100, Paolo Bonzini wrote: > On 28/12/2016 18:09, Roman Kagan wrote: > > Am I correct assuming that QEMU is currently the only user of > > arch/x86/include/uapi/asm/hyperv.h? > > > > Then I think we're fine withdrawing it from

Re: [PATCH 12/15] hyperv: move VMBus connection ids to uapi

2017-01-09 Thread Roman Kagan
On Mon, Jan 02, 2017 at 09:19:57AM +0100, Paolo Bonzini wrote: > On 28/12/2016 18:09, Roman Kagan wrote: > > Am I correct assuming that QEMU is currently the only user of > > arch/x86/include/uapi/asm/hyperv.h? > > > > Then I think we're fine withdrawing it from

Re: [PATCH 00/15] hyperv: more stuff to uapi + cleanup

2016-12-28 Thread Roman Kagan
[ Sorry for such a slow reply; flu and office relocation knocked me out for a while ] On Wed, Dec 21, 2016 at 06:00:17PM +, KY Srinivasan wrote: > > -Original Message- > > From: Roman Kagan [mailto:rka...@virtuozzo.com] > > Sent: Tuesday, December 20, 2016 7:56 AM &

Re: [PATCH 00/15] hyperv: more stuff to uapi + cleanup

2016-12-28 Thread Roman Kagan
[ Sorry for such a slow reply; flu and office relocation knocked me out for a while ] On Wed, Dec 21, 2016 at 06:00:17PM +, KY Srinivasan wrote: > > -Original Message- > > From: Roman Kagan [mailto:rka...@virtuozzo.com] > > Sent: Tuesday, December 20, 2016 7:56 AM &

Re: [PATCH 12/15] hyperv: move VMBus connection ids to uapi

2016-12-28 Thread Roman Kagan
org> > > Cc: Paolo Bonzini <pbonz...@redhat.com>; Roman Kagan > > <rka...@virtuozzo.com>; Radim Krčmář <rkrc...@redhat.com>; KY > > Srinivasan <k...@microsoft.com>; Vitaly Kuznetsov > > <vkuzn...@redhat.com>; k...@vger.kernel.org; Denis V . Lunev > &

Re: [PATCH 12/15] hyperv: move VMBus connection ids to uapi

2016-12-28 Thread Roman Kagan
On Wed, Dec 21, 2016 at 07:54:11PM +, KY Srinivasan wrote: > > > > -Original Message- > > From: Stephen Hemminger [mailto:step...@networkplumber.org] > > Sent: Wednesday, December 21, 2016 10:03 AM > > To: Christoph Hellwig > > Cc: Paolo Bonzini ;

Re: [PATCH 12/15] hyperv: move VMBus connection ids to uapi

2016-12-21 Thread Roman Kagan
On Wed, Dec 21, 2016 at 04:18:58AM -0800, Christoph Hellwig wrote: > On Wed, Dec 21, 2016 at 09:29:39AM +0300, Roman Kagan wrote: > > QEMU in particular. We're planning to implement VMBus devices in QEMU > > and would like to have the definitions shared with the Linux guest > &

Re: [PATCH 12/15] hyperv: move VMBus connection ids to uapi

2016-12-21 Thread Roman Kagan
On Wed, Dec 21, 2016 at 04:18:58AM -0800, Christoph Hellwig wrote: > On Wed, Dec 21, 2016 at 09:29:39AM +0300, Roman Kagan wrote: > > QEMU in particular. We're planning to implement VMBus devices in QEMU > > and would like to have the definitions shared with the Linux guest > &

Re: [PATCH 12/15] hyperv: move VMBus connection ids to uapi

2016-12-21 Thread Roman Kagan
On Wed, Dec 21, 2016 at 06:26:54AM -0800, Christoph Hellwig wrote: > On Wed, Dec 21, 2016 at 03:59:20PM +0300, Roman Kagan wrote: > > That's fine by me. > > > > I guess the series should then start with a complete move > > arch/x86/include/uapi/asm/hyperv.h

Re: [PATCH 12/15] hyperv: move VMBus connection ids to uapi

2016-12-21 Thread Roman Kagan
On Wed, Dec 21, 2016 at 06:26:54AM -0800, Christoph Hellwig wrote: > On Wed, Dec 21, 2016 at 03:59:20PM +0300, Roman Kagan wrote: > > That's fine by me. > > > > I guess the series should then start with a complete move > > arch/x86/include/uapi/asm/hyperv.h

Re: [PATCH 03/15] hyperv: use standard bitops

2016-12-21 Thread Roman Kagan
On Wed, Dec 21, 2016 at 01:00:44PM +0100, Olaf Hering wrote: > On Tue, Dec 20, Roman Kagan wrote: > > Reverting commit 22356585712d ("staging: hv: use sync_bitops when > interacting with the hypervisor") is save because ... > > > - sy

Re: [PATCH 03/15] hyperv: use standard bitops

2016-12-21 Thread Roman Kagan
On Wed, Dec 21, 2016 at 01:00:44PM +0100, Olaf Hering wrote: > On Tue, Dec 20, Roman Kagan wrote: > > Reverting commit 22356585712d ("staging: hv: use sync_bitops when > interacting with the hypervisor") is save because ... > > > - sy

Re: [PATCH 02/15] hyperv: uapi-fy synic event flags definitions

2016-12-20 Thread Roman Kagan
On Tue, Dec 20, 2016 at 09:24:53AM -0800, Stephen Hemminger wrote: > On Tue, 20 Dec 2016 18:55:49 +0300 > Roman Kagan <rka...@virtuozzo.com> wrote: > > > Move definitions related to the Hyper-V SynIC event flags to a header > > where they can be consumed by userspa

Re: [PATCH 02/15] hyperv: uapi-fy synic event flags definitions

2016-12-20 Thread Roman Kagan
On Tue, Dec 20, 2016 at 09:24:53AM -0800, Stephen Hemminger wrote: > On Tue, 20 Dec 2016 18:55:49 +0300 > Roman Kagan wrote: > > > Move definitions related to the Hyper-V SynIC event flags to a header > > where they can be consumed by userspace. > > > > While

Re: [PATCH 12/15] hyperv: move VMBus connection ids to uapi

2016-12-20 Thread Roman Kagan
On Tue, Dec 20, 2016 at 09:25:43AM -0800, Stephen Hemminger wrote: > On Tue, 20 Dec 2016 18:55:59 +0300 > Roman Kagan <rka...@virtuozzo.com> wrote: > > > Userspace will need them too. > > > > Signed-off-by: Roman Kagan <rka...@virtuozzo.com> > > Wha

Re: [PATCH 12/15] hyperv: move VMBus connection ids to uapi

2016-12-20 Thread Roman Kagan
On Tue, Dec 20, 2016 at 09:25:43AM -0800, Stephen Hemminger wrote: > On Tue, 20 Dec 2016 18:55:59 +0300 > Roman Kagan wrote: > > > Userspace will need them too. > > > > Signed-off-by: Roman Kagan > > What userspace? I am worried about creating more stable

Re: [PATCH 01/15] hyperv: consolidate TSC ref page definitions

2016-12-20 Thread Roman Kagan
On Tue, Dec 20, 2016 at 08:57:28PM +, KY Srinivasan wrote: > > > > -Original Message- > > From: Roman Kagan [mailto:rka...@virtuozzo.com] > > Sent: Tuesday, December 20, 2016 7:56 AM > > To: Paolo Bonzini <pbonz...@redhat.com>; Radim Krčmář > &

Re: [PATCH 01/15] hyperv: consolidate TSC ref page definitions

2016-12-20 Thread Roman Kagan
On Tue, Dec 20, 2016 at 08:57:28PM +, KY Srinivasan wrote: > > > > -Original Message- > > From: Roman Kagan [mailto:rka...@virtuozzo.com] > > Sent: Tuesday, December 20, 2016 7:56 AM > > To: Paolo Bonzini ; Radim Krčmář > > ; KY Srinivasan ;

[PATCH 01/15] hyperv: consolidate TSC ref page definitions

2016-12-20 Thread Roman Kagan
Consolidate the guest-side and kvm-side definitions for Hyper-V TSC reference page. While at this, rewrite read_hv_clock_tsc using the existing helpers. Signed-off-by: Roman Kagan <rka...@virtuozzo.com> --- arch/x86/include/asm/kvm_host.h| 2 +- arch/x86/include/uapi/asm/hyperv.

[PATCH 01/15] hyperv: consolidate TSC ref page definitions

2016-12-20 Thread Roman Kagan
Consolidate the guest-side and kvm-side definitions for Hyper-V TSC reference page. While at this, rewrite read_hv_clock_tsc using the existing helpers. Signed-off-by: Roman Kagan --- arch/x86/include/asm/kvm_host.h| 2 +- arch/x86/include/uapi/asm/hyperv.h | 4 +-- drivers/hv

[PATCH 08/15] hyperv: dedup crash msr related definitions

2016-12-20 Thread Roman Kagan
Use the definitions already present in the uapi header throughout the guest driver, too. Signed-off-by: Roman Kagan <rka...@virtuozzo.com> --- drivers/hv/hyperv_vmbus.h | 11 --- drivers/hv/vmbus_drv.c| 6 +++--- 2 files changed, 3 insertions(+), 14 deletions(-) diff

[PATCH 08/15] hyperv: dedup crash msr related definitions

2016-12-20 Thread Roman Kagan
Use the definitions already present in the uapi header throughout the guest driver, too. Signed-off-by: Roman Kagan --- drivers/hv/hyperv_vmbus.h | 11 --- drivers/hv/vmbus_drv.c| 6 +++--- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/drivers/hv/hyperv_vmbus.h b

[PATCH 10/15] hyperv: uapi-fy PostMessage and SignalEvent hypercall structures

2016-12-20 Thread Roman Kagan
Expose structures used for PostMessage and SignalEvent hypercalls in a uapi header. While doing so, simplify alignment handling and drop unnecessary complications in the connectionid field. Signed-off-by: Roman Kagan <rka...@virtuozzo.com> --- arch/x86/include/uapi/asm/hyperv.

[PATCH 10/15] hyperv: uapi-fy PostMessage and SignalEvent hypercall structures

2016-12-20 Thread Roman Kagan
Expose structures used for PostMessage and SignalEvent hypercalls in a uapi header. While doing so, simplify alignment handling and drop unnecessary complications in the connectionid field. Signed-off-by: Roman Kagan --- arch/x86/include/uapi/asm/hyperv.h | 18 ++ drivers/hv

[PATCH 04/15] hyperv: define VMBus message type

2016-12-20 Thread Roman Kagan
Give a name to the constant (1) already used in the code. Signed-off-by: Roman Kagan <rka...@virtuozzo.com> --- arch/x86/include/uapi/asm/hyperv.h | 2 ++ drivers/hv/connection.c| 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/uapi/asm/hy

[PATCH 04/15] hyperv: define VMBus message type

2016-12-20 Thread Roman Kagan
Give a name to the constant (1) already used in the code. Signed-off-by: Roman Kagan --- arch/x86/include/uapi/asm/hyperv.h | 2 ++ drivers/hv/connection.c| 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/x86/include/uapi/asm/hyperv.h b/arch/x86/include

[PATCH 09/15] hyperv: unify Hyper-V msr definitions

2016-12-20 Thread Roman Kagan
Use the definitions already present in the uapi header. Besides, drop all bitfields for the msr values and use bitwise operations instead. Signed-off-by: Roman Kagan <rka...@virtuozzo.com> --- drivers/hv/hyperv_vmbus.h | 88 --- drivers/hv/hv.c

[PATCH 11/15] hyperv: uapi-fy monitored notification structures

2016-12-20 Thread Roman Kagan
Move structures for monitored notifications to the uapi header for userspace to be able to consume. Also observe that hv_monitor_parameter is by definition the same as hv_input_signal_event so use the latter and nuke the former. Signed-off-by: Roman Kagan <rka...@virtuozzo.com> --- ar

[PATCH 09/15] hyperv: unify Hyper-V msr definitions

2016-12-20 Thread Roman Kagan
Use the definitions already present in the uapi header. Besides, drop all bitfields for the msr values and use bitwise operations instead. Signed-off-by: Roman Kagan --- drivers/hv/hyperv_vmbus.h | 88 --- drivers/hv/hv.c | 150

[PATCH 11/15] hyperv: uapi-fy monitored notification structures

2016-12-20 Thread Roman Kagan
Move structures for monitored notifications to the uapi header for userspace to be able to consume. Also observe that hv_monitor_parameter is by definition the same as hv_input_signal_event so use the latter and nuke the former. Signed-off-by: Roman Kagan --- arch/x86/include/uapi/asm/hyperv.h

[PATCH 05/15] hyperv: GFP_ATOMIC -> GFP_KERNEL

2016-12-20 Thread Roman Kagan
There's no need in GFP_ATOMIC when initializing the driver state. While at this, also rely on free_page() to take null argument. Signed-off-by: Roman Kagan <rka...@virtuozzo.com> --- drivers/hv/hv.c | 23 ++- 1 file changed, 10 insertions(+), 13 deletions(-) diff

[PATCH 05/15] hyperv: GFP_ATOMIC -> GFP_KERNEL

2016-12-20 Thread Roman Kagan
There's no need in GFP_ATOMIC when initializing the driver state. While at this, also rely on free_page() to take null argument. Signed-off-by: Roman Kagan --- drivers/hv/hv.c | 23 ++- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/drivers/hv/hv.c b

[PATCH 07/15] hyperv: dedup cpuid definitions

2016-12-20 Thread Roman Kagan
Use the definitions already present in the uapi header throughout the guest driver, too. Signed-off-by: Roman Kagan <rka...@virtuozzo.com> --- drivers/hv/hyperv_vmbus.h | 19 --- drivers/hv/hv.c | 6 +++--- 2 files changed, 3 insertions(+), 22 deletions(-) diff

[PATCH 07/15] hyperv: dedup cpuid definitions

2016-12-20 Thread Roman Kagan
Use the definitions already present in the uapi header throughout the guest driver, too. Signed-off-by: Roman Kagan --- drivers/hv/hyperv_vmbus.h | 19 --- drivers/hv/hv.c | 6 +++--- 2 files changed, 3 insertions(+), 22 deletions(-) diff --git a/drivers/hv

[PATCH 03/15] hyperv: use standard bitops

2016-12-20 Thread Roman Kagan
Signed-off-by: Roman Kagan <rka...@virtuozzo.com> --- drivers/hv/channel.c| 8 +++- drivers/hv/connection.c | 9 +++-- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c index 5fb4c6d..f9df275 100644 --- a/drivers/hv/cha

[PATCH 03/15] hyperv: use standard bitops

2016-12-20 Thread Roman Kagan
Signed-off-by: Roman Kagan --- drivers/hv/channel.c| 8 +++- drivers/hv/connection.c | 9 +++-- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c index 5fb4c6d..f9df275 100644 --- a/drivers/hv/channel.c +++ b/drivers/hv

[PATCH 06/15] hyperv: avoid unnecessary vmalloc

2016-12-20 Thread Roman Kagan
Make hypercall and tsc page allocation similar to the rest of the Hyper-V shared memory stuff instead of vmalloc-ing them. Also perform cleanup unconditionally which is safe. TODO: the skipping of free in case of a crash is probably no longer necessary, too. Signed-off-by: Roman Kagan <

[PATCH 06/15] hyperv: avoid unnecessary vmalloc

2016-12-20 Thread Roman Kagan
Make hypercall and tsc page allocation similar to the rest of the Hyper-V shared memory stuff instead of vmalloc-ing them. Also perform cleanup unconditionally which is safe. TODO: the skipping of free in case of a crash is probably no longer necessary, too. Signed-off-by: Roman Kagan

[PATCH 02/15] hyperv: uapi-fy synic event flags definitions

2016-12-20 Thread Roman Kagan
Move definitions related to the Hyper-V SynIC event flags to a header where they can be consumed by userspace. While doing so, also clean up their use by switching to standard bitops and struct-based dereferencing. The latter is also done for message pages. Signed-off-by: Roman Kagan <

[PATCH 02/15] hyperv: uapi-fy synic event flags definitions

2016-12-20 Thread Roman Kagan
Move definitions related to the Hyper-V SynIC event flags to a header where they can be consumed by userspace. While doing so, also clean up their use by switching to standard bitops and struct-based dereferencing. The latter is also done for message pages. Signed-off-by: Roman Kagan --- arch

[PATCH 15/15] hyperv: redefine hv_message without bitfields

2016-12-20 Thread Roman Kagan
This brings more symmetry in the API. The downside is that this changes the userspace-visible structure. Hopefully no userspace code had a chance to use it yet. Signed-off-by: Roman Kagan <rka...@virtuozzo.com> --- arch/x86/include/uapi/asm/hyperv.

[PATCH 15/15] hyperv: redefine hv_message without bitfields

2016-12-20 Thread Roman Kagan
This brings more symmetry in the API. The downside is that this changes the userspace-visible structure. Hopefully no userspace code had a chance to use it yet. Signed-off-by: Roman Kagan --- arch/x86/include/uapi/asm/hyperv.h | 32 +--- drivers/hv/hyperv_vmbus.h

[PATCH 13/15] hyperv: move function close to its only callsite

2016-12-20 Thread Roman Kagan
Signed-off-by: Roman Kagan <rka...@virtuozzo.com> --- drivers/hv/hyperv_vmbus.h | 44 drivers/hv/hv.c | 39 +++ 2 files changed, 39 insertions(+), 44 deletions(-) diff --git a/drivers/hv/hyperv_vmb

[PATCH 13/15] hyperv: move function close to its only callsite

2016-12-20 Thread Roman Kagan
Signed-off-by: Roman Kagan --- drivers/hv/hyperv_vmbus.h | 44 drivers/hv/hv.c | 39 +++ 2 files changed, 39 insertions(+), 44 deletions(-) diff --git a/drivers/hv/hyperv_vmbus.h b/drivers/hv

[PATCH 12/15] hyperv: move VMBus connection ids to uapi

2016-12-20 Thread Roman Kagan
Userspace will need them too. Signed-off-by: Roman Kagan <rka...@virtuozzo.com> --- arch/x86/include/uapi/asm/hyperv.h | 9 + drivers/hv/hyperv_vmbus.h | 10 -- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/arch/x86/include/uapi/asm/hyperv.h

[PATCH 12/15] hyperv: move VMBus connection ids to uapi

2016-12-20 Thread Roman Kagan
Userspace will need them too. Signed-off-by: Roman Kagan --- arch/x86/include/uapi/asm/hyperv.h | 9 + drivers/hv/hyperv_vmbus.h | 10 -- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/arch/x86/include/uapi/asm/hyperv.h b/arch/x86/include/uapi/asm

[PATCH 14/15] hyperv_vmbus: drop unused definitions

2016-12-20 Thread Roman Kagan
None of these is used in the kernel. Signed-off-by: Roman Kagan <rka...@virtuozzo.com> --- drivers/hv/hyperv_vmbus.h | 119 -- 1 file changed, 119 deletions(-) diff --git a/drivers/hv/hyperv_vmbus.h b/drivers/hv/hyperv_vmbus.h index fcb5d91..8

[PATCH 14/15] hyperv_vmbus: drop unused definitions

2016-12-20 Thread Roman Kagan
None of these is used in the kernel. Signed-off-by: Roman Kagan --- drivers/hv/hyperv_vmbus.h | 119 -- 1 file changed, 119 deletions(-) diff --git a/drivers/hv/hyperv_vmbus.h b/drivers/hv/hyperv_vmbus.h index fcb5d91..8ce6d64 100644 --- a/drivers/hv

[PATCH 00/15] hyperv: more stuff to uapi + cleanup

2016-12-20 Thread Roman Kagan
but appear reasonable to do at the same time. The most controversial is the last patch which modifies the stuff already published in the uapi header, in the hope that no userspace applications have started relying on it; I'm ok dropping it if this is unacceptable. Roman Kagan (15): hyperv: consolidate

[PATCH 00/15] hyperv: more stuff to uapi + cleanup

2016-12-20 Thread Roman Kagan
but appear reasonable to do at the same time. The most controversial is the last patch which modifies the stuff already published in the uapi header, in the hope that no userspace applications have started relying on it; I'm ok dropping it if this is unacceptable. Roman Kagan (15): hyperv: consolidate

Re: [RFC PATCH v3 0/6] KVM: x86: avoid redundant REQ_EVENT

2016-12-20 Thread Roman Kagan
) > > > > difference = (36270-31510)/31510 * 100 = +15% -- looks good! > > Awesome! I hope it also qualifies as less ugly. :) Absolutely. FWIW Reviewed-by: Roman Kagan <rka...@virtuozzo.com> Roman.

Re: [RFC PATCH v3 0/6] KVM: x86: avoid redundant REQ_EVENT

2016-12-20 Thread Roman Kagan
) > > > > difference = (36270-31510)/31510 * 100 = +15% -- looks good! > > Awesome! I hope it also qualifies as less ugly. :) Absolutely. FWIW Reviewed-by: Roman Kagan Roman.

Re: [PATCH v2] KVM: x86: avoid redundant REQ_EVENT

2016-12-15 Thread Roman Kagan
On Thu, Dec 15, 2016 at 03:32:45PM +0100, Paolo Bonzini wrote: > > > On 15/12/2016 15:30, Radim Krčmář wrote: > > > > One useless round of KVM_REQ_EVENT is not going change nested > > performance by much and it is not the only thing we could improve wrt. > > TPR ... I would just leave it for

Re: [PATCH v2] KVM: x86: avoid redundant REQ_EVENT

2016-12-15 Thread Roman Kagan
On Thu, Dec 15, 2016 at 03:32:45PM +0100, Paolo Bonzini wrote: > > > On 15/12/2016 15:30, Radim Krčmář wrote: > > > > One useless round of KVM_REQ_EVENT is not going change nested > > performance by much and it is not the only thing we could improve wrt. > > TPR ... I would just leave it for

Re: [PATCH v1] KVM: x86: avoid redundant REQ_EVENT

2016-12-13 Thread Roman Kagan
On Mon, Dec 12, 2016 at 05:29:43PM +0100, Radim Krčmář wrote: > 2016-12-12 17:02+0300, Denis Plotnikov: > > When processing KVM_REQ_EVENT, apic_update_ppr is called which may set > > KVM_REQ_EVENT again if the recalculated value of PPR becomes smaller > > than the previous one. This results in

Re: [PATCH v1] KVM: x86: avoid redundant REQ_EVENT

2016-12-13 Thread Roman Kagan
On Mon, Dec 12, 2016 at 05:29:43PM +0100, Radim Krčmář wrote: > 2016-12-12 17:02+0300, Denis Plotnikov: > > When processing KVM_REQ_EVENT, apic_update_ppr is called which may set > > KVM_REQ_EVENT again if the recalculated value of PPR becomes smaller > > than the previous one. This results in

Re: [PATCH v2] KVM: hyperv: fix locking of struct kvm_hv fields

2016-12-12 Thread Roman Kagan
On Mon, Dec 12, 2016 at 10:12:53AM +0100, Paolo Bonzini wrote: > Introduce a new mutex to avoid an AB-BA deadlock between kvm->lock and > vcpu->mutex. Protect accesses in kvm_hv_setup_tsc_page too, as suggested > by Roman. > > Reported-by: Dmitry Vyukov <dvyu...@googl

Re: [PATCH v2] KVM: hyperv: fix locking of struct kvm_hv fields

2016-12-12 Thread Roman Kagan
On Mon, Dec 12, 2016 at 10:12:53AM +0100, Paolo Bonzini wrote: > Introduce a new mutex to avoid an AB-BA deadlock between kvm->lock and > vcpu->mutex. Protect accesses in kvm_hv_setup_tsc_page too, as suggested > by Roman. > > Reported-by: Dmitry Vyukov > Cc: Roman Kagan

Re: [PATCH 3/4] KVM: x86: introduce get_kvmclock_ns

2016-09-19 Thread Roman Kagan
x86.h | 6 +---- > 6 files changed, 43 insertions(+), 22 deletions(-) Reviewed-by: Roman Kagan <rka...@virtuozzo.com>

Re: [PATCH 3/4] KVM: x86: introduce get_kvmclock_ns

2016-09-19 Thread Roman Kagan
| 6 + > 6 files changed, 43 insertions(+), 22 deletions(-) Reviewed-by: Roman Kagan

Re: [PATCH 4/4] KVM: x86: Hyper-V tsc page setup

2016-09-19 Thread Roman Kagan
E_REF_COUNT msr > reads count to zero which potentially improves performance. > > Signed-off-by: Andrey Smetanin <asmeta...@virtuozzo.com> > Reviewed-by: Peter Hornyack <peterhorny...@google.com> > CC: Paolo Bonzini <pbonz...@redhat.com> > CC: Radim

Re: [PATCH 4/4] KVM: x86: Hyper-V tsc page setup

2016-09-19 Thread Roman Kagan
E_REF_COUNT msr > reads count to zero which potentially improves performance. > > Signed-off-by: Andrey Smetanin > Reviewed-by: Peter Hornyack > CC: Paolo Bonzini > CC: Radim Krčmář > CC: Roman Kagan > CC: Denis V. Lunev > [Computation of TSC page parame

Re: [PATCH 1/4] KVM: x86: always fill in vcpu->arch.hv_clock

2016-09-19 Thread Roman Kagan
Bonzini <pbonz...@redhat.com> > --- > arch/x86/kvm/x86.c | 109 > + > 1 file changed, 59 insertions(+), 50 deletions(-) Reviewed-by: Roman Kagan <rka...@virtuozzo.com>

Re: [PATCH 1/4] KVM: x86: always fill in vcpu->arch.hv_clock

2016-09-19 Thread Roman Kagan
: Paolo Bonzini > --- > arch/x86/kvm/x86.c | 109 > + > 1 file changed, 59 insertions(+), 50 deletions(-) Reviewed-by: Roman Kagan

Re: [PATCH 3/4] KVM: x86: introduce get_kvmclock_ns

2016-09-03 Thread Roman Kagan
On Fri, Sep 02, 2016 at 06:37:59PM +0200, Paolo Bonzini wrote: > > > On 02/09/2016 16:51, Roman Kagan wrote: > > On Fri, Sep 02, 2016 at 04:09:42PM +0200, Paolo Bonzini wrote: > >> On 02/09/2016 15:52, Roman Kagan wrote: > >> vs. using a single offset as in t

Re: [PATCH 3/4] KVM: x86: introduce get_kvmclock_ns

2016-09-03 Thread Roman Kagan
On Fri, Sep 02, 2016 at 06:37:59PM +0200, Paolo Bonzini wrote: > > > On 02/09/2016 16:51, Roman Kagan wrote: > > On Fri, Sep 02, 2016 at 04:09:42PM +0200, Paolo Bonzini wrote: > >> On 02/09/2016 15:52, Roman Kagan wrote: > >> vs. using a single offset as in t

Re: [PATCH 4/4] KVM: x86: Hyper-V tsc page setup

2016-09-02 Thread Roman Kagan
E_REF_COUNT msr > reads count to zero which potentially improves performance. > > Signed-off-by: Andrey Smetanin <asmeta...@virtuozzo.com> > Reviewed-by: Peter Hornyack <peterhorny...@google.com> > CC: Paolo Bonzini <pbonz...@redhat.com> > CC: Radim

Re: [PATCH 4/4] KVM: x86: Hyper-V tsc page setup

2016-09-02 Thread Roman Kagan
E_REF_COUNT msr > reads count to zero which potentially improves performance. > > Signed-off-by: Andrey Smetanin > Reviewed-by: Peter Hornyack > CC: Paolo Bonzini > CC: Radim Krčmář > CC: Roman Kagan > CC: Denis V. Lunev > [Computation of TSC page parame

Re: [PATCH 3/4] KVM: x86: introduce get_kvmclock_ns

2016-09-02 Thread Roman Kagan
On Fri, Sep 02, 2016 at 06:57:10PM +0200, Paolo Bonzini wrote: > > > On 02/09/2016 18:55, Roman Kagan wrote: > >> > I'll change patch 4 to store the parameters and use them when accessing > >> > the time reference counter MSR. I'll still keep the procedure

Re: [PATCH 3/4] KVM: x86: introduce get_kvmclock_ns

2016-09-02 Thread Roman Kagan
On Fri, Sep 02, 2016 at 06:57:10PM +0200, Paolo Bonzini wrote: > > > On 02/09/2016 18:55, Roman Kagan wrote: > >> > I'll change patch 4 to store the parameters and use them when accessing > >> > the time reference counter MSR. I'll still keep the procedure

Re: [PATCH 2/4] KVM: x86: initialize kvmclock_offset

2016-09-02 Thread Roman Kagan
ed semantics of the Hyper-V time reference counter. > > Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> > --- > arch/x86/kvm/x86.c | 1 + > 1 file changed, 1 insertion(+) Reviewed-by: Roman Kagan <rka...@virtuozzo.com>

Re: [PATCH 2/4] KVM: x86: initialize kvmclock_offset

2016-09-02 Thread Roman Kagan
ed semantics of the Hyper-V time reference counter. > > Signed-off-by: Paolo Bonzini > --- > arch/x86/kvm/x86.c | 1 + > 1 file changed, 1 insertion(+) Reviewed-by: Roman Kagan

<    1   2   3   >