From: "Jan Beulich" <JBeulich@suse.com>
To: Quan Xu <quan.xu@intel.com>
Cc: Kevin Tian <kevin.tian@intel.com>, "keir@xen.org" <keir@xen.org>,
"andrew.cooper3@citrix.com" <andrew.cooper3@citrix.com>,
"dario.faggioli@citrix.com" <dario.faggioli@citrix.com>,
"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>,
Feng Wu <feng.wu@intel.com>
Subject: Re: [PATCH v8 09/11] vt-d: fix the IOMMU flush issue
Date: Tue, 14 Jun 2016 02:26:51 -0600 [thread overview]
Message-ID: <575FDBEB02000078000F4A64@prv-mh.provo.novell.com> (raw)
In-Reply-To: <945CA011AD5F084CBEA3E851C0AB28894B8E4225@SHSMSX103.ccr.corp.intel.com>
>>> On 14.06.16 at 10:10, <quan.xu@intel.com> wrote:
> On June 13, 2016 11:52 PM, Jan Beulich <jbeulich@suse.com> wrote:
>> >>> "Xu, Quan" <quan.xu@intel.com> 06/13/16 5:22 PM >>>
>> >From: Quan Xu <quan.xu@intel.com>
>> >@@ -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?
>>
>
> Sure, it is correct..
>
> as:
> - For updates to remapping hardware structures that require context-cache,
> PASID-cache, IOTLB or IEC invalidation
> Operations to flush stale entries from the hardware caches, no additional
> action is required to make the modification
> Visible to hardware. This is because, hardware performs an implicit
> write-buffer-flushing as a pre-condition to context-cache,
> PASID-cache, IOTLB and IEC invalidation operations.
>
> - For updates to remapping hardware structures (such as modifying a currently
> not-present entry) that do not require
> Context-cache, IOTLB, or IEC invalidations, software must explicitly perform
> write-buffer-flushing to ensure the updated structures
> Are visible to hardware.
But that's not the point. Instead my question was related to Kevin's
concern towards you making assumptions on the behavior of
iommu_flush_context_global() vs iommu_flush_iotlb_global(): What
if the first returned 1 but the second didn't? It would seem to me
that in such a (theoretical) case iommu_flush_write_buffer() might
need to be invoked prior to the second flush function.
Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-06-14 8:26 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
2016-06-14 8:10 ` Xu, Quan
2016-06-14 8:26 ` Jan Beulich [this message]
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=575FDBEB02000078000F4A64@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).