qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jason Wang <jasowang@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
	Marcel Apfelbaum <marcel@redhat.com>
Cc: yi l liu <yi.l.liu@intel.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	qemu-devel@nongnu.org, Peter Xu <peterx@redhat.com>,
	Alex Williamson <alex.williamson@redhat.com>,
	Jintack Lim <jintack@cs.columbia.edu>
Subject: Re: [Qemu-devel] [PATCH v3] intel_iommu: check misordered init when realize
Date: Wed, 8 Mar 2017 18:08:18 +0800	[thread overview]
Message-ID: <d7882933-68f0-f4dd-4d1e-a16dde079ce3@redhat.com> (raw)
In-Reply-To: <1149211275.29885713.1488962150826.JavaMail.zimbra@redhat.com>



On 2017年03月08日 16:35, Paolo Bonzini wrote:
>
> ----- Original Message -----
>> From: "Marcel Apfelbaum" <marcel@redhat.com>
>> To: "Michael S. Tsirkin" <mst@redhat.com>, "Peter Xu" <peterx@redhat.com>
>> Cc: qemu-devel@nongnu.org, "Paolo Bonzini" <pbonzini@redhat.com>, "yi l liu" <yi.l.liu@intel.com>, "Jintack Lim"
>> <jintack@cs.columbia.edu>, "Jason Wang" <jasowang@redhat.com>, "Alex Williamson" <alex.williamson@redhat.com>
>> Sent: Thursday, March 2, 2017 7:24:44 AM
>> Subject: Re: [PATCH v3] intel_iommu: check misordered init when realize
>>
>> On 03/02/2017 07:13 AM, Michael S. Tsirkin wrote:
>>> On Thu, Mar 02, 2017 at 11:32:18AM +0800, 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, virtio-pci ones) so that we know iommu_fn
>>>> will be setup correctly before realizations of those PCI devices (it is
>>>> legal 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. We need to avoid that.
>>>>
>>>> This patch tries to detect this kind of misordering issue during init of
>>>> VT-d device, then report to guest if misordering happened. In the
>>>> future, we can provide something better to solve it, e.g., to support
>>>> device init ordering, then we can live without this patch.
>>>>
>>>> Signed-off-by: Peter Xu <peterx@redhat.com>
>>> Unfortunately with virtio it's a regression, as it used to
>>> work with iommu. So I'm afraid we need to look into supporting
>>> arbitrary order right now :(
>>>
>> Hi,
>>
>> A fast way to do it is to initialize iommu with a new keyword, like
>>       -iommu intel-iommu
>> Or maybe use the existing "-object" somehow ?
>>   From vl.c comments:
>>     "Initial object creation happens before all other
>>      QEMU data types are created.... "
>>
>> Another idea is to add a third run on QEMU cmd line arguments,
>> but this would affect the whole system.
>>
>> However having an ordering system beats all other ideas.
> The ordering should be explicit in the command line.  Since we do not have
> cycles, it should be possible.
>
> The best solution would have been to add something like
>
>     -device intel-iommu,id=root-complex-iommu -global mch.iommu=root-complex-iommu
>
> but it's too late for that.
>
> Paolo
>

Yes, it's probably too late other than having workarounds for 2.9. And 
to eliminate similar issues, we may initializing the pci devices by 
traversing the PCI tree from root complex in level order.

Thanks

  parent reply	other threads:[~2017-03-08 10:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-02  3:32 [Qemu-devel] [PATCH v3] intel_iommu: check misordered init when realize Peter Xu
2017-03-02  5:13 ` Michael S. Tsirkin
2017-03-02  5:20   ` Peter Xu
2017-03-02  5:28     ` Michael S. Tsirkin
2017-03-02  6:24   ` Marcel Apfelbaum
2017-03-08  8:35     ` Paolo Bonzini
2017-03-08  8:59       ` Peter Xu
2017-03-08  9:25         ` Gerd Hoffmann
2017-03-10  7:04           ` Peter Xu
2017-03-08 10:08       ` Jason Wang [this message]
2017-03-08 13:20         ` Marcel Apfelbaum

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=d7882933-68f0-f4dd-4d1e-a16dde079ce3@redhat.com \
    --to=jasowang@redhat.com \
    --cc=alex.williamson@redhat.com \
    --cc=jintack@cs.columbia.edu \
    --cc=marcel@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).