From: "Michael S. Tsirkin" <mst@redhat.com>
To: Peter Xu <peterx@redhat.com>
Cc: Marcel Apfelbaum <marcel@redhat.com>,
qemu-devel@nongnu.org, yi.l.liu@intel.com,
Jintack Lim <jintack@cs.columbia.edu>,
Alex Williamson <alex.williamson@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v2] intel_iommu: check misordered init when realize
Date: Wed, 1 Mar 2017 05:23:44 +0200 [thread overview]
Message-ID: <20170301043802-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20170301023635.GE13926@pxdev.xzpeter.org>
On Wed, Mar 01, 2017 at 10:36:35AM +0800, Peter Xu wrote:
> On Tue, Feb 28, 2017 at 04:42:25PM +0200, Marcel Apfelbaum wrote:
> > On 02/24/2017 06:29 AM, Peter Xu wrote:
> > >Intel vIOMMU devices are created with "-device" parameter, while here
> > >actually we need to make sure the dmar device be created before other
> > >PCI devices (like vfio-pci) so that we know iommu_fn will be setup
> > >correctly before realizations of those PCI devices (it is sensible that
> > >PCI device fetch these info during its realization). Now this ordering
> > >yet cannot be achieved elsewhere, and devices will be created in the
> > >order that user specified. That might be dangerous.
> > >
> > >Here we add one more function to detect this kind of misordering issue,
> > >then report to guest. Currently, the only known device that is affected
> > >by this VT-d defect is the vfio-pci typed devices. So for now we just
> > >check against it to make sure we are safe.
> > >
> >
> > Hi,
> > I can't say that I like it but if we want it for 2.9 maybe we don't have a choice.
> >
> > I mentioned in another thread other idea:
> > Maybe we should follow the same "template" as disk/drive, nic/netdev ?
> > I mean something like -device iommu,id=i1, -device vfio-pci,iommu=e1 .
> > You are able to change the order, I didn't look how it is done.
>
> I suppose that's done by using different keywords. For example:
>
> -netdev user,id=net0 -device e1000,netdev=net0
>
> Here we are using "netdev" for the backend and "device" for the
> frontend.
>
> Since we have this difference, we can just make sure the ordering by
> init netdev first (in net_init_clients()), then the devices (in
> device_init_func()).
>
> >
> > A nice side effect is that you can:
> > 1. Limit the iommu scope only to the devices you want to protect (tweaking APCI tables)
> > 2. In the future we can support multiple iommu devices.
Unfortunately AFAIK this needs a bunch of work in practice:
host and guest side.
So this opens a can of worms: you can all too easily create
configurations that we don't support.
>
> Yes. Thanks,
>
> -- peterx
While I agree this fixes the specific problem, we have the ordering
issue in many other places. For example, this is one of the reasons we
don't create built-in PC devices using QOM composition.
So I think that support for dependencies does make a lot of sense
generally.
--
MST
next prev parent reply other threads:[~2017-03-01 3:23 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-24 4:29 [Qemu-devel] [PATCH v2] intel_iommu: check misordered init when realize Peter Xu
2017-02-24 5:07 ` Pankaj Gupta
2017-02-24 5:50 ` Peter Xu
2017-02-24 6:35 ` Pankaj Gupta
2017-02-24 7:10 ` Peter Xu
2017-02-24 8:42 ` Pankaj Gupta
2017-02-28 14:42 ` Marcel Apfelbaum
2017-03-01 2:36 ` Peter Xu
2017-03-01 3:23 ` Michael S. Tsirkin [this message]
2017-03-01 4:14 ` Jason Wang
2017-03-01 7:03 ` Marcel Apfelbaum
2017-03-01 8:43 ` Jason Wang
2017-03-01 9:05 ` Marcel Apfelbaum
2017-03-01 9:18 ` Peter Xu
2017-03-01 9:29 ` Marcel Apfelbaum
2017-03-01 9:59 ` Peter Xu
2017-03-01 12:32 ` Marcel Apfelbaum
2017-03-02 3:45 ` Peter Xu
2017-03-02 3:39 ` Peter Xu
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=20170301043802-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=jintack@cs.columbia.edu \
--cc=marcel@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=yi.l.liu@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.