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

2022-09-29 Thread Roman Kagan
ch 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 +++ b/drivers/n

[tip: x86/urgent] x86/hyperv: Make vapic support x2apic mode

2019-10-15 Thread tip-bot2 for Roman Kagan
The following commit has been merged into the x86/urgent branch of tip: Commit-ID: e211288b72f15259da86eed6eca680758dbe9e74 Gitweb: https://git.kernel.org/tip/e211288b72f15259da86eed6eca680758dbe9e74 Author:Roman Kagan AuthorDate:Thu, 10 Oct 2019 12:33:05 Committer

[tip: x86/urgent] x86/hyperv: Make vapic support x2apic mode

2019-10-15 Thread tip-bot2 for Roman Kagan
The following commit has been merged into the x86/urgent branch of tip: Commit-ID: e211288b72f15259da86eed6eca680758dbe9e74 Gitweb: https://git.kernel.org/tip/e211288b72f15259da86eed6eca680758dbe9e74 Author:Roman Kagan AuthorDate:Thu, 10 Oct 2019 12:33:05 Committer

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

2019-10-10 Thread Roman Kagan
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_X2APIC a

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

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

2019-10-09 Thread Roman Kagan
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-by: Roman

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

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_write() d

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 enlightened a

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

2019-10-02 Thread Roman Kagan
. 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 arch/x8

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

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

2019-09-30 Thread Roman Kagan
. 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 file changed,

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

2019-07-12 Thread Roman Kagan
gned-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] [v2] x86: kvm: avoid -Wsometimes-uninitized warning

2019-07-12 Thread Roman Kagan
gmann > --- > 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: Roman Kagan However I still think the log message could state it more explicit

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

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

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

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

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

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

2018-12-10 Thread Roman Kagan
q in 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 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 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

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

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

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 > >> structure fields

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 > >> structure fields

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 >

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 >

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

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

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

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 direction

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
c | 12 +++- > 1 file changed, 3 insertions(+), 9 deletions(-) Reviewed-by: Roman Kagan

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
c | 12 +++- > 1 file changed, 3 insertions(+), 9 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

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

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

2018-11-27 Thread Roman Kagan
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
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 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 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 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 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 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 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 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

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

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 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 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 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 4/7] KVM: x86: hyperv: keep track of mismatched VP indexes

2018-09-27 Thread Roman Kagan
> + */ > + if (hv_vcpu->vp_index == vcpu_idx) > + atomic_inc(>num_mismatched_vp_indexes); > + else if (new_vp_index == vcpu_idx) > + atomic_dec(>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 4/7] KVM: x86: hyperv: keep track of mismatched VP indexes

2018-09-27 Thread Roman Kagan
> + */ > + if (hv_vcpu->vp_index == vcpu_idx) > + atomic_inc(>num_mismatched_vp_indexes); > + else if (new_vp_index == vcpu_idx) > + atomic_dec(>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 3/7] KVM: x86: hyperv: consistently use 'hv_vcpu' for 'struct kvm_vcpu_hv' variables

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

Re: [PATCH v6 3/7] KVM: x86: hyperv: consistently use 'hv_vcpu' for 'struct kvm_vcpu_hv' variables

2018-09-27 Thread Roman Kagan
- > 1 file changed, 9 insertions(+), 9 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 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 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 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.

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.

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

2018-08-28 Thread Roman Kagan
/* Unknown vCPU specified */ > + if (!vcpu) > + continue; > + > + /* We fail only when APIC is disabled */ > + kvm_apic_set_irq(vcpu, , 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 v5 5/5] KVM: x86: hyperv: implement PV IPI send hypercalls

2018-08-28 Thread Roman Kagan
/* Unknown vCPU specified */ > + if (!vcpu) > + continue; > + > + /* We fail only when APIC is disabled */ > + kvm_apic_set_irq(vcpu, , 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

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

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

2018-07-09 Thread Roman Kagan
gt; arch/x86/include/asm/hyperv-tlfs.h | 16 +--- > 2 files changed, 15 insertions(+), 13 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
gt; arch/x86/include/asm/hyperv-tlfs.h | 16 +--- > 2 files changed, 15 insertions(+), 13 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 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 2/5] KVM: x86: hyperv: optimize 'all cpus' case in kvm_hv_flush_tlb()

2018-07-09 Thread Roman Kagan
; 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 2/5] KVM: x86: hyperv: optimize 'all cpus' case in kvm_hv_flush_tlb()

2018-07-09 Thread Roman Kagan
; 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 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 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 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 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 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 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 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 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 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

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

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 through t

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 through t

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

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 >

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

2018-05-19 Thread Roman Kagan
attempting 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 <rka...@virtuozzo.com> > > Signed-

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

2018-05-19 Thread Roman Kagan
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 changelogs I'

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 to re

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 to re

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

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 ".

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 <pbonz...@redhat.com> wrote: > > On 10/05/2018 21:16, Roman Kagan wrote: > >> If an IDR contains a single entry at index==0, the underlying radix tree > >&

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

  1   2   3   >