xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: "Xu, Quan" <quan.xu@intel.com>
To: "Tian, Kevin" <kevin.tian@intel.com>,
	"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>,
	Jan Beulich <jbeulich@suse.com>
Cc: "dario.faggioli@citrix.com" <dario.faggioli@citrix.com>
Subject: Re: [PATCH v3 02/10] IOMMU: handle IOMMU mapping and	unmapping failures
Date: Wed, 4 May 2016 11:49:41 +0000	[thread overview]
Message-ID: <945CA011AD5F084CBEA3E851C0AB28894B8A8B38@SHSMSX101.ccr.corp.intel.com> (raw)
In-Reply-To: <AADFC41AFE54684AB9EE6CBC0274A5D15F84398D@SHSMSX101.ccr.corp.intel.com>

On May 04, 2016 9:29 AM, Tian, Kevin <kevin.tian@intel.com> wrote:
> > 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@intel.com>
> > Reviewed-by: Kevin Tian <kevin.tian@intel.com>
> >
> > CC: Jan Beulich <jbeulich@suse.com>
> > ---
> >  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);
> 

But Jan said,
..
    if ( is_hardware_domain() )
        printk();
    else
        domain_crash();
..
is the better approach.


I remain neutral for this point. I think this is not a technical problem, but a matter of preference.
This gap is subject to preventing spamming the log. 

For iommu_map_page(), I think Kevin's suggestion is better, much more information for the crash domain,
And also won't spam the log as we stop mapping against any error.

For iommu_unmap_page(),IOMMU unmapping should perhaps continue despite an error, in an attempt
to do best effort cleanup. Then, Kevin's suggestion may spam the log.


Quan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

  reply	other threads:[~2016-05-04 11:49 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-29  9:25 [PATCH v3 00/10] Check VT-d Device-TLB flush error Quan Xu
2016-04-29  9:25 ` [PATCH v3 01/10] vt-d: fix the IOMMU flush issue Quan Xu
2016-05-04  1:26   ` Tian, Kevin
2016-05-04 12:09     ` Xu, Quan
2016-05-04 13:51       ` Jan Beulich
2016-05-04 15:03         ` Xu, Quan
2016-04-29  9:25 ` [PATCH v3 02/10] IOMMU: handle IOMMU mapping and unmapping failures Quan Xu
2016-05-04  1:28   ` Tian, Kevin
2016-05-04 11:49     ` Xu, Quan [this message]
2016-05-04 13:44       ` Jan Beulich
2016-05-05  1:47         ` Xu, Quan
2016-04-29  9:25 ` [PATCH v3 03/10] IOMMU/MMU: enhance the call trees of IOMMU unmapping and mapping Quan Xu
2016-05-04  1:45   ` Tian, Kevin
2016-05-04  8:40     ` Jan Beulich
2016-05-04  9:13       ` Xu, Quan
2016-05-04  9:28         ` Jan Beulich
2016-05-05  0:38           ` Tian, Kevin
2016-05-04 13:48   ` George Dunlap
2016-05-05  6:53     ` Xu, Quan
2016-05-05 11:02       ` George Dunlap
2016-05-06  2:40         ` Xu, Quan
2016-04-29  9:25 ` [PATCH v3 04/10] vt-d: propagate IOMMU Device-TLB flush error up to IOMMU unmapping Quan Xu
2016-04-29  9:25 ` [PATCH v3 05/10] vt-d: propagate IOMMU Device-TLB flush error up to IOMMU mapping Quan Xu
2016-04-29  9:25 ` [PATCH v3 06/10] propagate IOMMU Device-TLB flush error up to iommu_iotlb_flush{, _all} (top level ones) Quan Xu
2016-04-29  9:25 ` [PATCH v3 07/10] IOMMU: propagate IOMMU Device-TLB flush error up to iommu_iotlb_flush{, _all} (leaf ones) Quan Xu
2016-05-04  1:54   ` Tian, Kevin
2016-04-29  9:25 ` [PATCH v3 08/10] vt-d/ept: propagate IOMMU Device-TLB flush error up to EPT update Quan Xu
2016-05-04  1:56   ` Tian, Kevin
2016-04-29  9:25 ` [PATCH v3 09/10] IOMMU: propagate IOMMU Device-TLB flush error up to IOMMU suspending Quan Xu
2016-05-04  1:59   ` Tian, Kevin
2016-05-04  2:14     ` Xu, Quan
2016-05-04  8:42       ` Jan Beulich
2016-05-04  8:59         ` Xu, Quan
2016-05-05 10:18         ` Xu, Quan
2016-05-06  7:02           ` Jan Beulich
2016-05-06  7:20             ` Xu, Quan
2016-04-29  9:25 ` [PATCH v3 10/10] vt-d: propagate error up to ME phantom function mapping and unmapping Quan Xu
2016-05-04  2:02   ` Tian, Kevin
2016-05-04  2:19     ` Xu, Quan

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=945CA011AD5F084CBEA3E851C0AB28894B8A8B38@SHSMSX101.ccr.corp.intel.com \
    --to=quan.xu@intel.com \
    --cc=dario.faggioli@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=kevin.tian@intel.com \
    --cc=xen-devel@lists.xen.org \
    /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).