From: "Jan Beulich" <jbeulich@suse.com>
To: quan.xu@intel.com
Cc: kevin.tian@intel.com, keir@xen.org, andrew.cooper3@citrix.com,
dario.faggioli@citrix.com, xen-devel@lists.xen.org,
feng.wu@intel.com
Subject: Re: [PATCH v8 09/11] vt-d: fix the IOMMU flush issue
Date: Mon, 13 Jun 2016 09:52:10 -0600 [thread overview]
Message-ID: <575EE4BA02000078000EA4E3@prv-mh.provo.novell.com> (raw)
In-Reply-To: <1465831038-43005-10-git-send-email-quan.xu@intel.com>
>>> "Xu, Quan" <quan.xu@intel.com> 06/13/16 5:22 PM >>>
>From: Quan Xu <quan.xu@intel.com>
>
>The propagation value from IOMMU flush interfaces may be positive, which
>indicates callers need to flush cache, not one of faliures.
>
>when the propagation value is positive, this patch fixes this flush issue
>as follows:
>- call iommu_flush_write_buffer() to flush cache.
>- return zero.
>
>Signed-off-by: Quan Xu <quan.xu@intel.com>
>Reviewed-by: Jan Beulich <jbeulich@suse.com>
>
>CC: Kevin Tian <kevin.tian@intel.com>
>CC: Feng Wu <feng.wu@intel.com>
>CC: Keir Fraser <keir@xen.org>
>CC: Jan Beulich <jbeulich@suse.com>
>CC: Andrew Cooper <andrew.cooper3@citrix.com>
>
>v8: drop assertion and check both flush_context and flush_iotlb
>whether the return values are positive.
>(note: this change is not under Jan's R-b).
In which case you should simply have dropped it.
>@@ -546,17 +550,37 @@ static int __must_check iommu_flush_all(void)
>struct acpi_drhd_unit *drhd;
>struct iommu *iommu;
>int flush_dev_iotlb;
>+ int rc = 0;
>
>flush_all_cache();
>for_each_drhd_unit ( drhd )
>{
>+ int iommu_rc, iommu_ret;
>+
>iommu = drhd->iommu;
>- iommu_flush_context_global(iommu, 0);
>+ iommu_rc = iommu_flush_context_global(iommu, 0);
>flush_dev_iotlb = find_ats_dev_drhd(iommu) ? 1 : 0;
>- iommu_flush_iotlb_global(iommu, 0, flush_dev_iotlb);
>+ iommu_ret = iommu_flush_iotlb_global(iommu, 0, flush_dev_iotlb);
>+
>+ /*
>+ * The current logic for returns:
>+ * - positive invoke iommu_flush_write_buffer to flush cache.
>+ * - zero on success.
>+ * - negative on failure. Continue to flush IOMMU IOTLB on a
>+ * best effort basis.
>+ */
>+ if ( iommu_rc > 0 || iommu_ret > 0 )
>+ iommu_flush_write_buffer(iommu);
>+ if ( rc >= 0 )
>+ rc = iommu_rc;
>+ if ( rc >= 0 )
>+ rc = iommu_ret;
First of all - is it correct to fold the two iommu_flush_write_buffer() invocations?
And then the variable naming is strange - both operations are IOMMU ones, so
prefixing the variables with iommu_ doesn't help much here. How about ctxt_rc
and iotlb_rc or some such?
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-06-13 15:52 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-13 15:17 [PATCH v8 00/11] Check VT-d Device-TLB flush error Xu, Quan
2016-06-13 15:17 ` [PATCH v8 01/11] IOMMU: handle IOMMU mapping and unmapping failures Xu, Quan
2016-06-13 15:17 ` [PATCH v8 02/11] IOMMU/MMU: enhance the call trees of IOMMU unmapping and mapping Xu, Quan
2016-06-13 15:36 ` Jan Beulich
2016-06-13 16:36 ` George Dunlap
2016-06-15 1:54 ` Xu, Quan
2016-06-15 7:44 ` Jan Beulich
2016-06-15 8:15 ` Xu, Quan
2016-06-15 8:22 ` Tian, Kevin
2016-06-15 8:35 ` Xu, Quan
2016-06-15 8:42 ` Jan Beulich
2016-06-15 8:53 ` Xu, Quan
2016-06-13 15:17 ` [PATCH v8 03/11] IOMMU: propagate IOMMU Device-TLB flush error up to IOMMU unmapping (top level ones) Xu, Quan
2016-06-13 15:17 ` [PATCH v8 04/11] IOMMU: propagate IOMMU Device-TLB flush error up to IOMMU mapping " Xu, Quan
2016-06-15 8:26 ` Xu, Quan
2016-06-16 9:19 ` Julien Grall
2016-06-13 15:17 ` [PATCH v8 05/11] IOMMU/MMU: propagate IOMMU Device-TLB flush error up to iommu_iotlb_flush{, _all} " Xu, Quan
2016-06-13 15:17 ` [PATCH v8 06/11] propagate IOMMU Device-TLB flush error up to EPT update " Xu, Quan
2016-06-13 16:37 ` George Dunlap
2016-06-13 15:17 ` [PATCH v8 07/11] IOMMU: propagate IOMMU Device-TLB flush error up to IOMMU suspending " Xu, Quan
2016-06-13 15:17 ` [PATCH v8 08/11] IOMMU: propagate IOMMU Device-TLB flush error (leaf ones) Xu, Quan
2016-06-16 9:25 ` Julien Grall
2016-06-13 15:17 ` [PATCH v8 09/11] vt-d: fix the IOMMU flush issue Xu, Quan
2016-06-13 15:52 ` Jan Beulich [this message]
2016-06-14 8:10 ` Xu, Quan
2016-06-14 8:26 ` Jan Beulich
2016-06-14 9:04 ` Xu, Quan
2016-06-15 1:42 ` Tian, Kevin
2016-06-13 15:17 ` [PATCH v8 10/11] vt-d: propagate the IOMMU Device-TLB flush error up to ME phantom functions Xu, Quan
2016-06-13 15:17 ` [PATCH v8 11/11] vt-d: add __must_check annotation to IOMMU flush pointers and handlers 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=575EE4BA02000078000EA4E3@prv-mh.provo.novell.com \
--to=jbeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=dario.faggioli@citrix.com \
--cc=feng.wu@intel.com \
--cc=keir@xen.org \
--cc=kevin.tian@intel.com \
--cc=quan.xu@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).