Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1312814 > unrolled thread

[PATCH v3 1/4] KVM: Recover IRTE to remapped mode if the interrupt is not single-destination

Started byFeng Wu <feng.wu@intel.com>
First post2016-01-20 03:10 +0100
Last post2016-01-25 13:30 +0100
Articles 9 on this page of 29 — 8 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH v3 1/4] KVM: Recover IRTE to remapped mode if the interrupt is not single-destination Feng Wu <feng.wu@intel.com> - 2016-01-20 03:10 +0100
    Re: [PATCH v3 1/4] KVM: Recover IRTE to remapped mode if the  interrupt is not single-destination Yang Zhang <yang.zhang.wz@gmail.com> - 2016-01-21 04:10 +0100
      RE: [PATCH v3 1/4] KVM: Recover IRTE to remapped mode if the  interrupt is not single-destination "Wu, Feng" <feng.wu@intel.com> - 2016-01-21 04:20 +0100
        Re: [PATCH v3 1/4] KVM: Recover IRTE to remapped mode if the  interrupt is not single-destination Yang Zhang <yang.zhang.wz@gmail.com> - 2016-01-21 04:40 +0100
          RE: [PATCH v3 1/4] KVM: Recover IRTE to remapped mode if the  interrupt is not single-destination "Wu, Feng" <feng.wu@intel.com> - 2016-01-21 05:50 +0100
            RE: [PATCH v3 1/4] KVM: Recover IRTE to remapped mode if the  interrupt is not single-destination "Tian, Kevin" <kevin.tian@intel.com> - 2016-01-21 06:00 +0100
            Re: [PATCH v3 1/4] KVM: Recover IRTE to remapped mode if the  interrupt is not single-destination Yang Zhang <yang.zhang.wz@gmail.com> - 2016-01-21 06:00 +0100
              RE: [PATCH v3 1/4] KVM: Recover IRTE to remapped mode if the  interrupt is not single-destination "Wu, Feng" <feng.wu@intel.com> - 2016-01-21 06:10 +0100
                Re: [PATCH v3 1/4] KVM: Recover IRTE to remapped mode if the  interrupt is not single-destination Yang Zhang <yang.zhang.wz@gmail.com> - 2016-01-21 06:40 +0100
                  Re: [PATCH v3 1/4] KVM: Recover IRTE to remapped mode if the  interrupt is not single-destination Yang Zhang <yang.zhang.wz@gmail.com> - 2016-01-21 06:50 +0100
                    Re: [PATCH v3 1/4] KVM: Recover IRTE to remapped mode if the  interrupt is not single-destination "rkrcmar@redhat.com" <rkrcmar@redhat.com> - 2016-01-21 17:40 +0100
                      Re: [PATCH v3 1/4] KVM: Recover IRTE to remapped mode if the  interrupt is not single-destination Yang Zhang <yang.zhang.wz@gmail.com> - 2016-01-22 03:10 +0100
                        Re: [PATCH v3 1/4] KVM: Recover IRTE to remapped mode if the  interrupt is not single-destination "rkrcmar@redhat.com" <rkrcmar@redhat.com> - 2016-01-22 14:40 +0100
                          Re: [PATCH v3 1/4] KVM: Recover IRTE to remapped mode if the  interrupt is not single-destination Yang Zhang <yang.zhang.wz@gmail.com> - 2016-01-25 03:00 +0100
                            Re: [PATCH v3 1/4] KVM: Recover IRTE to remapped mode if the  interrupt is not single-destination "rkrcmar@redhat.com" <rkrcmar@redhat.com> - 2016-01-25 15:00 +0100
                              Re: [PATCH v3 1/4] KVM: Recover IRTE to remapped mode if the  interrupt is not single-destination Yang Zhang <yang.zhang.wz@gmail.com> - 2016-01-26 02:50 +0100
                                Re: [PATCH v3 1/4] KVM: Recover IRTE to remapped mode if the  interrupt is not single-destination "rkrcmar@redhat.com" <rkrcmar@redhat.com> - 2016-01-26 19:30 +0100
                                  Re: [PATCH v3 1/4] KVM: Recover IRTE to remapped mode if the  interrupt is not single-destination Yang Zhang <yang.zhang.wz@gmail.com> - 2016-01-27 03:10 +0100
                                    Re: [PATCH v3 1/4] KVM: Recover IRTE to remapped mode if the  interrupt is not single-destination "rkrcmar@redhat.com" <rkrcmar@redhat.com> - 2016-01-27 16:10 +0100
                  RE: [PATCH v3 1/4] KVM: Recover IRTE to remapped mode if the  interrupt is not single-destination "Wu, Feng" <feng.wu@intel.com> - 2016-01-21 06:50 +0100
    Re: [PATCH v3 1/4] KVM: Recover IRTE to remapped mode if the  interrupt is not single-destination Radim Krčmář <rkrcmar@redhat.com> - 2016-01-21 17:30 +0100
      RE: [PATCH v3 1/4] KVM: Recover IRTE to remapped mode if the  interrupt is not single-destination "Wu, Feng" <feng.wu@intel.com> - 2016-01-22 02:50 +0100
        Re: [PATCH v3 1/4] KVM: Recover IRTE to remapped mode if the  interrupt is not single-destination Radim Krcmár <rkrcmar@redhat.com> - 2016-01-22 14:10 +0100
          RE: [PATCH v3 1/4] KVM: Recover IRTE to remapped mode if the  interrupt is not single-destination "Wu, Feng" <feng.wu@intel.com> - 2016-01-25 13:30 +0100
            Re: [PATCH v3 1/4] KVM: Recover IRTE to remapped mode if the  interrupt is not single-destination Paolo Bonzini <pbonzini@redhat.com> - 2016-01-25 13:40 +0100
              RE: [PATCH v3 1/4] KVM: Recover IRTE to remapped mode if the  interrupt is not single-destination "Wu, Feng" <feng.wu@intel.com> - 2016-01-25 13:50 +0100
            Re: [PATCH v3 1/4] KVM: Recover IRTE to remapped mode if the  interrupt is not single-destination Radim Krcmár <rkrcmar@redhat.com> - 2016-01-25 15:10 +0100
              RE: [PATCH v3 1/4] KVM: Recover IRTE to remapped mode if the  interrupt is not single-destination "Wu, Feng" <feng.wu@intel.com> - 2016-01-26 02:00 +0100
          Re: [PATCH v3 1/4] KVM: Recover IRTE to remapped mode if the  interrupt is not single-destination Paolo Bonzini <pbonzini@redhat.com> - 2016-01-25 13:30 +0100

Page 2 of 2 — ← Prev page 1 [2]


#1314330 — Re: [PATCH v3 1/4] KVM: Recover IRTE to remapped mode if the interrupt is not single-destination

FromRadim Krčmář <rkrcmar@redhat.com>
Date2016-01-21 17:30 +0100
SubjectRe: [PATCH v3 1/4] KVM: Recover IRTE to remapped mode if the interrupt is not single-destination
Message-ID<qTqhs-7Nb-11@gated-at.bofh.it>
In reply to#1312814
2016-01-20 09:42+0800, Feng Wu:
> When the interrupt is not single destination any more, we need
> to change back IRTE to remapped mode explicitly.
> 
> Signed-off-by: Feng Wu <feng.wu@intel.com>
> ---
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> @@ -10764,8 +10764,17 @@ static int vmx_update_pi_irte(struct kvm *kvm, unsigned int host_irq,
> -		if (!kvm_intr_is_single_vcpu(kvm, &irq, &vcpu))
> +		if (!kvm_intr_is_single_vcpu(kvm, &irq, &vcpu)) {
> +			/*
> +			 * Make sure the IRTE is in remapped mode if
> +			 * we don't handle it in posted mode.
> +			 */
> +			pi_set_sn(vcpu_to_pi_desc(vcpu));

What could go wrong if we didn't suppress notifications here?

Thanks.

> +			ret = irq_set_vcpu_affinity(host_irq, NULL);
> +			pi_clear_sn(vcpu_to_pi_desc(vcpu));
> +
>  			continue;
> +		}

[toc] | [prev] | [next] | [standalone]


#1314692 — RE: [PATCH v3 1/4] KVM: Recover IRTE to remapped mode if the interrupt is not single-destination

From"Wu, Feng" <feng.wu@intel.com>
Date2016-01-22 02:50 +0100
SubjectRE: [PATCH v3 1/4] KVM: Recover IRTE to remapped mode if the interrupt is not single-destination
Message-ID<qTz1o-5gH-7@gated-at.bofh.it>
In reply to#1314330

> -----Original Message-----
> From: Radim Krčmář [mailto:rkrcmar@redhat.com]
> Sent: Friday, January 22, 2016 12:20 AM
> To: Wu, Feng <feng.wu@intel.com>
> Cc: pbonzini@redhat.com; linux-kernel@vger.kernel.org;
> kvm@vger.kernel.org
> Subject: Re: [PATCH v3 1/4] KVM: Recover IRTE to remapped mode if the
> interrupt is not single-destination
> 
> 2016-01-20 09:42+0800, Feng Wu:
> > When the interrupt is not single destination any more, we need
> > to change back IRTE to remapped mode explicitly.
> >
> > Signed-off-by: Feng Wu <feng.wu@intel.com>
> > ---
> > diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> > @@ -10764,8 +10764,17 @@ static int vmx_update_pi_irte(struct kvm
> *kvm, unsigned int host_irq,
> > -		if (!kvm_intr_is_single_vcpu(kvm, &irq, &vcpu))
> > +		if (!kvm_intr_is_single_vcpu(kvm, &irq, &vcpu)) {
> > +			/*
> > +			 * Make sure the IRTE is in remapped mode if
> > +			 * we don't handle it in posted mode.
> > +			 */
> > +			pi_set_sn(vcpu_to_pi_desc(vcpu));
> 
> What could go wrong if we didn't suppress notifications here?

This is a good question. I also thought about this before, but after
thinking it a bit more, seems we don't need to do this. 
If we don't do this, the in-flight interrupts will continue to be
delivered in PI mode while we are changing it to remapped
mode in IRTE. Even if we do this, the in-flight interrupts are
also delivered in PI mode before setting 'SN' anyway, so seems
we really don't need this, what is your opinion?

Thanks,
Feng

Thanks,
Feng

> 
> Thanks.
> 
> > +			ret = irq_set_vcpu_affinity(host_irq, NULL);
> > +			pi_clear_sn(vcpu_to_pi_desc(vcpu));
> > +
> >  			continue;
> > +		}

[toc] | [prev] | [next] | [standalone]


#1314969 — Re: [PATCH v3 1/4] KVM: Recover IRTE to remapped mode if the interrupt is not single-destination

FromRadim Krcmár <rkrcmar@redhat.com>
Date2016-01-22 14:10 +0100
SubjectRe: [PATCH v3 1/4] KVM: Recover IRTE to remapped mode if the interrupt is not single-destination
Message-ID<qTJDs-4tt-11@gated-at.bofh.it>
In reply to#1314692
2016-01-22 01:49+0000, Wu, Feng:
>> From: Radim Krčmář [mailto:rkrcmar@redhat.com]
>> 2016-01-20 09:42+0800, Feng Wu:
>> > -		if (!kvm_intr_is_single_vcpu(kvm, &irq, &vcpu))
>> > +		if (!kvm_intr_is_single_vcpu(kvm, &irq, &vcpu)) {
>> > +			/*
>> > +			 * Make sure the IRTE is in remapped mode if
>> > +			 * we don't handle it in posted mode.
>> > +			 */
>> > +			pi_set_sn(vcpu_to_pi_desc(vcpu));
>> 
>> What could go wrong if we didn't suppress notifications here?
> 
> This is a good question. I also thought about this before, but after
> thinking it a bit more, seems we don't need to do this. 
> If we don't do this, the in-flight interrupts will continue to be
> delivered in PI mode while we are changing it to remapped
> mode in IRTE. Even if we do this, the in-flight interrupts are
> also delivered in PI mode before setting 'SN' anyway, so seems
> we really don't need this, what is your opinion?

I'd remove it.

[toc] | [prev] | [next] | [standalone]


#1316619 — RE: [PATCH v3 1/4] KVM: Recover IRTE to remapped mode if the interrupt is not single-destination

From"Wu, Feng" <feng.wu@intel.com>
Date2016-01-25 13:30 +0100
SubjectRE: [PATCH v3 1/4] KVM: Recover IRTE to remapped mode if the interrupt is not single-destination
Message-ID<qUOro-3Og-21@gated-at.bofh.it>
In reply to#1314969

> -----Original Message-----
> From: Paolo Bonzini [mailto:paolo.bonzini@gmail.com] On Behalf Of Paolo
> Bonzini
> Sent: Monday, January 25, 2016 8:23 PM
> To: Radim Krcmár <rkrcmar@redhat.com>; Wu, Feng <feng.wu@intel.com>
> Cc: linux-kernel@vger.kernel.org; kvm@vger.kernel.org
> Subject: Re: [PATCH v3 1/4] KVM: Recover IRTE to remapped mode if the
> interrupt is not single-destination
> 
> 
> 
> On 22/01/2016 14:05, Radim Krcmár wrote:
> > > This is a good question. I also thought about this before, but after
> > > thinking it a bit more, seems we don't need to do this.
> > > If we don't do this, the in-flight interrupts will continue to be
> > > delivered in PI mode while we are changing it to remapped
> > > mode in IRTE. Even if we do this, the in-flight interrupts are
> > > also delivered in PI mode before setting 'SN' anyway, so seems
> > > we really don't need this, what is your opinion?
> > I'd remove it.
> 
> It may be necessary because IRTE writes (128 bits) are not atomic.

IRTE is updated atomically, I added the patch to support this. Please
refer to 344cb4e0b6f3a0dbef0643eacb4946338eb228c0.

Thanks,
Feng

> 
> If so, no need to send v5, I'll add it back.
> 
> Paolo

[toc] | [prev] | [next] | [standalone]


#1316630 — Re: [PATCH v3 1/4] KVM: Recover IRTE to remapped mode if the interrupt is not single-destination

FromPaolo Bonzini <pbonzini@redhat.com>
Date2016-01-25 13:40 +0100
SubjectRe: [PATCH v3 1/4] KVM: Recover IRTE to remapped mode if the interrupt is not single-destination
Message-ID<qUOB3-3Tm-5@gated-at.bofh.it>
In reply to#1316619

On 25/01/2016 13:26, Wu, Feng wrote:
>> > It may be necessary because IRTE writes (128 bits) are not atomic.
> IRTE is updated atomically, I added the patch to support this. Please
> refer to 344cb4e0b6f3a0dbef0643eacb4946338eb228c0.

Great, I hadn't noticed that patch.  Thanks.

Paolo

[toc] | [prev] | [next] | [standalone]


#1316661 — RE: [PATCH v3 1/4] KVM: Recover IRTE to remapped mode if the interrupt is not single-destination

From"Wu, Feng" <feng.wu@intel.com>
Date2016-01-25 13:50 +0100
SubjectRE: [PATCH v3 1/4] KVM: Recover IRTE to remapped mode if the interrupt is not single-destination
Message-ID<qUOKM-3WU-51@gated-at.bofh.it>
In reply to#1316630

> -----Original Message-----
> From: Paolo Bonzini [mailto:pbonzini@redhat.com]
> Sent: Monday, January 25, 2016 8:39 PM
> To: Wu, Feng <feng.wu@intel.com>; Radim Krcmár <rkrcmar@redhat.com>
> Cc: linux-kernel@vger.kernel.org; kvm@vger.kernel.org
> Subject: Re: [PATCH v3 1/4] KVM: Recover IRTE to remapped mode if the
> interrupt is not single-destination
> 
> 
> 
> On 25/01/2016 13:26, Wu, Feng wrote:
> >> > It may be necessary because IRTE writes (128 bits) are not atomic.
> > IRTE is updated atomically, I added the patch to support this. Please
> > refer to 344cb4e0b6f3a0dbef0643eacb4946338eb228c0.
> 
> Great, I hadn't noticed that patch.  Thanks.

I might forget to cc KVM mailing list, sorry for that!

Thanks,
Feng

> 
> Paolo

[toc] | [prev] | [next] | [standalone]


#1316729 — Re: [PATCH v3 1/4] KVM: Recover IRTE to remapped mode if the interrupt is not single-destination

FromRadim Krcmár <rkrcmar@redhat.com>
Date2016-01-25 15:10 +0100
SubjectRe: [PATCH v3 1/4] KVM: Recover IRTE to remapped mode if the interrupt is not single-destination
Message-ID<qUQ09-54G-9@gated-at.bofh.it>
In reply to#1316619
2016-01-25 12:26+0000, Wu, Feng:
>> From: Paolo Bonzini [mailto:paolo.bonzini@gmail.com] On Behalf Of Paolo
>> It may be necessary because IRTE writes (128 bits) are not atomic.
> 
> IRTE is updated atomically, I added the patch to support this. Please
> refer to 344cb4e0b6f3a0dbef0643eacb4946338eb228c0.

I also think that SN bit is not affected by atomicity: if the IRTE could
have been read half-updated while changing from posted to non-posted,
then it wouldn't point to the correct PID, because its address is not
within 64 bits, so the SN bit wouldn't matter.

IRTE invalidation seems important in VT-d ...

[toc] | [prev] | [next] | [standalone]


#1317437 — RE: [PATCH v3 1/4] KVM: Recover IRTE to remapped mode if the interrupt is not single-destination

From"Wu, Feng" <feng.wu@intel.com>
Date2016-01-26 02:00 +0100
SubjectRE: [PATCH v3 1/4] KVM: Recover IRTE to remapped mode if the interrupt is not single-destination
Message-ID<qV09c-3JU-9@gated-at.bofh.it>
In reply to#1316729

> -----Original Message-----
> From: Radim Krcmár [mailto:rkrcmar@redhat.com]
> Sent: Monday, January 25, 2016 10:06 PM
> To: Wu, Feng <feng.wu@intel.com>
> Cc: Paolo Bonzini <pbonzini@redhat.com>; linux-kernel@vger.kernel.org;
> kvm@vger.kernel.org
> Subject: Re: [PATCH v3 1/4] KVM: Recover IRTE to remapped mode if the
> interrupt is not single-destination
> 
> 2016-01-25 12:26+0000, Wu, Feng:
> >> From: Paolo Bonzini [mailto:paolo.bonzini@gmail.com] On Behalf Of Paolo
> >> It may be necessary because IRTE writes (128 bits) are not atomic.
> >
> > IRTE is updated atomically, I added the patch to support this. Please
> > refer to 344cb4e0b6f3a0dbef0643eacb4946338eb228c0.
> 
> I also think that SN bit is not affected by atomicity: if the IRTE could
> have been read half-updated while changing from posted to non-posted,
> then it wouldn't point to the correct PID, because its address is not
> within 64 bits, so the SN bit wouldn't matter.

Yes, like the comments in the commit, we should atomically update the
IRTE in PI case (PI -> non-PI, non-PI -> PI), without which, it cannot
guarantee the correctness, since 'pda' is not within 64 bits, like Radim
pointed out above.

Thanks,
Feng

> 
> IRTE invalidation seems important in VT-d ...

[toc] | [prev] | [next] | [standalone]


#1316621 — Re: [PATCH v3 1/4] KVM: Recover IRTE to remapped mode if the interrupt is not single-destination

FromPaolo Bonzini <pbonzini@redhat.com>
Date2016-01-25 13:30 +0100
SubjectRe: [PATCH v3 1/4] KVM: Recover IRTE to remapped mode if the interrupt is not single-destination
Message-ID<qUOro-3Og-23@gated-at.bofh.it>
In reply to#1314969

On 22/01/2016 14:05, Radim Krcmár wrote:
> > This is a good question. I also thought about this before, but after
> > thinking it a bit more, seems we don't need to do this. 
> > If we don't do this, the in-flight interrupts will continue to be
> > delivered in PI mode while we are changing it to remapped
> > mode in IRTE. Even if we do this, the in-flight interrupts are
> > also delivered in PI mode before setting 'SN' anyway, so seems
> > we really don't need this, what is your opinion?
> I'd remove it.

It may be necessary because IRTE writes (128 bits) are not atomic.

If so, no need to send v5, I'll add it back.

Paolo

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | linux.kernel


csiph-web