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 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 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 3/4] KVM: x86: introduce get_kvmclock_ns

2016-09-02 Thread Roman Kagan
On Thu, Sep 01, 2016 at 05:26:14PM +0200, Paolo Bonzini wrote: > Introduce a function that reads the exact nanoseconds value that is > provided to the guest in kvmclock. This crystallizes the notion of > kvmclock as a thin veneer over a stable TSC, that the guest will > (hopefully) convert with NT

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

2016-09-02 Thread Roman Kagan
On Fri, Sep 02, 2016 at 04:09:42PM +0200, Paolo Bonzini wrote: > On 02/09/2016 15:52, Roman Kagan wrote: > > On Thu, Sep 01, 2016 at 05:26:14PM +0200, Paolo Bonzini wrote: > >> --- a/arch/x86/kvm/hyperv.c > >> +++ b/arch/x86/kvm/hyperv.c > >> @@ -386,7 +38

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

2016-09-02 Thread Roman Kagan
On Thu, Sep 01, 2016 at 05:26:14PM +0200, Paolo Bonzini wrote: > Introduce a function that reads the exact nanoseconds value that is > provided to the guest in kvmclock. This crystallizes the notion of > kvmclock as a thin veneer over a stable TSC, that the guest will > (hopefully) convert with NT

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

2016-09-02 Thread Roman Kagan
On Thu, Sep 01, 2016 at 05:26:12PM +0200, Paolo Bonzini wrote: > We will use it in the next patches for KVM_GET_CLOCK and as a basis for the > contents of the Hyper-V TSC page. Get the values from the Linux > timekeeper even if kvmclock is not enabled. > > Signed-off-by: Paolo Bonzini > --- > a

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

2016-09-02 Thread Roman Kagan
ired 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

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

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 v5 5/5] KVM: x86: hyperv: implement PV IPI send hypercalls

2018-08-28 Thread Roman Kagan
*vcpu = > + get_vcpu_by_vpidx(kvm, vp_index); > + > + /* Unknown vCPU specified */ > + if (!vcpu) > + continue; > + > + /* We fail only when APIC is disabled */ > + kvm_apic_set_irq(vcpu, &irq, NULL); > + } > + } > + > +ret_success: > + return HV_STATUS_SUCCESS; > +} > + I still think that splitting kvm_hv_send_ipi into three functions would make it more readable, but that's a matter of taste of course, so I'm OK if Radim insists otherwise. Reviewed-by: Roman Kagan

Re: [PATCH v4 RESEND 5/5] KVM: x86: hyperv: implement PV IPI send hypercalls

2018-08-23 Thread Roman Kagan
On Wed, Aug 22, 2018 at 12:18:32PM +0200, Vitaly Kuznetsov wrote: > Using hypercall for sending IPIs is faster because this allows to specify > any number of vCPUs (even > 64 with sparse CPU set), the whole procedure > will take only one VMEXIT. > > Current Hyper-V TLFS (v5.0b) claims that HvCallS

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 v6 3/7] KVM: x86: hyperv: consistently use 'hv_vcpu' for 'struct kvm_vcpu_hv' variables

2018-09-27 Thread Roman Kagan
v > --- > arch/x86/kvm/hyperv.c | 18 +----- > 1 file changed, 9 insertions(+), 9 deletions(-) Reviewed-by: Roman Kagan

Re: [PATCH v6 4/7] KVM: x86: hyperv: keep track of mismatched VP indexes

2018-09-27 Thread Roman Kagan
tting vp_index = vcpu_idx. > + */ > + if (hv_vcpu->vp_index == vcpu_idx) > + atomic_inc(&hv->num_mismatched_vp_indexes); > + else if (new_vp_index == vcpu_idx) > + atomic_dec(&hv->num_mismatched_vp_indexes); > + > + hv_vcpu->vp_index = new_vp_index; > break; > + } > case HV_X64_MSR_VP_ASSIST_PAGE: { > u64 gfn; > unsigned long addr; Reviewed-by: Roman Kagan

Re: [PATCH v6 5/7] KVM: x86: hyperv: valid_bank_mask should be 'u64'

2018-09-27 Thread Roman Kagan
+++-- > 1 file changed, 3 insertions(+), 2 deletions(-) Reviewed-by: Roman Kagan

Re: [PATCH v6 6/7] KVM: x86: hyperv: optimize kvm_hv_flush_tlb() for vp_index == vcpu_idx case

2018-09-27 Thread Roman Kagan
On Wed, Sep 26, 2018 at 07:02:58PM +0200, Vitaly Kuznetsov wrote: > VP inedx almost always matches VCPU and when it does it's faster to walk > the sparse set instead of all vcpus. > > Signed-off-by: Vitaly Kuznetsov > --- > arch/x86/kvm/hyperv.c | 96 +++ >

Re: [PATCH v6 7/7] KVM: x86: hyperv: implement PV IPI send hypercalls

2018-09-27 Thread Roman Kagan
On Wed, Sep 26, 2018 at 07:02:59PM +0200, Vitaly Kuznetsov wrote: > Using hypercall for sending IPIs is faster because this allows to specify > any number of vCPUs (even > 64 with sparse CPU set), the whole procedure > will take only one VMEXIT. > > Current Hyper-V TLFS (v5.0b) claims that HvCallS

Re: [PATCH v2 1/4] x86/hyper-v: move synic/stimer control structures definitions to hyperv-tlfs.h

2018-11-26 Thread Roman Kagan
[ Sorry for having missed v1 ] On Mon, Nov 26, 2018 at 04:47:29PM +0100, Vitaly Kuznetsov wrote: > We implement Hyper-V SynIC and synthetic timers in KVM too so there's some > room for code sharing. > > Signed-off-by: Vitaly Kuznetsov > --- > arch/x86/include/asm/hyperv-tlfs.h | 69

Re: [PATCH v2 3/4] x86/kvm/hyper-v: direct mode for synthetic timers

2018-11-27 Thread Roman Kagan
6/kvm/trace.h | 10 +++--- > arch/x86/kvm/x86.c | 1 + > include/uapi/linux/kvm.h | 1 + > 4 files changed, 67 insertions(+), 12 deletions(-) Reviewed-by: Roman Kagan

Re: [PATCH v2 3/4] x86/kvm/hyper-v: direct mode for synthetic timers

2018-11-27 Thread Roman Kagan
On Mon, Nov 26, 2018 at 05:44:24PM +0100, Paolo Bonzini wrote: > On 26/11/18 16:47, Vitaly Kuznetsov wrote: > > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > > index 5cd5647120f2..b21b5ceb8d26 100644 > > --- a/arch/x86/kvm/x86.c > > +++ b/arch/x86/kvm/x86.c > > @@ -2997,6 +2997,7 @@ int kv

Re: [PATCH v2 4/4] x86/kvm/hyper-v: avoid open-coding stimer_mark_pending() in kvm_hv_notify_acked_sint()

2018-11-27 Thread Roman Kagan
vm/hyperv.c | 12 +++- > 1 file changed, 3 insertions(+), 9 deletions(-) Reviewed-by: Roman Kagan

Re: [PATCH v2 1/4] x86/hyper-v: move synic/stimer control structures definitions to hyperv-tlfs.h

2018-11-27 Thread Roman Kagan
On Tue, Nov 27, 2018 at 02:10:49PM +0100, Vitaly Kuznetsov wrote: > Roman Kagan writes: > > On Mon, Nov 26, 2018 at 04:47:29PM +0100, Vitaly Kuznetsov wrote: > > I personally tend to prefer masks over bitfields, so I'd rather do the > > consolidation in the opposite dire

Re: [PATCH v2 3/4] x86/kvm/hyper-v: direct mode for synthetic timers

2018-11-27 Thread Roman Kagan
On Tue, Nov 27, 2018 at 02:54:21PM +0100, Paolo Bonzini wrote: > On 27/11/18 09:37, Roman Kagan wrote: > > On Mon, Nov 26, 2018 at 05:44:24PM +0100, Paolo Bonzini wrote: > >> On 26/11/18 16:47, Vitaly Kuznetsov wrote: > >>> diff --git a/arch/x86/kvm/x86.c b/

Re: [PATCH v2 1/4] x86/hyper-v: move synic/stimer control structures definitions to hyperv-tlfs.h

2018-11-28 Thread Roman Kagan
On Wed, Nov 28, 2018 at 02:07:42PM +0100, Thomas Gleixner wrote: > On Wed, 28 Nov 2018, Vitaly Kuznetsov wrote: > > > Nadav Amit writes: > > > > > > > > On a different note: how come all of the hyper-v structs are not marked > > > with the “packed" attribute? > > > > "packed" should not be need

Re: [PATCH] x86/hyper-v: define structures from TLFS as packed

2018-11-30 Thread Roman Kagan
On Fri, Nov 30, 2018 at 01:15:11PM +0100, Vitaly Kuznetsov wrote: > Without 'packed' compiler is free to add optimization paddings and re-order > structure fields for randomization/optimization. And structures from > hyperv-tlfs.h are used for hypervisor-guest communication, we need to > ultimately

Re: [PATCH] x86/hyper-v: define structures from TLFS as packed

2018-11-30 Thread Roman Kagan
On Fri, Nov 30, 2018 at 02:44:54PM +0100, Vitaly Kuznetsov wrote: > Roman Kagan writes: > > > On Fri, Nov 30, 2018 at 01:15:11PM +0100, Vitaly Kuznetsov wrote: > >> Without 'packed' compiler is free to add optimization paddings and re-order > >> structu

Re: [PATCH v2] x86/hyper-v: Mark TLFS structures packed

2018-12-02 Thread Roman Kagan
On Mon, Dec 03, 2018 at 12:35:35AM +0100, Vitaly Kuznetsov wrote: > Nadav Amit writes: > > [skip] > > > > > Having said that, something else is sort of strange in the TLFS definitions, > > I think (I really know little about this whole protocol). Look at the > > following definitions from hyperv

Re: [PATCH v2 3/4] x86/kvm/hyper-v: direct mode for synthetic timers

2018-12-03 Thread Roman Kagan
On Mon, Nov 26, 2018 at 04:47:31PM +0100, Vitaly Kuznetsov wrote: > @@ -379,6 +398,14 @@ void kvm_hv_synic_send_eoi(struct kvm_vcpu *vcpu, int > vector) > for (i = 0; i < ARRAY_SIZE(synic->sint); i++) > if (synic_get_sint_vector(synic_read_sint(synic, i)) == vector) >

Re: [PATCH v2 2/5] KVM: x86: hyperv: introduce vp_index_to_vcpu_idx mapping

2018-06-29 Thread Roman Kagan
On Fri, Jun 29, 2018 at 01:37:44PM +0200, Vitaly Kuznetsov wrote: > The problem we're trying to solve here is: with PV TLB flush and IPI we > need to walk through the supplied list of VP_INDEXes and get VCPU > ids. Usually they match. But in case they don't [...] Why wouldn't they *in practice*?

Re: [PATCH v2 2/5] KVM: x86: hyperv: introduce vp_index_to_vcpu_idx mapping

2018-06-29 Thread Roman Kagan
On Fri, Jun 29, 2018 at 03:10:14PM +0200, Vitaly Kuznetsov wrote: > Roman Kagan writes: > > > On Fri, Jun 29, 2018 at 01:37:44PM +0200, Vitaly Kuznetsov wrote: > >> The problem we're trying to solve here is: with PV TLB flush and IPI we > >> need to walk thro

Re: [PATCH v3 3/5] KVM: x86: hyperv: use get_vcpu_by_vpidx() in kvm_hv_flush_tlb()

2018-06-29 Thread Roman Kagan
On Fri, Jun 29, 2018 at 04:14:53PM +0200, Vitaly Kuznetsov wrote: > VP_INDEX almost always matches VCPU id and get_vcpu_by_vpidx() is fast, > use it instead of traversing full vCPU list every time. > > To support the change switch kvm_make_vcpus_request_mask() to checking > vcpu_id instead of vcpu

Re: [PATCH v2 2/5] KVM: x86: hyperv: introduce vp_index_to_vcpu_idx mapping

2018-06-29 Thread Roman Kagan
On Fri, Jun 29, 2018 at 05:25:56PM +0200, Vitaly Kuznetsov wrote: > Roman Kagan writes: > > > On Fri, Jun 29, 2018 at 03:10:14PM +0200, Vitaly Kuznetsov wrote: > >> Roman Kagan writes: > >> > >> > On Fri, Jun 29, 2018 at 01:37:44PM +0200, Vitaly

Re: [PATCH v3 3/5] KVM: x86: hyperv: use get_vcpu_by_vpidx() in kvm_hv_flush_tlb()

2018-06-29 Thread Roman Kagan
On Fri, Jun 29, 2018 at 05:21:47PM +0200, Vitaly Kuznetsov wrote: > Roman Kagan writes: > > > On Fri, Jun 29, 2018 at 04:14:53PM +0200, Vitaly Kuznetsov wrote: > >> VP_INDEX almost always matches VCPU id and get_vcpu_by_vpidx() is fast, > >> use it instead of traver

Re: [PATCH v3 3/5] KVM: x86: hyperv: use get_vcpu_by_vpidx() in kvm_hv_flush_tlb()

2018-06-29 Thread Roman Kagan
On Fri, Jun 29, 2018 at 07:26:36PM +0300, Roman Kagan wrote: > On Fri, Jun 29, 2018 at 05:21:47PM +0200, Vitaly Kuznetsov wrote: > > Roman Kagan writes: > > > > > On Fri, Jun 29, 2018 at 04:14:53PM +0200, Vitaly Kuznetsov wrote: > > >> VP_INDEX almost always m

Re: [PATCH v4 1/5] KVM: x86: hyperv: enforce vp_index < KVM_MAX_VCPUS

2018-07-09 Thread Roman Kagan
early when supplied vpidx is >= KVM_MAX_VCPUS. > > Signed-off-by: Vitaly Kuznetsov > --- > arch/x86/kvm/hyperv.c | 8 +--- > 1 file changed, 5 insertions(+), 3 deletions(-) Reviewed-by: Roman Kagan

Re: [PATCH v4 2/5] KVM: x86: hyperv: optimize 'all cpus' case in kvm_hv_flush_tlb()

2018-07-09 Thread Roman Kagan
netsov > --- > arch/x86/kvm/hyperv.c | 42 +++--- > virt/kvm/kvm_main.c | 6 ++ > 2 files changed, 25 insertions(+), 23 deletions(-) Reviewed-by: Roman Kagan

Re: [PATCH v4 3/5] KVM: x86: hyperv: use get_vcpu_by_vpidx() in kvm_hv_flush_tlb()

2018-07-09 Thread Roman Kagan
(). > > Signed-off-by: Vitaly Kuznetsov > --- > arch/x86/kvm/hyperv.c | 78 > --- > 1 file changed, 31 insertions(+), 47 deletions(-) Reviewed-by: Roman Kagan

Re: [PATCH v4 4/5] x86/hyper-v: rename ipi_arg_{ex,non_ex} structures

2018-07-09 Thread Roman Kagan
--- > arch/x86/include/asm/hyperv-tlfs.h | 16 +--- > 2 files changed, 15 insertions(+), 13 deletions(-) Reviewed-by: Roman Kagan

Re: [PATCH v2 2/5] KVM: x86: hyperv: introduce vp_index_to_vcpu_idx mapping

2018-06-29 Thread Roman Kagan
On Thu, Jun 28, 2018 at 03:53:10PM +0200, Vitaly Kuznetsov wrote: > While it is easy to get VP index from vCPU index the reverse task is hard. > Basically, to solve it we have to walk all vCPUs checking if their VP index > matches. For hypercalls like HvFlushVirtualAddress{List,Space}* and the > up

Re: [PATCH v2 2/5] KVM: x86: hyperv: introduce vp_index_to_vcpu_idx mapping

2018-06-29 Thread Roman Kagan
On Fri, Jun 29, 2018 at 12:26:23PM +0200, Vitaly Kuznetsov wrote: > Roman Kagan writes: > > > On Thu, Jun 28, 2018 at 03:53:10PM +0200, Vitaly Kuznetsov wrote: > >> While it is easy to get VP index from vCPU index the reverse task is hard. > >> Basically, to solv

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

2018-05-18 Thread Roman Kagan
On Fri, May 18, 2018 at 10:50:25AM -0700, Matthew Wilcox wrote: > It'd be nice if you cc'd the person who wrote the code you're patching. > You'd get a response a lot quicker than waiting until I happened to > notice the email in a different forum. I sent it to someone called "Matthew Wilcox ". Al

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

2018-05-18 Thread Roman Kagan
On Thu, May 10, 2018 at 10:16:34PM +0300, Roman Kagan wrote: > If an IDR contains a single entry at index==0, the underlying radix tree > has a single item in its root node, in which case > __radix_tree_lookup(index!=0) doesn't set its *@nodep argument (in > addition

Re: [PATCH v2 1/2] x86/hyper-v: Stop caring about EOI for direct stimers

2018-12-13 Thread Roman Kagan
) > fails only when APIC is disabled (see APIC_DM_FIXED case in > __apic_accept_irq()). Remove the redundant part. > > Suggested-by: Roman Kagan > Signed-off-by: Vitaly Kuznetsov > --- > arch/x86/kvm/hyperv.c | 36 +++- > 1 file chang

Re: [PATCH v2 2/2] x86/kvm/hyper-v: disallow setting illegal vectors for direct mode stimers

2018-12-13 Thread Roman Kagan
uggested-by: Roman Kagan > Signed-off-by: Vitaly Kuznetsov > --- > arch/x86/kvm/hyperv.c | 5 + > 1 file changed, 5 insertions(+) Reviewed-by: Roman Kagan

Re: [PATCH v2 3/4] x86/kvm/hyper-v: direct mode for synthetic timers

2018-12-10 Thread Roman Kagan
On Mon, Nov 26, 2018 at 04:47:31PM +0100, Vitaly Kuznetsov wrote: > Turns out Hyper-V on KVM (as of 2016) will only use synthetic timers > if direct mode is available. With direct mode we notify the guest by > asserting APIC irq instead of sending a SynIC message. > > The implementation uses exist

Re: [PATCH v2 3/4] x86/kvm/hyper-v: direct mode for synthetic timers

2018-12-10 Thread Roman Kagan
On Mon, Dec 10, 2018 at 01:54:18PM +0100, Vitaly Kuznetsov wrote: > Roman Kagan writes: > > Just noticed that the patch seems to assume that "direct" timers are > > allowed to use any vectors including 0-15. I guess this is incorrect, > > and instead stimer_set_co

Re: [PATCH] x86/hyper-v: Stop caring about EOI for direct stimers

2018-12-10 Thread Roman Kagan
APIC and kvm_apic_set_irq() > fails only when APIC is disabled (see APIC_DM_FIXED case in > __apic_accept_irq()). Remove the redundant part. > > Suggested-by: Roman Kagan > Signed-off-by: Vitaly Kuznetsov > --- > arch/x86/kvm/hyperv.c | 36 +++

Re: [PATCH v2 4/7] x86/kvm/hyper-v: Introduce KVM_GET_SUPPORTED_HV_CPUID

2018-12-11 Thread Roman Kagan
On Mon, Dec 10, 2018 at 06:21:56PM +0100, Vitaly Kuznetsov wrote: > With every new Hyper-V Enlightenment we implement we're forced to add a > KVM_CAP_HYPERV_* capability. While this approach works it is fairly > inconvenient: the majority of the enlightenments we do have corresponding > CPUID featu

Re: [PATCH v2 4/7] x86/kvm/hyper-v: Introduce KVM_GET_SUPPORTED_HV_CPUID

2018-12-11 Thread Roman Kagan
On Tue, Dec 11, 2018 at 02:28:14PM +0100, Vitaly Kuznetsov wrote: > Roman Kagan writes: > > > On Mon, Dec 10, 2018 at 06:21:56PM +0100, Vitaly Kuznetsov wrote: > > >> + > >> +Currently, the following list of CPUID leaves are returned: > >&g

Re: [PATCH v2 4/7] x86/kvm/hyper-v: Introduce KVM_GET_SUPPORTED_HV_CPUID

2018-12-11 Thread Roman Kagan
On Tue, Dec 11, 2018 at 04:04:01PM +0100, Vitaly Kuznetsov wrote: > Roman Kagan writes: > > > On Tue, Dec 11, 2018 at 02:28:14PM +0100, Vitaly Kuznetsov wrote: > >> Roman Kagan writes: > >> > >> > On Mon, Dec 10, 2018 a

[PATCH] drivers/nvdimm/e820: turn off write cache by default

2022-09-29 Thread Roman Kagan
secase where such regions actually kind of persist the data -- across kexec. Signed-off-by: Roman Kagan --- drivers/nvdimm/e820.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/nvdimm/e820.c b/drivers/nvdimm/e820.c index 4cd18be9d0e9..3af63b7b6d23 100644 --- a/drivers/nvdimm/e820.c

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/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 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 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 v2 3/3] x86/kvm/hyper-v: inject #GP only when invalid SINTx vector is unmasked

2018-03-01 Thread Roman Kagan
16) or the 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 t

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 Wind

Re: [Qemu-devel] [RFC qemu 0/4] A PV solution for live migration optimization

2016-03-09 Thread Roman Kagan
On Fri, Mar 04, 2016 at 06:51:21PM +, Dr. David Alan Gilbert wrote: > * Paolo Bonzini (pbonz...@redhat.com) wrote: > > > > > > On 04/03/2016 15:26, Li, Liang Z wrote: > > >> > > > >> > The memory usage will keep increasing due to ever growing caches, etc, > > >> > so > > >> > you'll be left

Re: [Qemu-devel] [RFC qemu 0/4] A PV solution for live migration optimization

2016-03-09 Thread Roman Kagan
On Mon, Mar 07, 2016 at 01:40:06PM +0200, Michael S. Tsirkin wrote: > On Mon, Mar 07, 2016 at 06:49:19AM +, Li, Liang Z wrote: > > > > No. And it's exactly what I mean. The ballooned memory is still > > > > processed during live migration without skipping. The live migration > > > > code is >

Re: [Qemu-devel] [RFC qemu 0/4] A PV solution for live migration optimization

2016-03-09 Thread Roman Kagan
On Wed, Mar 09, 2016 at 05:41:39PM +0200, Michael S. Tsirkin wrote: > On Wed, Mar 09, 2016 at 05:28:54PM +0300, Roman Kagan wrote: > > For (1) I've been trying to make a point that skipping clean pages is > > much more likely to result in noticable benefit than free pages onl

Re: [Qemu-devel] [RFC qemu 0/4] A PV solution for live migration optimization

2016-03-10 Thread Roman Kagan
On Wed, Mar 09, 2016 at 02:38:52PM -0500, Rik van Riel wrote: > On Wed, 2016-03-09 at 20:04 +0300, Roman Kagan wrote: > > On Wed, Mar 09, 2016 at 05:41:39PM +0200, Michael S. Tsirkin wrote: > > > On Wed, Mar 09, 2016 at 05:28:54PM +0300, Roman Kagan wrote: > > > > Fo

Re: [Qemu-devel] [RFC qemu 0/4] A PV solution for live migration optimization

2016-03-10 Thread Roman Kagan
On Wed, Mar 09, 2016 at 07:39:18PM +0200, Michael S. Tsirkin wrote: > On Wed, Mar 09, 2016 at 08:04:39PM +0300, Roman Kagan wrote: > > On Wed, Mar 09, 2016 at 05:41:39PM +0200, Michael S. Tsirkin wrote: > > > On Wed, Mar 09, 2016 at 05:28:54PM +0300, Roman Kagan wrote: > &g

Re: [PATCH] x86/kvm/hyper-v: avoid spurious pending stimer on vCPU init

2019-03-18 Thread Roman Kagan
-by: Vitaly Kuznetsov > --- > arch/x86/kvm/hyperv.c | 9 +++-- > 1 file changed, 7 insertions(+), 2 deletions(-) Reviewed-by: Roman Kagan

[PATCH v2] x86/hyperv: make vapic support x2apic mode

2019-10-02 Thread Roman Kagan
is in use. Fixes: 29217a474683 ("iommu/hyper-v: Add Hyper-V stub IOMMU driver") Fixes: 6b48cb5f8347 ("X86/Hyper-V: Enlighten APIC access") Cc: sta...@vger.kernel.org Signed-off-by: Roman Kagan --- v1 -> v2: - add ifdefs to handle !CONFIG_X86_X2APIC

Re: [PATCH v2] x86/hyperv: make vapic support x2apic mode

2019-10-03 Thread Roman Kagan
On Thu, Oct 03, 2019 at 12:54:03PM +0200, Vitaly Kuznetsov wrote: > Roman Kagan writes: > > > Now that there's Hyper-V IOMMU driver, Linux can switch to x2apic mode > > when supported by the vcpus. > > > > However, the apic access functions for Hyper-V enlighte

[PATCH] x86/hyperv: make vapic support x2apic mode

2019-09-30 Thread Roman Kagan
is in use. Fixes: 29217a474683 ("iommu/hyper-v: Add Hyper-V stub IOMMU driver") Fixes: 6b48cb5f8347 ("X86/Hyper-V: Enlighten APIC access") Cc: sta...@vger.kernel.org Signed-off-by: Roman Kagan --- arch/x86/hyperv/hv_apic.c | 48 --- 1 fil

Re: [PATCH] x86/hyperv: make vapic support x2apic mode

2019-10-01 Thread Roman Kagan
On Tue, Oct 01, 2019 at 06:44:08AM +0800, kbuild test robot wrote: > url: > https://github.com/0day-ci/linux/commits/Roman-Kagan/x86-hyperv-make-vapic-support-x2apic-mode/20191001-044238 > config: x86_64-randconfig-e004-201939 (attached as .config) > compiler: gcc-7 (Debian 7.4

Re: [PATCH v3 15/16] kvm: x86: ioapic: Lazy update IOAPIC EOI

2019-10-09 Thread Roman Kagan
On Wed, Oct 09, 2019 at 11:21:41AM +0200, Paolo Bonzini wrote: > On 13/09/19 21:01, Suthikulpanit, Suravee wrote: > > /* > > +* In case APICv accelerate EOI write and do not trap, > > +* in-kernel IOAPIC will not be able to receive the EOI. > > +* In this case, we do lazy update of

[PATCH v3] x86/hyperv: make vapic support x2apic mode

2019-10-09 Thread Roman Kagan
y EOI when available; however, its implementation works for both xapic and x2apic modes. Fixes: 29217a474683 ("iommu/hyper-v: Add Hyper-V stub IOMMU driver") Fixes: 6b48cb5f8347 ("X86/Hyper-V: Enlighten APIC access") Cc: sta...@vger.kernel.org Suggested-by: Michael Kelley Signed-off

Re: [PATCH v2] x86/hyperv: make vapic support x2apic mode

2019-10-04 Thread Roman Kagan
On Fri, Oct 04, 2019 at 03:01:51AM +, Michael Kelley wrote: > From: Roman Kagan Sent: Thursday, October 3, 2019 5:53 > AM > > > > > > AFAIU you're trying to mirror native_x2apic_icr_write() here but this is > > > different from what hv_apic_icr_writ

Re: [RFC v2 0/2] kvm: Use host timekeeping in guest.

2019-10-10 Thread Roman Kagan
On Thu, Oct 10, 2019 at 04:30:53PM +0900, Suleiman Souhlal wrote: > This RFC is to try to solve the following problem: > > We have some applications that are currently running in their > own namespace, that still talk to other processes on the > machine, using IPC, and expect to run on the same ma

[PATCH v4] x86/hyperv: make vapic support x2apic mode

2019-10-10 Thread Roman Kagan
by: Vitaly Kuznetsov Reviewed-by: Michael Kelley Signed-off-by: Roman Kagan --- v3 -> v4: - adjust the log message [Vitaly, Michael] v2 -> v3: - do not introduce x2apic-capable hv_apic accessors; leave original x2apic accessors instead v1 -> v2: - add ifdefs to handle !CONFIG_X86_

Re: [PATCH 1/2] x86: kvm: avoid -Wsometimes-uninitized warning

2019-07-12 Thread Roman Kagan
On Fri, Jul 12, 2019 at 11:12:29AM +0200, Arnd Bergmann wrote: > clang points out that running a 64-bit guest on a 32-bit host > would lead to uninitialized variables: > > arch/x86/kvm/hyperv.c:1610:6: error: variable 'ingpa' is used uninitialized > whenever 'if' condition is false [-Werror,-Wsom

Re: [PATCH] [v2] x86: kvm: avoid -Wsometimes-uninitized warning

2019-07-12 Thread Roman Kagan
e compiler how the code is actually executed. > > Signed-off-by: Arnd Bergmann > --- > v2: make the change inside of is_64_bit_mode(). > --- > arch/x86/kvm/hyperv.c | 6 ++ > arch/x86/kvm/x86.h| 4 > 2 files changed, 6 insertions(+), 4 deletions(-) Reviewed-by:

Re: [PATCH] [v3] x86: kvm: avoid -Wsometimes-uninitized warning

2019-07-12 Thread Roman Kagan
p the condition around to avoid the conditional execution on i386. > > Signed-off-by: Arnd Bergmann > --- > v3: reword commit log, simplify patch again > v2: make the change inside of is_64_bit_mode(). > --- > arch/x86/kvm/hyperv.c | 20 +--- > 1 file changed, 9 insertions(+), 11 deletions(-) Reviewed-by: Roman Kagan

Re: [PATCH v4 RESEND 3/5] KVM: x86: hyperv: use get_vcpu_by_vpidx() in kvm_hv_flush_tlb()

2018-09-25 Thread Roman Kagan
On Mon, Sep 24, 2018 at 06:55:28PM +0200, Paolo Bonzini wrote: > On 24/09/2018 18:24, Paolo Bonzini wrote: > > Hi Paolo, > > > > could you please clarify what needs to be done to get this merged? In > > particular, are you OK with my comment above or do we need to do > > something with it (e.g. ge

Re: [PATCH v4 RESEND 3/5] KVM: x86: hyperv: use get_vcpu_by_vpidx() in kvm_hv_flush_tlb()

2018-09-25 Thread Roman Kagan
On Tue, Sep 25, 2018 at 11:29:57AM +0200, Paolo Bonzini wrote: > On 25/09/2018 10:57, Roman Kagan wrote: > > If we can assume that in all relevant cases vp_index coincides with the > > cpu index (which I think we can) then Vitaly's approach is the most > > efficient. &g

Re: [PATCH v6 4/7] KVM: x86: hyperv: keep track of mismatched VP indexes

2018-10-01 Thread Roman Kagan
On Mon, Oct 01, 2018 at 05:48:54PM +0200, Paolo Bonzini wrote: > On 27/09/2018 11:17, Vitaly Kuznetsov wrote: > > Roman Kagan writes: > > > >> On Wed, Sep 26, 2018 at 07:02:56PM +0200, Vitaly Kuznetsov wrote: > >>> In most common cases VP index of a vc

Re: [PATCH v6 4/7] KVM: x86: hyperv: keep track of mismatched VP indexes

2018-10-01 Thread Roman Kagan
On Mon, Oct 01, 2018 at 03:54:26PM +, Roman Kagan wrote: > On Mon, Oct 01, 2018 at 05:48:54PM +0200, Paolo Bonzini wrote: > > On 27/09/2018 11:17, Vitaly Kuznetsov wrote: > > > Roman Kagan writes: > > > > > >> On Wed, Sep 26, 2018 at 07:02:56PM +0200,

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

2018-05-18 Thread Roman Kagan
to remove an id >= 64. > > > > Fixes: 0a835c4f090a ("Reimplement IDR and IDA using the radix tree") > > Reported-by: syzbot+35666cba7f0a337e2...@syzkaller.appspotmail.com > > Debugged-by: Roman Kagan > > Signed-off-by: Matthew Wilcox > > Neither of the cha

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

2018-05-10 Thread Roman Kagan
x27;t have 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 Signe

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

2018-05-10 Thread Roman Kagan
On Fri, May 11, 2018 at 07:40:26AM +0200, Dmitry Vyukov wrote: > On Fri, May 11, 2018 at 1:54 AM, Paolo Bonzini wrote: > > On 10/05/2018 21:16, Roman Kagan wrote: > >> If an IDR contains a single entry at index==0, the underlying radix tree > >> has a single item in i

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 dashbo

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: [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

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

[PATCH] x86:pvclock: add missing barriers

2016-06-08 Thread Roman Kagan
t more compact by removing unnecessary local variables. Signed-off-by: Roman Kagan Cc: Thomas Gleixner Cc: Ingo Molnar Cc: "H. Peter Anvin" Cc: x...@kernel.org Cc: Andy Lutomirski Cc: Borislav Petkov Cc: Paolo Bonzini Cc: sta...@vger.kernel.org --- arch/x86/include/asm/pvclock.

Re: [PATCH] x86:pvclock: add missing barriers

2016-06-08 Thread Roman Kagan
On Wed, Jun 08, 2016 at 09:45:09PM +0200, Borislav Petkov wrote: > On Wed, Jun 08, 2016 at 09:11:39PM +0300, Roman Kagan wrote: > > Gradual removal of excessive barriers in pvclock reading functions > > (commits 502dfeff239e8313bfbe906ca0a1a6827ac8481b, > > a3eb97bd80134ba0786

Re: [PATCH] x86:pvclock: add missing barriers

2016-06-09 Thread Roman Kagan
On Thu, Jun 09, 2016 at 12:01:13AM +0300, Roman Kagan wrote: > On Wed, Jun 08, 2016 at 09:45:09PM +0200, Borislav Petkov wrote: > > On Wed, Jun 08, 2016 at 09:11:39PM +0300, Roman Kagan wrote: > > > --- a/arch/x86/include/asm/pvclock.h > > > +++ b/arch/x86/include/as

Re: [PATCH] pvclock: introduce seqcount-like API

2016-06-09 Thread Roman Kagan
't in Linus' tree yet so I wonder if it makes sense to merge the two patches into one. Will you post it to stable, too? Anyway Reviewed-by: Roman Kagan Roman.

Re: [PATCH] pvclock: introduce seqcount-like API

2016-06-09 Thread Roman Kagan
On Thu, Jun 09, 2016 at 02:47:54PM +0200, Paolo Bonzini wrote: > On 09/06/2016 14:43, Roman Kagan wrote: > > On Thu, Jun 09, 2016 at 01:23:23PM +0200, Paolo Bonzini wrote: > >> The version field in struct pvclock_vcpu_time_info basically implements > >> a seqcou

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.

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

2016-12-20 Thread Roman Kagan
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: consol

[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 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 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 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 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 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

  1   2   >