All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: kevin.tian@intel.com, keir@xen.org, jinsong.liu@alibaba-inc.com,
	xen-devel@lists.xen.org,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	yang.z.zhang@intel.com, Tiejun Chen <tiejun.chen@intel.com>
Subject: Re: [PATCH 1/3] xen/vt-d: need barriers to workaround CLFLUSH
Date: Wed, 06 May 2015 11:11:58 -0400	[thread overview]
Message-ID: <554A2F3E.8070008@oracle.com> (raw)
In-Reply-To: <5549DAFF0200007800076EF0@mail.emea.novell.com>

On 05/06/2015 03:12 AM, Jan Beulich wrote:
>>>> On 05.05.15 at 18:11, <boris.ostrovsky@oracle.com> wrote:
>> On 05/05/2015 11:58 AM, Jan Beulich wrote:
>>>>>> On 05.05.15 at 17:46, <boris.ostrovsky@oracle.com> wrote:
>>>> On 05/04/2015 05:14 AM, Andrew Cooper wrote:
>>>>> On 04/05/2015 09:52, Jan Beulich wrote:
>>>>>>>>> On 04.05.15 at 04:16, <tiejun.chen@intel.com> wrote:
>>>>>>> --- a/xen/drivers/passthrough/vtd/x86/vtd.c
>>>>>>> +++ b/xen/drivers/passthrough/vtd/x86/vtd.c
>>>>>>> @@ -56,7 +56,9 @@ unsigned int get_cache_line_size(void)
>>>>>>>     
>>>>>>>     void cacheline_flush(char * addr)
>>>>>>>     {
>>>>>>> +    mb();
>>>>>>>         clflush(addr);
>>>>>>> +    mb();
>>>>>>>     }
>>>>>> I think the purpose of the flush is to force write back, not to evict
>>>>>> the cache line, and if so wmb() would appear to be sufficient. As
>>>>>> the SDM says that's not the case, a comment explaining why wmb()
>>>>>> is not sufficient would seem necessary. Plus in the description I
>>>>>> think "serializing" needs to be changed to "fencing", as serialization
>>>>>> is not what we really care about here. If you and the maintainers
>>>>>> agree, I could certainly fix up both aspects while committing.
>>>>> On the subject of writebacks, we should get around to alternating-up the
>>>>> use of clflushopt and clwb, either of which would be better than a
>>>>> clflush in this case (avoiding the need for the leading mfence).
>>>>>
>>>>> However, the ISA extension document does not indicate which processors
>>>>> will have support for these new instructions.
>>>> https://software.intel.com/sites/default/files/managed/0d/53/319433-022.pdf
>>>>
>>>> We really should add support for this. On shutting down a very large
>>>> guest (hundreds of GB) we observed *minutes* spent in flushing IOMMU.
>>>> This was due to serializing nature of CLFLUSH.
>>> But flushing the IOMMU isn't being done via CPU instructions, but
>>> rather via commands sent to the IOMMU. I.e. I'm somewhat
>>> confused by your reply.
>> I didn't mean flushing IOMMU itself, sorry. I meant
>> __iommu_flush_cache() (or whatever it's equivalent we had in the
>> product, which was 4.1-based).
> In that case I wonder how much of that flushing is really necessary
> during IOMMU teardown. VT-d maintainers?

I should mention that we saw this on 4.1, where iommu teardown is done 
in the domain destruction code path. After we backported code that moves 
this into a tasklet things got much better.

Of course we still are doing flushing, even if in the background, and 
therefore system resources are still being consumed (and memory is not 
available until flushing is done). So if this is unnecessary then there 
are good reasons not to do it.

-boris

  parent reply	other threads:[~2015-05-06 15:11 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-04  2:16 [PATCH 1/3] xen/vt-d: need barriers to workaround CLFLUSH Tiejun Chen
2015-05-04  2:16 ` [PATCH 2/3] xen/vt-d: mask interrupt message generation Tiejun Chen
2015-05-04  4:07   ` Zhang, Yang Z
2015-05-04  5:08     ` Chen, Tiejun
2015-05-04  6:41       ` Zhang, Yang Z
2015-05-04  8:57       ` Jan Beulich
2015-05-04 11:21         ` Chen, Tiejun
2015-05-04  2:16 ` [PATCH 3/3] xen/iommu: disable IOMMU engine completely before enter S5 Tiejun Chen
2015-05-04  9:00   ` Jan Beulich
2015-05-04  4:07 ` [PATCH 1/3] xen/vt-d: need barriers to workaround CLFLUSH Zhang, Yang Z
2015-05-04  8:52 ` Jan Beulich
2015-05-04  9:14   ` Andrew Cooper
2015-05-04  9:24     ` Jan Beulich
2015-05-05  1:13       ` Zhang, Yang Z
2015-05-05 15:46     ` Boris Ostrovsky
2015-05-05 15:58       ` Jan Beulich
2015-05-05 16:11         ` Boris Ostrovsky
2015-05-06  7:12           ` Jan Beulich
2015-05-06  7:26             ` Chen, Tiejun
2015-05-06  7:33               ` Jan Beulich
2015-05-06 15:11             ` Boris Ostrovsky [this message]
2015-05-06  7:09       ` Chen, Tiejun
2015-05-04 10:39   ` Chen, Tiejun
2015-05-04 10:43     ` Jan Beulich
2015-05-04 10:52       ` Tian, Kevin
2015-05-04 11:26         ` Chen, Tiejun
2015-05-05  1:13           ` Tian, Kevin
2015-05-05  2:45       ` Chen, Tiejun
2015-05-05  9:24         ` Jan Beulich
2015-05-06  6:47           ` Chen, Tiejun
2015-05-06  7:14             ` Jan Beulich
2015-05-04 15:22     ` Konrad Rzeszutek Wilk
2015-05-04 15:33       ` Andrew Cooper

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=554A2F3E.8070008@oracle.com \
    --to=boris.ostrovsky@oracle.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=jinsong.liu@alibaba-inc.com \
    --cc=keir@xen.org \
    --cc=kevin.tian@intel.com \
    --cc=tiejun.chen@intel.com \
    --cc=xen-devel@lists.xen.org \
    --cc=yang.z.zhang@intel.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.