[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [RFC PATCH v2 13/26] ARM: vGICv3: Handle disabled LPIso



On Thu, 22 Dec 2016, Andre Przywara wrote:
> If a guest disables an LPI, we do not forward this to the associated
> host LPI to avoid queueing commands to the host ITS command queue.
> So it may happen that an LPI fires nevertheless on the host. In this
> case we can bail out early, but have to save the pending state on the
> virtual side.
> 
> Signed-off-by: Andre Przywara <andre.przywara@xxxxxxx>
> ---
>  xen/arch/arm/gic-its.c     |  8 ++++++++
>  xen/arch/arm/vgic-v3.c     | 12 ++++++++++++
>  xen/include/asm-arm/vgic.h |  1 +
>  3 files changed, 21 insertions(+)
> 
> diff --git a/xen/arch/arm/gic-its.c b/xen/arch/arm/gic-its.c
> index 602e19a..54e604a 100644
> --- a/xen/arch/arm/gic-its.c
> +++ b/xen/arch/arm/gic-its.c
> @@ -104,6 +104,14 @@ void do_LPI(unsigned int lpi)
>  
>      vcpu = d->vcpu[hlpi.vcpu_id];
>  
> +    /*
> +     * We keep all host LPIs enabled, so check if it's disabled on the guest
> +     * side and just record this LPI in the virtual pending table in this 
> case.
> +     * The guest picks it up once it gets enabled again.
> +     */
> +    if ( !vgic_can_inject_lpi(vcpu, hlpi.virt_lpi) )
> +        return;

I suggest vgic_can_inject_lpi doesn't only return true or false, but
also if the vlpi is already set to pending. In that case, I think we
should disable the plpi to avoid storms (also see
http://marc.info/?l=xen-devel&m=148055519432739).


>      vgic_vcpu_inject_irq(vcpu, hlpi.virt_lpi);
>  }
>  
> diff --git a/xen/arch/arm/vgic-v3.c b/xen/arch/arm/vgic-v3.c
> index b981d4e..206e00b 100644
> --- a/xen/arch/arm/vgic-v3.c
> +++ b/xen/arch/arm/vgic-v3.c
> @@ -483,6 +483,18 @@ bool vgic_lpi_is_enabled(struct domain *d, uint32_t vlpi)
>      return d->arch.vgic.proptable[vlpi - 8192] & LPI_PROP_ENABLED;
>  }
>  
> +bool vgic_can_inject_lpi(struct vcpu *vcpu, uint32_t vlpi)
> +{
> +    if ( vlpi >= vcpu->domain->arch.vgic.nr_lpis )
> +        return false;
> +
> +    if ( vgic_lpi_is_enabled(vcpu->domain, vlpi) )
> +        return true;
> +
> +    set_bit(vlpi - 8192, vcpu->arch.vgic.pendtable);
> +    return false;
> +}
> +
>  static int __vgic_v3_rdistr_rd_mmio_write(struct vcpu *v, mmio_info_t *info,
>                                            uint32_t gicr_reg,
>                                            register_t r)
> diff --git a/xen/include/asm-arm/vgic.h b/xen/include/asm-arm/vgic.h
> index 1c157d3..73291dd 100644
> --- a/xen/include/asm-arm/vgic.h
> +++ b/xen/include/asm-arm/vgic.h
> @@ -317,6 +317,7 @@ extern void vgic_disable_irqs(struct vcpu *v, uint32_t r, 
> int n);
>  extern void vgic_enable_irqs(struct vcpu *v, uint32_t r, int n);
>  extern bool vgic_lpi_is_enabled(struct domain *d, uint32_t vlpi);
>  extern int vgic_lpi_get_priority(struct domain *d, uint32_t vlpi);
> +extern bool vgic_can_inject_lpi(struct vcpu *v, uint32_t vlpi);
>  extern void register_vgic_ops(struct domain *d, const struct vgic_ops *ops);
>  int vgic_v2_init(struct domain *d, int *mmio_count);
>  int vgic_v3_init(struct domain *d, int *mmio_count);
> -- 
> 2.9.0
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.