From: Gleb Natapov <gleb@redhat.com>
To: "Zhang, Yang Z" <yang.z.zhang@intel.com>
Cc: Avi Kivity <avi@redhat.com>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"mtosatti@redhat.com" <mtosatti@redhat.com>
Subject: Re: [PATCH v2 5/6] x86: Enable ack interrupt on vmexit
Date: Mon, 26 Nov 2012 11:17:18 +0200 [thread overview]
Message-ID: <20121126091718.GF25516@redhat.com> (raw)
In-Reply-To: <A9667DDFB95DB7438FA9D7D576C3D87E2C854D@SHSMSX101.ccr.corp.intel.com>
On Mon, Nov 26, 2012 at 05:44:29AM +0000, Zhang, Yang Z wrote:
> Avi Kivity wrote on 2012-11-25:
> > On 11/25/2012 03:03 PM, Gleb Natapov wrote:
> >> On Sun, Nov 25, 2012 at 02:55:26PM +0200, Avi Kivity wrote:
> >>> On 11/22/2012 05:22 PM, Gleb Natapov wrote:
> >>>> On Wed, Nov 21, 2012 at 04:09:38PM +0800, Yang Zhang wrote:
> >>>>> Ack interrupt on vmexit is required by Posted Interrupt. With it,
> >>>>> when external interrupt caused vmexit, the cpu will acknowledge the
> >>>>> interrupt controller and save the interrupt's vector in vmcs.
> >>>>>
> >>>>> There are several approaches to enable it. This patch uses a simply
> >>>>> way: re-generate an interrupt via self ipi.
> >>>>>
> >>>>>
> >>>>> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> >>>>> index 7949d21..f6ef090 100644
> >>>>> --- a/arch/x86/kvm/vmx.c
> >>>>> +++ b/arch/x86/kvm/vmx.c
> >>>>> @@ -2525,7 +2525,8 @@ static __init int setup_vmcs_config(struct
> > vmcs_config *vmcs_conf)
> >>>>> #ifdef CONFIG_X86_64
> >>>>> min |= VM_EXIT_HOST_ADDR_SPACE_SIZE;
> >>>>> #endif
> >>>>> - opt = VM_EXIT_SAVE_IA32_PAT | VM_EXIT_LOAD_IA32_PAT;
> >>>>> + opt = VM_EXIT_SAVE_IA32_PAT | VM_EXIT_LOAD_IA32_PAT |
> >>>>> + VM_EXIT_ACK_INTR_ON_EXIT;
> >>>> Always? Do it only if posted interrupts are actually available
> >>>> and going to be used.
> >>>
> >>> Why not always? Better to have a single code path for host interrupts
> >>> (and as Yang notes, the new path is faster as well).
> >>>
> >> Is it? The current path is:
> >>
> >> vm exit -> KVM vmexit handler(interrupt disabled) -> KVM re-enable
> >> interrupt -> cpu ack the interrupt and interrupt deliver through the
> >> host IDT.
> >>
> >> The proposed path is:
> >>
> >> CPU acks interrupt -> vm exit -> KVM vmexit handler(interrupt disabled)
> >> -> eoi -> self IPI -> KVM re-enable interrupt -> cpu ack the interrupt
> >> and interrupt deliver through the host IDT.
> >>
> >> Am I missing something?
> >
> > Yes, you're missing the part where I didn't write that the new path
> > should avoid the IDT and dispatch the interrupt directly, by emulating
> > an interrupt frame directly. Can be as simple as pushf; push cs; call
> > interrupt_table[vector * 8]. Of course we need to verify that no
> > interrupt uses the IST or a task gate.
>
> How can we call interrupt table directly? I don't think we can expose the idt_table to a module.
No, but we can add function to entry_(64|32).S that despatch via
idt_table and expose it. Avi's idea is worth to explore before going
self IPI way.
> Anyway, to simply the implementation, I will follow gleb's suggestion: only enable "ack intr on exit" when PI is enabled and self ipi should be enough. Any comments?
>
> Best regards,
> Yang
>
--
Gleb.
next prev parent reply other threads:[~2012-11-26 9:17 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-21 8:09 [PATCH v2 0/6] x86, apicv: Add APIC virtualizatin support Yang Zhang
2012-11-21 8:09 ` [PATCH v2 1/6] x86: PIT connects to pin 2 of IOAPIC Yang Zhang
2012-11-28 10:50 ` Gleb Natapov
2012-11-21 8:09 ` [PATCH v2 2/6] x86, apicv: add APICv register virtualization support Yang Zhang
2012-11-21 8:09 ` [PATCH v2 3/6] x86, apicv: add virtual interrupt delivery support Yang Zhang
2012-11-22 13:57 ` Gleb Natapov
2012-11-23 11:46 ` Zhang, Yang Z
2012-11-25 8:53 ` Gleb Natapov
2012-11-21 8:09 ` [PATCH v2 4/6] x86, apicv: add virtual x2apic support Yang Zhang
2012-11-21 8:09 ` [PATCH v2 5/6] x86: Enable ack interrupt on vmexit Yang Zhang
2012-11-22 15:22 ` Gleb Natapov
2012-11-23 5:41 ` Zhang, Yang Z
2012-11-25 13:30 ` Gleb Natapov
2012-11-25 12:55 ` Avi Kivity
2012-11-25 13:03 ` Gleb Natapov
2012-11-25 13:11 ` Avi Kivity
2012-11-26 5:44 ` Zhang, Yang Z
2012-11-26 9:17 ` Gleb Natapov [this message]
2012-11-21 8:09 ` [PATCH v2 6/6] x86, apicv: Add Posted Interrupt supporting Yang Zhang
2012-11-25 12:39 ` Gleb Natapov
2012-11-26 3:51 ` Zhang, Yang Z
2012-11-26 10:01 ` Gleb Natapov
2012-11-26 12:29 ` Zhang, Yang Z
2012-11-26 13:48 ` Gleb Natapov
2012-11-27 3:38 ` Zhang, Yang Z
2012-11-27 9:16 ` Gleb Natapov
2012-11-27 11:10 ` Zhang, Yang Z
2012-11-27 11:31 ` Veruca Salt
2012-11-27 11:46 ` Gleb Natapov
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=20121126091718.GF25516@redhat.com \
--to=gleb@redhat.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=yang.z.zhang@intel.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.