Linux IOMMU Development
 help / color / mirror / Atom feed
From: David Woodhouse <dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
To: Linus Torvalds
	<torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>
Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
Subject: Re: [GIT PULL] Intel IOMMU for 4.1
Date: Mon, 27 Apr 2015 18:28:39 +0100	[thread overview]
Message-ID: <1430155719.6377.34.camel@infradead.org> (raw)
In-Reply-To: <CA+55aFx+QhMZpCtnG2sHib+kk5BR+PeEa99-CCushSA5oAqVxw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>


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

On Mon, 2015-04-27 at 08:48 -0700, Linus Torvalds wrote:
> On Mon, Apr 27, 2015 at 8:39 AM, Alex Williamson
> <alex.williamson-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> wrote:
> > 
> > Since this got pulled anyway, do you plan to follow-up with 
> > patches to
> > limit the graphics RMRR exception to the known and acceptable uses 
> > and
> > document them, or should I send a revert patch?  I don't think 
> > what we
> > have here is acceptable going forward or being backported to 
> > stable.
> > Thanks,
> 
> Does anybody actually *care* about RMRR?
> 
> The thing is shit. We know it's shit. We already had Linda pipe up to
> tell us that there are bogus RMRR's for ever slot in older machines.
> And we already ignore RMRR for USB controllers because it was just
> useless garbage.

RMRR for USB controllers was useless garbage because any operating
system new enough to enable the IOMMU is *also* going to have USB
support, so shouldn't need to rely on the BIOS doing legacy
keyboard/mouse emulation. Which is the only reason the firmware would
need to keep doing DMA from the USB controllers after we boot.

They could have just said "quiesce the USB BIOS stuff before turning
on the IOMMU" and they wouldn't have needed RMRR for USB.

But even so, we don't just "ignore" the RMRR. We do set it the 1:1
mapping as requested, otherwise we'd get a stream of faults and the
BIOS might even lock up in SMM code if its error handling is crap.


The thing we *don't* do is faithfully preserve that 1:1 mapping for
ever. If we assign the device to a VM guest, the RMRR mapping is lost.

We've never preserved those mappings, and it's only ever been a
problem on the insane crap that HP does with firmware-controlled DMA
from stuff like storage controllers, which persists even at runtime
after we're *using* said controller.

(You might think it would have been easy enough for them to do their
special DMA from another B-D-F but perhaps that would have been too
easy for us.)

It's extremely hard to preserve those mappings when assigning to a
guest, because we'd actually have to poke a corresponding hole in the
guest's physical address space (because in this case GPA==IOVA and
those IOVAs are being used by the BIOS with a 1:1 mapping to HPA).

Hence Alex's patch which blacklisted the 'unknown' RMRR-afflicted
devices and prevented them from being assigned to guests (and also it
seems from honouring 'iommu=pt'; qv.).

> Is there any reason to *not* just ignore RMRR for all video devices
> like we do now? Seriously?

The video case is actually the *sanest* use of RMRR. With a
framebuffer in main memory, the RMRR is the only thing that lets the
graphics device continue to render pixels from the framebuffer after
the IOMMU is initialised. So we *definitely* can't just 'ignore' the
RMRR there. And we don't.

But assignment of such graphics devices to guests *has* allegedly been
working (and iommu=pt is kind of nice too because of the performance
issues), and there's no reason for them to be excluded. They can be
lumped in with the USB devices as "OK to assign to guests".  We lose
the 1:1 mapping indicated by the RMRR but that's OK because the guest
has to initialise the hardware entirely for itself and set up its
*own* framebuffer.

> I'm *so* not impressed with firmware tables. These things are always
> uniformly wrong. We should strive to generate the information from 
> our actual hardware knowledge, with BIOS tables being the absolutely
> least trusted source of information.

... which is why the whole of the VT-d design, exposing this crap
through firmware tables instead of hardware discoverability, makes me
cringe. But while I am tilting at windmills internally to at least get
people to realise why that's such a design flaw, we still have to deal
with this crap. And with the insane things that HP abuse it for.

-- 
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:[~2015-04-27 17:28 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-26  8:51 [GIT PULL] Intel IOMMU for 4.1 David Woodhouse
     [not found] ` <1430038266.4833.14.camel-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2015-04-26 17:33   ` Alex Williamson
     [not found]     ` <1430069591.8301.91.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-04-26 17:55       ` David Woodhouse
     [not found]         ` <1430070924.13479.5.camel-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2015-04-26 18:16           ` Alex Williamson
     [not found]             ` <1430072207.8301.103.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-04-27 14:00               ` Linda Knippers
     [not found]                 ` <553E4109.5060903-VXdhtT5mjnY@public.gmane.org>
2015-04-27 15:39                   ` Alex Williamson
     [not found]                     ` <1430149195.4472.43.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-04-27 15:48                       ` Linus Torvalds
     [not found]                         ` <CA+55aFx+QhMZpCtnG2sHib+kk5BR+PeEa99-CCushSA5oAqVxw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-04-27 16:09                           ` Linda Knippers
2015-04-27 16:16                           ` Alex Williamson
2015-04-27 17:28                           ` David Woodhouse [this message]
2015-04-27 17:12                       ` David Woodhouse
     [not found]                         ` <1430154752.6377.19.camel-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>
2015-04-27 17:30                           ` Alex Williamson

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=1430155719.6377.34.camel@infradead.org \
    --to=dwmw2-wegcikhe2lqwvfeawa7xhq@public.gmane.org \
    --cc=iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=torvalds-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@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