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

Re: [Xen-devel] [PATCH v3 02/10] IOMMU: handle IOMMU mapping and unmapping failures



> From: Quan Xu
> Sent: Friday, April 29, 2016 5:25 PM
> 
> Treat IOMMU mapping and unmapping failures as a fatal to the domain
> (with the exception of the hardware domain).
> 
> If IOMMU mapping and unmapping failed, crash the domain (with the
> exception of the hardware domain) and propagate the error up to the
> call trees.
> 
> Signed-off-by: Quan Xu <quan.xu@xxxxxxxxx>
> Reviewed-by: Kevin Tian <kevin.tian@xxxxxxxxx>
> 
> CC: Jan Beulich <jbeulich@xxxxxxxx>
> ---
>  xen/drivers/passthrough/iommu.c | 30 ++++++++++++++++++++++++++++--
>  1 file changed, 28 insertions(+), 2 deletions(-)
> 
> diff --git a/xen/drivers/passthrough/iommu.c b/xen/drivers/passthrough/iommu.c
> index b64676f..a0003ac 100644
> --- a/xen/drivers/passthrough/iommu.c
> +++ b/xen/drivers/passthrough/iommu.c
> @@ -243,21 +243,47 @@ int iommu_map_page(struct domain *d, unsigned long gfn,
> unsigned long mfn,
>                     unsigned int flags)
>  {
>      struct hvm_iommu *hd = domain_hvm_iommu(d);
> +    int rc;
> 
>      if ( !iommu_enabled || !hd->platform_ops )
>          return 0;
> 
> -    return hd->platform_ops->map_page(d, gfn, mfn, flags);
> +    rc = hd->platform_ops->map_page(d, gfn, mfn, flags);
> +
> +    if ( rc )
> +    {
> +        if ( is_hardware_domain(d) )
> +            printk(XENLOG_ERR
> +                   "iommu_map_page: IOMMU mapping gfn %#lx mfn %#lx failed 
> for
> dom%d.",
> +                   gfn, mfn, d->domain_id);
> +        else
> +            domain_crash(d);
> +    }

It makes sense to print error messages for all domains, and
then selectively crash domain:

printk(XENLOG_ERR ...);
if ( !is_hardware_domain(d) )
        domain_crash(d);

Thanks
Kevin
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

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