All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Denis V. Lunev" <den@openvz.org>
To: Paolo Bonzini <pbonzini@redhat.com>,
	Andrey Smetanin <asmetanin@virtuozzo.com>,
	kvm@vger.kernel.org
Cc: Gleb Natapov <gleb@kernel.org>,
	qemu-devel@nongnu.org, virtualization@lists.linux-foundation.org,
	Roman Kagan <rkagan@virtuozzo.com>,
	Vitaly Kuznetsov <vkuznets@redhat.com>
Subject: Re: [kvm-unit-tests PATCH] x86: hyperv_synic: Hyper-V SynIC test
Date: Mon, 2 Nov 2015 15:18:12 +0300	[thread overview]
Message-ID: <56375484.1000206@openvz.org> (raw)
In-Reply-To: <56375402.7060406@redhat.com>

On 11/02/2015 03:16 PM, Paolo Bonzini wrote:
> On 26/10/2015 10:56, Andrey Smetanin wrote:
>> Hyper-V SynIC is a Hyper-V synthetic interrupt controller.
>>
>> The test runs on every vCPU and performs the following steps:
>> * read from all Hyper-V SynIC MSR's
>> * setup Hyper-V SynIC evt/msg pages
>> * setup SINT's routing
>> * inject SINT's into destination vCPU by 'hyperv-synic-test-device'
>> * wait for SINT's isr's completion
>> * clear Hyper-V SynIC evt/msg pages and destroy SINT's routing
>>
>> Signed-off-by: Andrey Smetanin <asmetanin@virtuozzo.com>
>> Reviewed-by: Roman Kagan <rkagan@virtuozzo.com>
>> Signed-off-by: Denis V. Lunev <den@openvz.org>
>> CC: Vitaly Kuznetsov <vkuznets@redhat.com>
>> CC: "K. Y. Srinivasan" <kys@microsoft.com>
>> CC: Gleb Natapov <gleb@kernel.org>
>> CC: Paolo Bonzini <pbonzini@redhat.com>
>> CC: Roman Kagan <rkagan@virtuozzo.com>
>> CC: Denis V. Lunev <den@openvz.org>
>> CC: qemu-devel@nongnu.org
>> CC: virtualization@lists.linux-foundation.org
> Bad news.
>
> The test breaks with APICv, because of the following sequence of events:
>
> 1) non-auto-EOI interrupt 176 is injected into IRR and ISR
>
> 2) The PPR register is now 176
>
> 3) auto-EOI interrupt 179 is injected into IRR only, because (179 &
> 0xf0) <= (PPR & 0xf0)
>
> 4) interrupt 176 ISR performs an EOI
>
> 5) at this point, because virtual interrupt delivery is enabled, the
> processor does not perform TPR virtualization (SDM 29.1.2).
>
> In addition (and even worse) because virtual interrupt delivery is
> enabled, an auto-EOI interrupt that was stashed in IRR can be injected
> by the processor, and the auto-EOI behavior will be skipped.
>
> The solution is to have userspace enable KVM_CAP_HYPERV_SYNIC through
> KVM_ENABLE_CAP, and modify vmx.c to not use apicv on VMs that have it
> enabled.  This requires some changes to the callbacks that only work if
> enable_apicv or !enable_apicv:
>
>         if (enable_apicv)
>                 kvm_x86_ops->update_cr8_intercept = NULL;
>         else {
>                 kvm_x86_ops->hwapic_irr_update = NULL;
>                 kvm_x86_ops->hwapic_isr_update = NULL;
>                 kvm_x86_ops->deliver_posted_interrupt = NULL;
>                 kvm_x86_ops->sync_pir_to_irr = vmx_sync_pir_to_irr_dummy;
>         }
>
> The question then is... does Hyper-V actually use auto-EOI interrupts?
> If it doesn't, we might as well not implement them... :/
>
> I'm keeping the kernel patches queued for my own testing, but this of
> course has to be fixed before including them---which will delay this
> feature to 4.5, unfortunately.
>
> Paolo

well, the problem is that it actually uses auto EOI....

Den

WARNING: multiple messages have this Message-ID (diff)
From: "Denis V. Lunev" <den@openvz.org>
To: Paolo Bonzini <pbonzini@redhat.com>,
	Andrey Smetanin <asmetanin@virtuozzo.com>, <kvm@vger.kernel.org>
Cc: Gleb Natapov <gleb@kernel.org>,
	qemu-devel@nongnu.org, virtualization@lists.linux-foundation.org,
	Roman Kagan <rkagan@virtuozzo.com>,
	Vitaly Kuznetsov <vkuznets@redhat.com>
Subject: Re: [kvm-unit-tests PATCH] x86: hyperv_synic: Hyper-V SynIC test
Date: Mon, 2 Nov 2015 15:18:12 +0300	[thread overview]
Message-ID: <56375484.1000206@openvz.org> (raw)
In-Reply-To: <56375402.7060406@redhat.com>

On 11/02/2015 03:16 PM, Paolo Bonzini wrote:
> On 26/10/2015 10:56, Andrey Smetanin wrote:
>> Hyper-V SynIC is a Hyper-V synthetic interrupt controller.
>>
>> The test runs on every vCPU and performs the following steps:
>> * read from all Hyper-V SynIC MSR's
>> * setup Hyper-V SynIC evt/msg pages
>> * setup SINT's routing
>> * inject SINT's into destination vCPU by 'hyperv-synic-test-device'
>> * wait for SINT's isr's completion
>> * clear Hyper-V SynIC evt/msg pages and destroy SINT's routing
>>
>> Signed-off-by: Andrey Smetanin <asmetanin@virtuozzo.com>
>> Reviewed-by: Roman Kagan <rkagan@virtuozzo.com>
>> Signed-off-by: Denis V. Lunev <den@openvz.org>
>> CC: Vitaly Kuznetsov <vkuznets@redhat.com>
>> CC: "K. Y. Srinivasan" <kys@microsoft.com>
>> CC: Gleb Natapov <gleb@kernel.org>
>> CC: Paolo Bonzini <pbonzini@redhat.com>
>> CC: Roman Kagan <rkagan@virtuozzo.com>
>> CC: Denis V. Lunev <den@openvz.org>
>> CC: qemu-devel@nongnu.org
>> CC: virtualization@lists.linux-foundation.org
> Bad news.
>
> The test breaks with APICv, because of the following sequence of events:
>
> 1) non-auto-EOI interrupt 176 is injected into IRR and ISR
>
> 2) The PPR register is now 176
>
> 3) auto-EOI interrupt 179 is injected into IRR only, because (179 &
> 0xf0) <= (PPR & 0xf0)
>
> 4) interrupt 176 ISR performs an EOI
>
> 5) at this point, because virtual interrupt delivery is enabled, the
> processor does not perform TPR virtualization (SDM 29.1.2).
>
> In addition (and even worse) because virtual interrupt delivery is
> enabled, an auto-EOI interrupt that was stashed in IRR can be injected
> by the processor, and the auto-EOI behavior will be skipped.
>
> The solution is to have userspace enable KVM_CAP_HYPERV_SYNIC through
> KVM_ENABLE_CAP, and modify vmx.c to not use apicv on VMs that have it
> enabled.  This requires some changes to the callbacks that only work if
> enable_apicv or !enable_apicv:
>
>         if (enable_apicv)
>                 kvm_x86_ops->update_cr8_intercept = NULL;
>         else {
>                 kvm_x86_ops->hwapic_irr_update = NULL;
>                 kvm_x86_ops->hwapic_isr_update = NULL;
>                 kvm_x86_ops->deliver_posted_interrupt = NULL;
>                 kvm_x86_ops->sync_pir_to_irr = vmx_sync_pir_to_irr_dummy;
>         }
>
> The question then is... does Hyper-V actually use auto-EOI interrupts?
> If it doesn't, we might as well not implement them... :/
>
> I'm keeping the kernel patches queued for my own testing, but this of
> course has to be fixed before including them---which will delay this
> feature to 4.5, unfortunately.
>
> Paolo

well, the problem is that it actually uses auto EOI....

Den

WARNING: multiple messages have this Message-ID (diff)
From: "Denis V. Lunev" <den@openvz.org>
To: Paolo Bonzini <pbonzini@redhat.com>,
	Andrey Smetanin <asmetanin@virtuozzo.com>,
	kvm@vger.kernel.org
Cc: Gleb Natapov <gleb@kernel.org>,
	qemu-devel@nongnu.org, virtualization@lists.linux-foundation.org,
	Roman Kagan <rkagan@virtuozzo.com>,
	Vitaly Kuznetsov <vkuznets@redhat.com>,
	"K. Y. Srinivasan" <kys@microsoft.com>
Subject: Re: [Qemu-devel] [kvm-unit-tests PATCH] x86: hyperv_synic: Hyper-V SynIC test
Date: Mon, 2 Nov 2015 15:18:12 +0300	[thread overview]
Message-ID: <56375484.1000206@openvz.org> (raw)
In-Reply-To: <56375402.7060406@redhat.com>

On 11/02/2015 03:16 PM, Paolo Bonzini wrote:
> On 26/10/2015 10:56, Andrey Smetanin wrote:
>> Hyper-V SynIC is a Hyper-V synthetic interrupt controller.
>>
>> The test runs on every vCPU and performs the following steps:
>> * read from all Hyper-V SynIC MSR's
>> * setup Hyper-V SynIC evt/msg pages
>> * setup SINT's routing
>> * inject SINT's into destination vCPU by 'hyperv-synic-test-device'
>> * wait for SINT's isr's completion
>> * clear Hyper-V SynIC evt/msg pages and destroy SINT's routing
>>
>> Signed-off-by: Andrey Smetanin <asmetanin@virtuozzo.com>
>> Reviewed-by: Roman Kagan <rkagan@virtuozzo.com>
>> Signed-off-by: Denis V. Lunev <den@openvz.org>
>> CC: Vitaly Kuznetsov <vkuznets@redhat.com>
>> CC: "K. Y. Srinivasan" <kys@microsoft.com>
>> CC: Gleb Natapov <gleb@kernel.org>
>> CC: Paolo Bonzini <pbonzini@redhat.com>
>> CC: Roman Kagan <rkagan@virtuozzo.com>
>> CC: Denis V. Lunev <den@openvz.org>
>> CC: qemu-devel@nongnu.org
>> CC: virtualization@lists.linux-foundation.org
> Bad news.
>
> The test breaks with APICv, because of the following sequence of events:
>
> 1) non-auto-EOI interrupt 176 is injected into IRR and ISR
>
> 2) The PPR register is now 176
>
> 3) auto-EOI interrupt 179 is injected into IRR only, because (179 &
> 0xf0) <= (PPR & 0xf0)
>
> 4) interrupt 176 ISR performs an EOI
>
> 5) at this point, because virtual interrupt delivery is enabled, the
> processor does not perform TPR virtualization (SDM 29.1.2).
>
> In addition (and even worse) because virtual interrupt delivery is
> enabled, an auto-EOI interrupt that was stashed in IRR can be injected
> by the processor, and the auto-EOI behavior will be skipped.
>
> The solution is to have userspace enable KVM_CAP_HYPERV_SYNIC through
> KVM_ENABLE_CAP, and modify vmx.c to not use apicv on VMs that have it
> enabled.  This requires some changes to the callbacks that only work if
> enable_apicv or !enable_apicv:
>
>         if (enable_apicv)
>                 kvm_x86_ops->update_cr8_intercept = NULL;
>         else {
>                 kvm_x86_ops->hwapic_irr_update = NULL;
>                 kvm_x86_ops->hwapic_isr_update = NULL;
>                 kvm_x86_ops->deliver_posted_interrupt = NULL;
>                 kvm_x86_ops->sync_pir_to_irr = vmx_sync_pir_to_irr_dummy;
>         }
>
> The question then is... does Hyper-V actually use auto-EOI interrupts?
> If it doesn't, we might as well not implement them... :/
>
> I'm keeping the kernel patches queued for my own testing, but this of
> course has to be fixed before including them---which will delay this
> feature to 4.5, unfortunately.
>
> Paolo

well, the problem is that it actually uses auto EOI....

Den

  reply	other threads:[~2015-11-02 12:18 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-26  9:56 [kvm-unit-tests PATCH] x86: hyperv_synic: Hyper-V SynIC test Andrey Smetanin
2015-10-26  9:56 ` [Qemu-devel] " Andrey Smetanin
2015-11-02 12:16 ` Paolo Bonzini
2015-11-02 12:16   ` [Qemu-devel] " Paolo Bonzini
2015-11-02 12:18   ` Denis V. Lunev [this message]
2015-11-02 12:18     ` Denis V. Lunev
2015-11-02 12:18     ` Denis V. Lunev
2015-11-02 12:22     ` Paolo Bonzini
2015-11-02 12:22       ` [Qemu-devel] " Paolo Bonzini
2015-11-02 12:48   ` Roman Kagan
2015-11-02 12:48     ` [Qemu-devel] " Roman Kagan
2015-11-02 12:16 ` Paolo Bonzini
  -- strict thread matches above, loose matches on Subject: below --
2015-10-26  9:56 Andrey Smetanin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56375484.1000206@openvz.org \
    --to=den@openvz.org \
    --cc=asmetanin@virtuozzo.com \
    --cc=gleb@kernel.org \
    --cc=kvm@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rkagan@virtuozzo.com \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=vkuznets@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.