Linux IOMMU Development
 help / color / mirror / Atom feed
From: David Woodhouse <dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
To: Alex Williamson
	<alex.williamson-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: "Singh,
	Varinder"
	<Varinder.Singh-HgOvQuBEEgTQT0dZR+AlfA@public.gmane.org>,
	"Sundaram,
	Rajesh" <Rajesh.Sundaram-HgOvQuBEEgTQT0dZR+AlfA@public.gmane.org>,
	"Kimmel,
	Jeff" <jeff.kimmel-HgOvQuBEEgTQT0dZR+AlfA@public.gmane.org>,
	"iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org"
	<iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org>,
	"Shankar,
	Hari" <Hari.Shankar-HgOvQuBEEgTQT0dZR+AlfA@public.gmane.org>,
	"Spiller,
	John" <John.Spiller-HgOvQuBEEgTQT0dZR+AlfA@public.gmane.org>
Subject: Re: [PATCH] On unmap, flush IOMMU TLB and return correct size
Date: Wed, 25 Sep 2013 23:15:48 +0100	[thread overview]
Message-ID: <1380147348.28494.37.camel@i7.infradead.org> (raw)
In-Reply-To: <1380145560.5197.94.camel-85EaTFmN5p//9pzu0YdTqQ@public.gmane.org>


[-- Attachment #1.1: Type: text/plain, Size: 2342 bytes --]

On Wed, 2013-09-25 at 15:46 -0600, Alex Williamson wrote:
> On Wed, 2013-09-25 at 21:11 +0100, David Woodhouse wrote:
> > I wouldn't bother to go looking for opportunities to use super pages if
> > we remove the last non-SP-capable IOMMU from the domain.
> 
> I predict bugs getting filed if a guest sees a performance hit after
> adding a device that is not restored when the device is removed.  If
> only we could assume a similar feature set among IOMMUs in a system.

Ok, fine. As long as you don't have *too* much mapped, that shouldn't
suck too much.

> > > > FWIW we currently screw up the handling of cache-coherent vs.
> > > > non-coherent page tables too. That one wants a wbinvd somewhere when we
> > > > add a non-coherent IOMMU to the domain.
> > > 
> > > You're not selling the "trust the IOMMU driver" story very well here.
> > > Can we assume that the IOMMU_CACHE flag (SNP) is ignored appropriately
> > > by non-coherent IOMMUs?  Is there any downside to ignoring it and always
> > > setting SNP in the IOMMU page tables?  AMD IOMMU ignores it, but it's
> > > also always cache coherent.  Thanks,
> > 
> > SNP is a separate issue. I'm speaking of cache coherency of the hardware
> > page table walk — the feature bit that all the horrid clflush calls are
> > predicated on.
> > 
> > Again, this is just a bug. We *should* be getting this right, but don't
> > yet.
> 
> And for DMA_PTE_SNP?  intel_iommu_map() won't let us set this bit if the
> domain contains a hardware unit that doesn't support ecap.SC, but it
> also doesn't update existing mappings.  Barring hardware bugs, it seems
> much easier to unconditionally set DMA_PTE_SNP but still advertise
> IOMMU_CAP_CACHE_COHERENCY based on the composition of the domain.
> Otherwise we have to reject adding devices to a domain that change the
> coherency once DMA mappings are in play or never set IOMMU_CACHE and
> advertise to KVM that the domain is always non-coherent.  Thanks,

It's not that the domain is non-coherent, is it? The SNP bit allows you
to *force* a PCIe DMA request to snoop the CPU cache, even if it didn't
*request* that.

If your device is actually *trying* to do cache-coherent (i.e. snooping)
DMA, surely that works regardless of the DMA_PTE_SNP setting?

Or am I missing something?


-- 
dwmw2

[-- Attachment #1.2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 5745 bytes --]

[-- Attachment #2: Type: text/plain, Size: 0 bytes --]



  parent reply	other threads:[~2013-09-25 22:15 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-02  2:24 [PATCH] On unmap, flush IOMMU TLB and return correct size Shankar, Hari
     [not found] ` <CE494510.41547%hshankar-HgOvQuBEEgTQT0dZR+AlfA@public.gmane.org>
2013-09-03  4:25   ` Alex Williamson
     [not found]     ` <1378182340.3246.19.camel-85EaTFmN5p//9pzu0YdTqQ@public.gmane.org>
2013-09-05  4:05       ` Shankar, Hari
     [not found]         ` <CE4D489F.41EE8%hshankar-HgOvQuBEEgTQT0dZR+AlfA@public.gmane.org>
2013-09-05  4:58           ` Alex Williamson
2013-09-22  2:59   ` David Woodhouse
     [not found]     ` <1379818740.2547.51.camel-Fexsq3y4057IgHVZqg5X0TlWvGAXklZc@public.gmane.org>
2013-09-25 15:54       ` Joerg Roedel
     [not found]         ` <20130925155459.GA20372-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2013-09-25 16:05           ` David Woodhouse
     [not found]             ` <1380125113.28494.14.camel-W2I5cNIroUsVm/YvaOjsyQ@public.gmane.org>
2013-09-25 16:58               ` Joerg Roedel
2013-09-25 17:36               ` Alex Williamson
     [not found]                 ` <1380130588.3030.342.camel-85EaTFmN5p//9pzu0YdTqQ@public.gmane.org>
2013-09-25 18:52                   ` David Woodhouse
     [not found]                     ` <1380135148.28494.26.camel-W2I5cNIroUsVm/YvaOjsyQ@public.gmane.org>
2013-09-25 19:44                       ` Alex Williamson
     [not found]                         ` <1380138243.5197.20.camel-85EaTFmN5p//9pzu0YdTqQ@public.gmane.org>
2013-09-25 20:11                           ` David Woodhouse
     [not found]                             ` <1380139886.28494.31.camel-W2I5cNIroUsVm/YvaOjsyQ@public.gmane.org>
2013-09-25 21:46                               ` Alex Williamson
     [not found]                                 ` <1380145560.5197.94.camel-85EaTFmN5p//9pzu0YdTqQ@public.gmane.org>
2013-09-25 22:15                                   ` David Woodhouse [this message]
     [not found]                                     ` <1380147348.28494.37.camel-W2I5cNIroUsVm/YvaOjsyQ@public.gmane.org>
2013-09-25 22:40                                       ` Alex Williamson
2013-09-25 16:33           ` Alex Williamson
2013-10-02 15:04       ` David Woodhouse

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=1380147348.28494.37.camel@i7.infradead.org \
    --to=dwmw2-wegcikhe2lqwvfeawa7xhq@public.gmane.org \
    --cc=Hari.Shankar-HgOvQuBEEgTQT0dZR+AlfA@public.gmane.org \
    --cc=John.Spiller-HgOvQuBEEgTQT0dZR+AlfA@public.gmane.org \
    --cc=Rajesh.Sundaram-HgOvQuBEEgTQT0dZR+AlfA@public.gmane.org \
    --cc=Varinder.Singh-HgOvQuBEEgTQT0dZR+AlfA@public.gmane.org \
    --cc=alex.williamson-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=jeff.kimmel-HgOvQuBEEgTQT0dZR+AlfA@public.gmane.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