qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3] intel_iommu: check misordered init when real


From: Marcel Apfelbaum
Subject: Re: [Qemu-devel] [PATCH v3] intel_iommu: check misordered init when realize
Date: Wed, 8 Mar 2017 15:20:57 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1

On 03/08/2017 12:08 PM, Jason Wang wrote:


On 2017年03月08日 16:35, Paolo Bonzini wrote:

----- Original Message -----
From: "Marcel Apfelbaum" <address@hidden>
To: "Michael S. Tsirkin" <address@hidden>, "Peter Xu" <address@hidden>
Cc: address@hidden, "Paolo Bonzini" <address@hidden>, "yi l liu" <address@hidden>, 
"Jintack Lim"
<address@hidden>, "Jason Wang" <address@hidden>, "Alex Williamson" 
<address@hidden>
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 <address@hidden>
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.

I suggested to Laine to require libvirt to initialize first the iommu device.
and since most QEMU users use libvirt anyway, we may just be OK (kind of).

And to eliminate similar issues, we may initializing the pci devices by 
traversing the PCI tree from root complex in level order.

Interesting idea, we'll explore it for 2.10.
But we need initialization order for all machine components, not only PCI.

Thanks,
Marcel


Thanks




reply via email to

[Prev in Thread] Current Thread [Next in Thread]