Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1335320
| Path | csiph.com!news.mixmin.net!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Paolo Bonzini <pbonzini@redhat.com> |
| Newsgroups | linux.kernel |
| Subject | Re: [PART1 RFC 5/9] svm: Add VMEXIT handlers for AVIC |
| Date | Tue, 16 Feb 2016 13:20:03 +0100 |
| Message-ID | <r2MLN-7HT-29@gated-at.bofh.it> (permalink) |
| References | <r1mA1-847-3@gated-at.bofh.it> <r1mA5-847-39@gated-at.bofh.it> <r1nZ8-q7-5@gated-at.bofh.it> <r2HsM-408-57@gated-at.bofh.it> |
| X-Original-To | Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com>, joro@8bytes.org, alex.williamson@redhat.com, gleb@kernel.org |
| Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-type:content-transfer-encoding; bh=wWLUIYcsilbLSsfDgr3WrlHNbKMYDMnDxkYREBkjqCQ=; b=VCK4oZAAT/bLDdlYfyX3OH7Y4kZ0eQVA6/HnP6jaaohU0fxsl+IqzdihK5PGziVyhx 2QMoqm1I7fiCNVQV5inohRgMhfZVVJad8ihSIiNe/77byUa/Os47WTJgryZrcWrxKrW6 5iPzdHxI/arg6YzhoAfuzjnsagBjjL7z6DpUpNvEDjhhkQp6fgSdsvjf5YiWyDaLnJ6P HpZ2XkRENylfD+S10+0YHhi8/IFoV9VFLSFtxGiiUqjELlQ5EBl1gaG7f9AaYAZFFFqd Mi8sOigaoTG35Rulpnqklk8YufuXpml/zNHSSnFfoi9pg45nwZFmKdrRtOCJjmlFmpq8 4/3g== |
| X-Google-Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:subject:to:references:cc:from:message-id :date:user-agent:mime-version:in-reply-to:content-type :content-transfer-encoding; bh=wWLUIYcsilbLSsfDgr3WrlHNbKMYDMnDxkYREBkjqCQ=; b=mXsRPC2mhb0V6ouM3+PAeYxrcX3FrI8ozi8cVvozb5xg461EUfpUTi6W9vxVtawIr8 9ahJmER0blF+GhSKYyKffrZD5w1NSh+ATfbBr2A5JdwgEbr7Nfu5iUxYWboxmiZpMJtn B3QJ0Oy8dtOFD1do/6nXXi/E4rBOmqvTWvQCGzGvBLPHn+UBSm3jinNNBKH2b7PqEOpD jRCuNDXMovuOV+jrcgqWjMGiivlkio0xJI+rj+k/YB2Ee6vSVFeSVYr247CaGNRjH7Be BZJmec61HwqrRDIk+ihgfUyRHP+ZfYTKLcVnOlXON8+8ymYyQen6lfUxvHv/o6Py0b6f UNHA== |
| X-Gm-Message-State | AG10YOQRmNlWRf8eF2NJr8mR+gXI322zdrie+OBhlcpZvej4h74ogt3ruN+sogxjbzQBYg== |
| X-Received | by 10.194.115.130 with SMTP id jo2mr18877133wjb.3.1455624933685; Tue, 16 Feb 2016 04:15:33 -0800 (PST) |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 |
| MIME-Version | 1.0 |
| Content-Type | text/plain; charset=windows-1252 |
| Content-Transfer-Encoding | 7bit |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 80 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | kvm@vger.kernel.org, linux-kernel@vger.kernel.org, wei@redhat.com, sherry.hurwitz@amd.com |
| X-Original-Date | Tue, 16 Feb 2016 13:15:29 +0100 |
| X-Original-Message-ID | <56C312E1.1080902@redhat.com> |
| X-Original-References | <1455285574-27892-1-git-send-email-suravee.suthikulpanit@amd.com> <1455285574-27892-6-git-send-email-suravee.suthikulpanit@amd.com> <56BDFC72.7030905@redhat.com> <56C2C1BF.7010700@amd.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1335320 |
Show key headers only | View raw
On 16/02/2016 07:29, Suravee Suthikulpanit wrote:
> Hi Paolo,
>
> On 2/12/16 22:38, Paolo Bonzini wrote:
>>
>>
>> On 12/02/2016 14:59, Suravee Suthikulpanit wrote:
>>> + "icrh:icrl=%#010x:%08x, id=%u, index=%u\n",
>>> + __func__, svm->vcpu.cpu, svm->vcpu.vcpu_id,
>>> + icrh, icrl, id, index);
>>> +
>>> + switch (id) {
>>> + case AVIC_INCMP_IPI_ERR_INVALID_INT_TYPE:
>>> + /*
>>> + * AVIC hardware handles the generation of
>>> + * IPIs when the specified Message Type is Fixed
>>> + * (also known as fixed delivery mode) and
>>> + * the Trigger Mode is edge-triggered. The hardware
>>> + * also supports self and broadcast delivery modes
>>> + * specified via the Destination Shorthand(DSH)
>>> + * field of the ICRL. Logical and physical APIC ID
>>> + * formats are supported. All other IPI types cause
>>> + * a #VMEXIT, which needs to emulated.
>>> + */
>>> + kvm_lapic_reg_write(apic, APIC_ICR2, icrh);
>>> + kvm_lapic_reg_write(apic, APIC_ICR, icrl);
>>> + break;
>>> + case AVIC_INCMP_IPI_ERR_TARGET_NOT_RUN:
>>> + kvm_lapic_reg_write(apic, APIC_ICR2, icrh);
>>> + kvm_lapic_reg_write(apic, APIC_ICR, icrl);
>>
>> Wouldn't this cause a double injection of the IPI if the following
>> happens:
>>
>> 1) destination 1 is running, so the processor sets IRR and sends a
>> doorbell message
>>
>> 2) destination 2 is not running, so the processor sets IRR and exits
>>
>> 3) destination 1 processes the interrupt, moving it from IRR to ISR
>>
>> 4) destination 1 sends an EOI
>>
>> 5) the source exits and reinjects the interrupt
>>
>> 6) destination 1 then receives the interrupt again.
>
> Not sure if I am following your scenario here. IIUC, your concern is
> regarding the dest2 that was not running at the time that the IPI
> message is sent to both dest1 and dest2?
>
> In this case, since the HW cannot deliver due to one ore more target
> vcpus due to not running, I believe it would not set the IRR bit of
> dest1, and generate the AVIC_INCOMPLETE_IPI #vmexit above instead. I
> don't think it would progress to step 3 right away.
The documentation doesn't say that setting the IRR bit is atomic across
all CPUs (and from a hardware perspective that would be extremely
unlikely). Another hint in my opinion is that the vmexit is called
"incomplete" IPI, not something like "aborted" IPI. "abort" might
suggest atomicity, "incomplete" definitely suggests *non*atomicity to me.
Wei, what do you think/recall?
I am afraid that this could be a showstopper for AVIC support in KVM.
The only solution I see is to have a different page for each CPU, so
that only self-IPIs are virtualized. Then you'd only support
virtualization of self-IPIs, similar to Intel's APICv.
>> The handling of races for IsRunning and incomplete IPIs has always been
>> very confusing to me whenever I read the AVIC specification. It would
>> be great if you could clarify this.
>
> I'll make sure to confirm with the HW designer again just to be sure.
Please do, thanks!
Paolo
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PART1 RFC 0/9] KVM: x86: Introduce SVM AVIC support Suravee Suthikulpanit <suravee.suthikulpanit@amd.com> - 2016-02-12 15:10 +0100
[PART1 RFC 4/9] KVM: x86: Detect and Initialize AVIC support Suravee Suthikulpanit <suravee.suthikulpanit@amd.com> - 2016-02-12 15:10 +0100
Re: [PART1 RFC 4/9] KVM: x86: Detect and Initialize AVIC support Borislav Petkov <bp@alien8.de> - 2016-02-12 15:20 +0100
Re: [PART1 RFC 4/9] KVM: x86: Detect and Initialize AVIC support Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com> - 2016-02-12 16:50 +0100
[PART1 RFC 9/9] svm: Manage vcpu load/unload when enable AVIC Suravee Suthikulpanit <suravee.suthikulpanit@amd.com> - 2016-02-12 15:10 +0100
Re: [PART1 RFC 9/9] svm: Manage vcpu load/unload when enable AVIC Paolo Bonzini <pbonzini@redhat.com> - 2016-02-12 16:50 +0100
[PART1 RFC 6/9] svm: Add interrupt injection via AVIC Suravee Suthikulpanit <suravee.suthikulpanit@amd.com> - 2016-02-12 15:10 +0100
Re: [PART1 RFC 6/9] svm: Add interrupt injection via AVIC Borislav Petkov <bp@alien8.de> - 2016-02-12 15:20 +0100
Re: [PART1 RFC 6/9] svm: Add interrupt injection via AVIC Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com> - 2016-02-12 17:00 +0100
Re: [PART1 RFC 6/9] svm: Add interrupt injection via AVIC Borislav Petkov <bp@alien8.de> - 2016-02-12 18:20 +0100
Re: [PART1 RFC 6/9] svm: Add interrupt injection via AVIC Paolo Bonzini <pbonzini@redhat.com> - 2016-02-12 19:30 +0100
Re: [PART1 RFC 6/9] svm: Add interrupt injection via AVIC Borislav Petkov <bp@alien8.de> - 2016-02-12 19:40 +0100
Re: [PART1 RFC 6/9] svm: Add interrupt injection via AVIC Paolo Bonzini <pbonzini@redhat.com> - 2016-02-12 20:00 +0100
Re: [PART1 RFC 6/9] svm: Add interrupt injection via AVIC Borislav Petkov <bp@alien8.de> - 2016-02-12 20:40 +0100
Re: [PART1 RFC 6/9] svm: Add interrupt injection via AVIC Ingo Molnar <mingo@kernel.org> - 2016-02-16 09:00 +0100
[PATCH] x86/msr: Document msr-index.h rule for addition Borislav Petkov <bp@alien8.de> - 2016-02-16 09:40 +0100
Re: [PART1 RFC 6/9] svm: Add interrupt injection via AVIC Paolo Bonzini <pbonzini@redhat.com> - 2016-02-12 17:00 +0100
Re: [PART1 RFC 6/9] svm: Add interrupt injection via AVIC Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com> - 2016-02-12 17:30 +0100
Re: [PART1 RFC 6/9] svm: Add interrupt injection via AVIC Paolo Bonzini <pbonzini@redhat.com> - 2016-02-12 19:20 +0100
Re: [PART1 RFC 6/9] svm: Add interrupt injection via AVIC Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com> - 2016-02-12 20:40 +0100
Re: [PART1 RFC 6/9] svm: Add interrupt injection via AVIC Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com> - 2016-02-19 13:00 +0100
[PART1 RFC 5/9] svm: Add VMEXIT handlers for AVIC Suravee Suthikulpanit <suravee.suthikulpanit@amd.com> - 2016-02-12 15:10 +0100
Re: [PART1 RFC 5/9] svm: Add VMEXIT handlers for AVIC Paolo Bonzini <pbonzini@redhat.com> - 2016-02-12 16:40 +0100
Re: [PART1 RFC 5/9] svm: Add VMEXIT handlers for AVIC Radim Krčmář <rkrcmar@redhat.com> - 2016-02-15 20:30 +0100
Re: [PART1 RFC 5/9] svm: Add VMEXIT handlers for AVIC Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com> - 2016-02-16 07:40 +0100
Re: [PART1 RFC 5/9] svm: Add VMEXIT handlers for AVIC Paolo Bonzini <pbonzini@redhat.com> - 2016-02-16 13:20 +0100
Re: [PART1 RFC 5/9] svm: Add VMEXIT handlers for AVIC Radim Krčmář <rkrcmar@redhat.com> - 2016-02-16 15:20 +0100
Re: [PART1 RFC 5/9] svm: Add VMEXIT handlers for AVIC Paolo Bonzini <pbonzini@redhat.com> - 2016-02-16 18:00 +0100
Re: [PART1 RFC 5/9] svm: Add VMEXIT handlers for AVIC Radim Krčmář <rkrcmar@redhat.com> - 2016-02-16 19:10 +0100
Re: [PART1 RFC 5/9] svm: Add VMEXIT handlers for AVIC Radim Krčmář <rkrcmar@redhat.com> - 2016-02-18 15:20 +0100
Re: [PART1 RFC 5/9] svm: Add VMEXIT handlers for AVIC Paolo Bonzini <pbonzini@redhat.com> - 2016-02-18 16:00 +0100
Re: [PART1 RFC 5/9] svm: Add VMEXIT handlers for AVIC Radim Krčmář <rkrcmar@redhat.com> - 2016-02-18 16:50 +0100
Re: [PART1 RFC 5/9] svm: Add VMEXIT handlers for AVIC Paolo Bonzini <pbonzini@redhat.com> - 2016-02-18 17:00 +0100
Re: [PART1 RFC 5/9] svm: Add VMEXIT handlers for AVIC Radim Krčmář <rkrcmar@redhat.com> - 2016-02-18 17:30 +0100
Re: [PART1 RFC 5/9] svm: Add VMEXIT handlers for AVIC Paolo Bonzini <pbonzini@redhat.com> - 2016-02-18 18:20 +0100
Re: [PART1 RFC 5/9] svm: Add VMEXIT handlers for AVIC Paolo Bonzini <pbonzini@redhat.com> - 2016-02-19 12:50 +0100
Re: [PART1 RFC 5/9] svm: Add VMEXIT handlers for AVIC Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com> - 2016-02-19 12:40 +0100
Re: [PART1 RFC 0/9] KVM: x86: Introduce SVM AVIC support Paolo Bonzini <pbonzini@redhat.com> - 2016-02-12 19:20 +0100
Re: [PART1 RFC 0/9] KVM: x86: Introduce SVM AVIC support Suravee Suthikulpanit <Suravee.Suthikulpanit@amd.com> - 2016-02-12 21:00 +0100
Re: [PART1 RFC 0/9] KVM: x86: Introduce SVM AVIC support Paolo Bonzini <pbonzini@redhat.com> - 2016-02-12 21:10 +0100
csiph-web