WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH 10/13] Nested Virtualization: interrupts (svm spe

To: Tim Deegan <Tim.Deegan@xxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH 10/13] Nested Virtualization: interrupts (svm specific)
From: Christoph Egger <Christoph.Egger@xxxxxxx>
Date: Thu, 2 Dec 2010 18:47:22 +0100
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Thu, 02 Dec 2010 09:48:38 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <20101116150645.GE25462@xxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <201011121944.19698.Christoph.Egger@xxxxxxx> <20101116150645.GE25462@xxxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: KMail/1.9.10
On Tuesday 16 November 2010 16:06:45 Tim Deegan wrote:
> At 18:44 +0000 on 12 Nov (1289587459), Christoph Egger wrote:
> > diff -r 3bfc06e2e41a -r b18448601670 xen/arch/x86/hvm/svm/nestedsvm.c
> > --- a/xen/arch/x86/hvm/svm/nestedsvm.c
> > +++ b/xen/arch/x86/hvm/svm/nestedsvm.c
> > @@ -24,6 +24,30 @@
> >  #include <asm/hvm/svm/nestedsvm.h>
> >  #include <asm/hvm/svm/svmdebug.h>
> >  #include <asm/paging.h> /* paging_mode_hap */
> > +#include <asm/event.h> /* for local_event_delivery_(en|dis)able */
> > +
> > +static int
> > +nestedsvm_vcpu_clgi(struct vcpu *v)
> > +{
> > +    struct nestedsvm *svm = &vcpu_nestedsvm(v);
> > +
> > +    /* clear gif flag */
> > +    svm->ns_gif = 0;
> > +    local_event_delivery_disable(); /* mask events for PV drivers */
>
> This function, and the stgi one below, can only operate safely on
> current; if you want to keep the argument for performance then maybe
> ASSERT(v == current) for sanity.

No, it's not about performance. It's about consistency.
Do you want me to remove the parameter?

> > +    return 0;
>
> Also, since they only ever return 0, please make them return void
> instead.

Fixed.

>
> > +}
> > +
> > +static int
> > +nestedsvm_vcpu_stgi(struct vcpu *v)
> > +{
> > +    struct nestedsvm *svm = &vcpu_nestedsvm(v);
> > +
> > +    /* Always set the GIF to make hvm_interrupt_blocked work. */
> > +    svm->ns_gif = 1;
> > +
> > +    local_event_delivery_enable(); /* unmask events for PV drivers */
> > +    return 0;
> > +}
> >
> > +void svm_vmexit_do_stgi(struct cpu_user_regs *regs, struct vcpu *v)
> > +{
> > +    int ret;
> > +    unsigned int inst_len;
> > +
> > +    if ( !nestedhvm_enabled(v->domain) ) {
> > +        hvm_inject_exception(TRAP_invalid_op, HVM_DELIVER_NO_ERROR_CODE,
> > 0); +        return;
> > +    }
> > +
> > +    if ( (inst_len = __get_instruction_length(v, INSTR_STGI)) == 0 )
> > +        return;
> > +
> > +    ret = nestedsvm_vcpu_stgi(v);
> > +    if (ret)
> > +        /* On failure, nestedsvm_vcpu_stgi injected an exception,
> > +         * almost a #GP or #UD.
>
> No, it never fails and always returns 0. :)  Likewise below.

Both fixed.

Christoph

>
> Cheers,
>
> Tim.
>
> > +         */
> > +       return;
> > +
> > +    __update_guest_eip(regs, inst_len);
> > +}
> > +
> > +void svm_vmexit_do_clgi(struct cpu_user_regs *regs, struct vcpu *v)
> > +{
> > +    int ret;
> > +    struct vmcb_struct *vmcb = v->arch.hvm_svm.vmcb;
> > +    unsigned int inst_len;
> > +
> > +    if ( !nestedhvm_enabled(v->domain) ) {
> > +        hvm_inject_exception(TRAP_invalid_op, HVM_DELIVER_NO_ERROR_CODE,
> > 0); +        return;
> > +    }
> > +
> > +    if ( (inst_len = __get_instruction_length(v, INSTR_CLGI)) == 0 )
> > +        return;
> > +
> > +    ret = nestedsvm_vcpu_clgi(v);
> > +    if (ret)
> > +        /* On failure, nestedsvm_vcpu_clgi injected an exception,
> > +         * almost a #GP or #UD.
> > +         */
> > +        return;
> > +
> > +    /* After a CLGI no interrupts should come */
> > +    vmcb->vintr.fields.irq = 0;
> > +    vmcb->general1_intercepts &= ~GENERAL1_INTERCEPT_VINTR;
> > +
> > +    __update_guest_eip(regs, inst_len);
> > +}



-- 
---to satisfy European Law for business letters:
Advanced Micro Devices GmbH
Einsteinring 24, 85609 Dornach b. Muenchen
Geschaeftsfuehrer: Alberto Bozzo, Andrew Bowd
Sitz: Dornach, Gemeinde Aschheim, Landkreis Muenchen
Registergericht Muenchen, HRB Nr. 43632


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>
  • Re: [Xen-devel] [PATCH 10/13] Nested Virtualization: interrupts (svm specific), Christoph Egger <=