All of lore.kernel.org
 help / color / mirror / Atom feed
From: Shaohua Li <shli-b10kYP2dOMg@public.gmane.org>
To: Benjamin Serebrin <serebrin-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
Cc: Dan Tsafrir
	<dan-FrESSTt7Abv7r6psnUbsSmZHpeb/A1Y/@public.gmane.org>,
	Omer Peleg
	<omer-FrESSTt7Abv7r6psnUbsSmZHpeb/A1Y/@public.gmane.org>,
	iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
	Adam Morrison
	<mad-FrESSTt7Abv7r6psnUbsSmZHpeb/A1Y/@public.gmane.org>,
	Godfrey van der Linden
	<gvdl-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
	David Woodhouse <dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>,
	Kernel-team-b10kYP2dOMg@public.gmane.org
Subject: Re: [PATCH v2 7/7] iommu: introduce per-cpu caching to iova allocation
Date: Thu, 14 Apr 2016 14:33:36 -0700	[thread overview]
Message-ID: <20160414213326.GA474260@devbig084.prn1.facebook.com> (raw)
In-Reply-To: <CAN+hb0WOaokFYc6C+mR6rdj4WwmMUSzDHDZngfUvy-5cEve_-g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On Thu, Apr 14, 2016 at 02:18:32PM -0700, Benjamin Serebrin wrote:
> On Thu, Apr 14, 2016 at 2:05 PM, Adam Morrison <mad-FrESSTt7Abv7r6psnUbsSmZHpeb/A1Y/@public.gmane.org> wrote:
> > On Thu, Apr 14, 2016 at 9:26 PM, Benjamin Serebrin via iommu
> > <iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org> wrote:
> >
> >> It was pointed out that DMA_32 or _24 (or anything other non-64 size)
> >> could be starved if the magazines on all cores are full and the depot
> >> is empty.  (This gets more probable with increased core count.)  You
> >> could try one more time: call free_iova_rcaches() and try alloc_iova
> >> again before giving up
> >
> > That's not safe, unfortunately.  free_iova_rcaches() is meant to be
> > called only when the domain is dying and the CPUs won't access the
> > rcaches.
> 
> Fair enough.  Is it possible to make this safe, cleanly and without
> too much locking during the normal case?
> 
> > It's tempting to make the rcaches work only for DMA_64 allocations.
> > This would also solve the problem of respecting the pfn_limit when
> > allocating, which Shaohua Li pointed out.  Sadly, intel-iommu.c
> > converts DMA_64 to DMA_32 by default, apparently to avoid dual address
> > cycles on the PCI bus.  I wonder about the importance of this, though,
> > as it doesn't seem that anything equivalent happens when iommu=off.
> 
> I agree.  It's tempting to make all DMA_64 allocations grow up from
> 4G, leaving the entire 32 bit space free for small allocations.  I'd
> be willing to argue that that should be the default, with some
> override for anyone who finds it objectionable.
> 
> Dual address cycle is really "4 more bytes in the TLP header" on PCIe;
> a 32-bit address takes 3 doublewords (12 bytes) while a 64-bit address
> takes 4 DW (16 bytes).  What's 25% of a read request between friends?
> And every read request has a read response 3DW TLP plus its data, so
> the aggregate bandwidth consumed is getting uninteresting.  Similarly
> for writes, the additional address bytes don't cost a large
> percentage.
> 
> That being said, it's a rare device that needs more than 4GB of active
> address space, and it's a rare system that needs to mix a
> performance-critical DMA_32 (or 24) and _64 device in the same page
> table.

I'm not sure about the TLP overhead. IOMMU is not only for pcie device.
there are pcie-to-pcix/pci bridge, any pci device can reside behind it.
The device might not handle DMA_64. DAC has overhead for pcix device
iirc, which somebody might care about. So let's not break such devices.

Thanks,
Shaohua

  parent reply	other threads:[~2016-04-14 21:33 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-13 18:50 [PATCH v2 0/7] Intel IOMMU scalability improvements Adam Morrison
     [not found] ` <cover.1460548546.git.mad-FrESSTt7Abv7r6psnUbsSmZHpeb/A1Y/@public.gmane.org>
2016-04-13 18:51   ` [PATCH v2 1/7] iommu: refactoring of deferred flush entries Adam Morrison
2016-04-13 18:51   ` [PATCH v2 2/7] iommu: per-cpu deferred invalidation queues Adam Morrison
2016-04-13 18:51   ` [PATCH v2 3/7] iommu: correct flush_unmaps pfn usage Adam Morrison
2016-04-13 18:52   ` [PATCH v2 4/7] iommu: only unmap mapped entries Adam Morrison
     [not found]     ` <e07164c8d0aaff68cabd2cf8e3aee9ed20882ae4.1460548546.git.mad-FrESSTt7Abv7r6psnUbsSmZHpeb/A1Y/@public.gmane.org>
2016-04-13 20:37       ` Shaohua Li
2016-04-13 18:52   ` [PATCH v2 5/7] iommu: avoid dev iotlb logic in intel-iommu for domains with no dev iotlbs Adam Morrison
2016-04-13 18:52   ` [PATCH v2 6/7] iommu: change intel-iommu to use IOVA frame numbers Adam Morrison
2016-04-13 18:52   ` [PATCH v2 7/7] iommu: introduce per-cpu caching to iova allocation Adam Morrison
     [not found]     ` <b208a304d83088aae7ecac10a3062dc57c0a2f79.1460548546.git.mad-FrESSTt7Abv7r6psnUbsSmZHpeb/A1Y/@public.gmane.org>
2016-04-13 20:43       ` Shaohua Li
2016-04-14 18:26       ` Benjamin Serebrin via iommu
     [not found]         ` <CAN+hb0W=+tuQp3cm_VKoU=LKiVQDPMtGrZGq=59rcaWsy2S-+A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-04-14 21:05           ` Adam Morrison
     [not found]             ` <CAHMfzJmjZWeUpmTVb-Z7NMJUp0N84ZK4zwUWdAKHv4sd4TXPMg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-04-14 21:18               ` Benjamin Serebrin via iommu
     [not found]                 ` <CAN+hb0WOaokFYc6C+mR6rdj4WwmMUSzDHDZngfUvy-5cEve_-g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-04-14 21:33                   ` Shaohua Li [this message]
     [not found]                     ` <20160414213326.GA474260-tb7CFzD8y5b7E6g3fPdp/g2O0Ztt9esIQQ4Iyu8u01E@public.gmane.org>
2016-04-15  4:59                       ` Benjamin Serebrin via iommu
     [not found]                         ` <CAN+hb0WRDYCpY8xoUvvGu4SSD83F9VTMW=9W=xfjYtJV-dijmQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-04-15 17:55                           ` Shaohua Li
     [not found]                             ` <20160415175520.GA2644484-tb7CFzD8y5b7E6g3fPdp/g2O0Ztt9esIQQ4Iyu8u01E@public.gmane.org>
2016-04-17 18:05                               ` Adam Morrison

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=20160414213326.GA474260@devbig084.prn1.facebook.com \
    --to=shli-b10kyp2domg@public.gmane.org \
    --cc=Kernel-team-b10kYP2dOMg@public.gmane.org \
    --cc=dan-FrESSTt7Abv7r6psnUbsSmZHpeb/A1Y/@public.gmane.org \
    --cc=dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
    --cc=gvdl-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=mad-FrESSTt7Abv7r6psnUbsSmZHpeb/A1Y/@public.gmane.org \
    --cc=omer-FrESSTt7Abv7r6psnUbsSmZHpeb/A1Y/@public.gmane.org \
    --cc=serebrin-hpIqsD4AKlfQT0dZR+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 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.