From: George Dunlap <george.dunlap@eu.citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Keir Fraser <keir@xen.org>, Eddie Dong <eddie.dong@intel.com>,
xen-devel <xen-devel@lists.xen.org>,
paul.durrant@citrix.com, Jun Nakajima <jun.nakajima@intel.com>,
Yang Z Zhang <yang.z.zhang@intel.com>
Subject: Re: [PATCH v2 1/5] VMX: fix interaction of APIC-V and Viridian emulation
Date: Mon, 24 Jun 2013 11:10:40 +0100 [thread overview]
Message-ID: <51C81B20.7040000@eu.citrix.com> (raw)
In-Reply-To: <51C80B7602000078000DFDAE@nat28.tlf.novell.com>
On 24/06/13 08:03, Jan Beulich wrote:
> Viridian using a synthetic MSR for issuing EOI notifications bypasses
> the normal in-processor handling, which would clear
> GUEST_INTR_STATUS.SVI. Hence we need to do this in software in order
> for future interrupts to get delivered.
>
> Based on analysis by Yang Z Zhang <yang.z.zhang@intel.com>.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
Hmm... so there are three paths which may end up calling this vmx EOI
code -- from viridian.c:wrmsr_vidiridan_regs(), from
vlapic.c:vlapic_reg_write(), and vmx_handle_eoi_write().
Obviously the viridian code is what we want. But which of the other two
paths will also end up taking it, and is it correct? In other words,
for which of those will cpu_has_vmx_virtual_intr_delivery be set?
-George
> ---
> v2: Split off cleanup parts to new patch 3.
>
> --- a/xen/arch/x86/hvm/vlapic.c
> +++ b/xen/arch/x86/hvm/vlapic.c
> @@ -386,6 +386,9 @@ void vlapic_EOI_set(struct vlapic *vlapi
>
> vlapic_clear_vector(vector, &vlapic->regs->data[APIC_ISR]);
>
> + if ( hvm_funcs.handle_eoi )
> + hvm_funcs.handle_eoi(vector);
> +
> if ( vlapic_test_and_clear_vector(vector, &vlapic->regs->data[APIC_TMR]) )
> vioapic_update_EOI(vlapic_domain(vlapic), vector);
>
> --- a/xen/arch/x86/hvm/vmx/vmx.c
> +++ b/xen/arch/x86/hvm/vmx/vmx.c
> @@ -1502,6 +1502,15 @@ static void vmx_sync_pir_to_irr(struct v
> vlapic_set_vector(i, &vlapic->regs->data[APIC_IRR]);
> }
>
> +static void vmx_handle_eoi(u8 vector)
> +{
> + unsigned long status = __vmread(GUEST_INTR_STATUS);
> +
> + /* We need to clear the SVI field. */
> + status &= VMX_GUEST_INTR_STATUS_SUBFIELD_BITMASK;
> + __vmwrite(GUEST_INTR_STATUS, status);
> +}
> +
> static struct hvm_function_table __initdata vmx_function_table = {
> .name = "VMX",
> .cpu_up_prepare = vmx_cpu_up_prepare,
> @@ -1554,6 +1563,7 @@ static struct hvm_function_table __initd
> .process_isr = vmx_process_isr,
> .deliver_posted_intr = vmx_deliver_posted_intr,
> .sync_pir_to_irr = vmx_sync_pir_to_irr,
> + .handle_eoi = vmx_handle_eoi,
> .nhvm_hap_walk_L1_p2m = nvmx_hap_walk_L1_p2m,
> };
>
> @@ -1580,7 +1590,10 @@ const struct hvm_function_table * __init
>
> setup_ept_dump();
> }
> -
> +
> + if ( !cpu_has_vmx_virtual_intr_delivery )
> + vmx_function_table.handle_eoi = NULL;
> +
> if ( cpu_has_vmx_posted_intr_processing )
> alloc_direct_apic_vector(&posted_intr_vector, event_check_interrupt);
> else
> --- a/xen/include/asm-x86/hvm/hvm.h
> +++ b/xen/include/asm-x86/hvm/hvm.h
> @@ -186,6 +186,7 @@ struct hvm_function_table {
> void (*process_isr)(int isr, struct vcpu *v);
> void (*deliver_posted_intr)(struct vcpu *v, u8 vector);
> void (*sync_pir_to_irr)(struct vcpu *v);
> + void (*handle_eoi)(u8 vector);
>
> /*Walk nested p2m */
> int (*nhvm_hap_walk_L1_p2m)(struct vcpu *v, paddr_t L2_gpa,
>
>
>
next prev parent reply other threads:[~2013-06-24 10:10 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-24 6:54 [PATCH v2 0/5] VMX: fix interaction of Viridian emulation with advanced features Jan Beulich
2013-06-24 7:03 ` [PATCH v2 1/5] VMX: fix interaction of APIC-V and Viridian emulation Jan Beulich
2013-06-24 10:10 ` George Dunlap [this message]
2013-06-24 12:52 ` Jan Beulich
2013-06-24 13:09 ` George Dunlap
2013-06-24 13:26 ` Jan Beulich
2013-06-24 13:29 ` George Dunlap
2013-06-24 13:48 ` Jan Beulich
2013-07-04 9:03 ` Andrew Cooper
2013-06-24 7:04 ` [PATCH v2 2/5] VMX/Viridian: suppress MSR-based APIC suggestion when having APIC-V Jan Beulich
2013-06-25 10:29 ` Paul Durrant
2013-06-25 13:43 ` George Dunlap
2013-06-25 13:59 ` Jan Beulich
2013-06-24 7:06 ` [PATCH v2 3/5] VMX: suppress pointless indirect calls Jan Beulich
2013-07-04 9:10 ` Andrew Cooper
2013-06-24 7:06 ` [PATCH v2 4/5] Viridian: populate CPUID leaf 6 Jan Beulich
2013-07-04 9:38 ` Andrew Cooper
2013-07-04 10:05 ` Jan Beulich
2013-07-04 10:18 ` Andrew Cooper
2013-06-24 7:08 ` [PATCH v2 5/5] Viridian: cleanup Jan Beulich
2013-07-04 9:38 ` Andrew Cooper
2013-07-04 8:38 ` [PATCH v2 0/5] VMX: fix interaction of Viridian emulation with advanced features Jan Beulich
2013-07-04 9:24 ` Zhang, Yang Z
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=51C81B20.7040000@eu.citrix.com \
--to=george.dunlap@eu.citrix.com \
--cc=JBeulich@suse.com \
--cc=eddie.dong@intel.com \
--cc=jun.nakajima@intel.com \
--cc=keir@xen.org \
--cc=paul.durrant@citrix.com \
--cc=xen-devel@lists.xen.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).