Fix rescan PCI conflicts with shpchp / pciehp#2461
Conversation
29c7f51 to
01e1a87
Compare
|
/test |
Codecov Report
@@ Coverage Diff @@
## master #2461 +/- ##
=========================================
Coverage ? 50.57%
=========================================
Files ? 116
Lines ? 16597
Branches ? 0
=========================================
Hits ? 8394
Misses ? 7177
Partials ? 1026 |
|
@Jimmy-Xu does |
|
@devimc So, I added a parameter |
|
@devimc This is also a solution. |
|
@Jimmy-Xu I am not in favor of adding a config option in the configuration.toml for delaying attaching devices. Also, @devimc pointed out about not rescanning PCI bus again. Here is the background for why the rescan was added in the first place: According to that comment and the one following it, we do not need to rescan the PCI bus at all for |
|
In summary, we couldn't remove the rescan for q35 to avoid the 5 sec SHPC delay. I think @Jimmy-Xu 's way is a good choice: dividing those device into two classes: one was didn't need big io space and could be rescaned, we could hotplug them before the "rescan" action, and the other class is those devices need a big io spaces and depened on the hotplug Of course, it's better to do this classification automatically, but I could't figure out an easy way to recognize whether the specific device needs a big IO space or not. |
does kata-agent wait 5 seconds for the device before creating the container? otherwise the workload has to wait 5 seconds until the device is visible in the container |
Hi, @devimc , the answer is no. That's why we shouldn't remove the "rescan" action. |
|
By default, the Since the For the first solution, the kata-agent needs to check when shpchp / pciehp works, but For the second solution, the kata shim can identify large BAR space devices and delay attachment. In this PR: Another way: Maybe there is a way to identify Large BAR space device |
317bc1a to
3e53560
Compare
|
/test |
3e53560 to
39ee2a6
Compare
amshinde
left a comment
There was a problem hiding this comment.
I updated the solution:
detect VFIO device, if it is a device with large BAR space, delay to attach it.
Thanks @Jimmy-Xu This is what I was looking for, detecting devices that require large BAR space and attaching them after PCI scan. PR looks lot better. I have left a few comments.
|
/test |
- support attach large bar space vfio devices after create container fixes kata-containers#2460 Signed-off-by: Jimmy Xu <junming.xjm@antfin.com>
39ee2a6 to
c6cc8b9
Compare
|
/test |
PCI bus rescan code was added long time ago in Clear Containers due to lack of ACPI support in QEMU 2.9 + q35 [1]. Now this code is messing up PCIe hotplug in Kata Containers. A workaround to this issue is the "lazy attach" mechanism [2] that hotplugs LBS (Large BAR space) devices after re-scanning the PCI bus, unfourtunately some non-LBS devices are being affected too, for instance SR-IOV devices. It would not make sense to lazy-attach non-LBS devices because kata will end up lazy-attaching all the devices, having said that, the PCI bus rescan code and the "lazy attach" mechanism should be removed fixes kata-containers#781 fixes kata-containers/runtime#2664 [1]: clearcontainers/agent#139 [2]: kata-containers/runtime#2461 Signed-off-by: Julio Montes <julio.montes@intel.com>
The "lazy attach" mechanism [1] was added to hotplugs LBS (Large BAR space) devices after re-scanning the PCI bus, fixing LBS hotplug in kata containers. Since PCI rescan is removed in kata-containers/agent#782, lazy attach is not longer needed. Depends-on: github.com/kata-containers/agent#782 fixes kata-containers#2664 [1] kata-containers#2461 Signed-off-by: Julio Montes <julio.montes@intel.com>
PCI bus rescan code was added long time ago in Clear Containers due to lack of ACPI support in QEMU 2.9 + q35 [1]. Now this code is messing up PCIe hotplug in Kata Containers. A workaround to this issue is the "lazy attach" mechanism [2] that hotplugs LBS (Large BAR space) devices after re-scanning the PCI bus, unfourtunately some non-LBS devices are being affected too, for instance SR-IOV devices. It would not make sense to lazy-attach non-LBS devices because kata will end up lazy-attaching all the devices, having said that, the PCI bus rescan code and the "lazy attach" mechanism should be removed Depends-on: github.com/kata-containers/runtime#2670 fixes kata-containers#781 fixes kata-containers/runtime#2664 [1] clearcontainers/agent#139 [2] kata-containers/runtime#2461 Signed-off-by: Julio Montes <julio.montes@intel.com>
The "lazy attach" mechanism [1] was added to hotplugs LBS (Large BAR space) devices after re-scanning the PCI bus, fixing LBS hotplug in kata containers. Since PCI rescan is removed in kata-containers/agent#782, lazy attach is not longer needed. Depends-on: github.com/kata-containers/agent#782 fixes kata-containers#2664 [1] kata-containers#2461 Signed-off-by: Julio Montes <julio.montes@intel.com>
PCI bus rescan code was added long time ago in Clear Containers due to lack of ACPI support in QEMU 2.9 + q35 [1]. Now this code is messing up PCIe hotplug in Kata Containers. A workaround to this issue is the "lazy attach" mechanism [2] that hotplugs LBS (Large BAR space) devices after re-scanning the PCI bus, unfourtunately some non-LBS devices are being affected too, for instance SR-IOV devices. It would not make sense to lazy-attach non-LBS devices because kata will end up lazy-attaching all the devices, having said that, the PCI bus rescan code and the "lazy attach" mechanism should be removed Depends-on: github.com/kata-containers/runtime#2670 fixes kata-containers#781 fixes kata-containers/runtime#2664 [1] clearcontainers/agent#139 [2] kata-containers/runtime#2461 Signed-off-by: Julio Montes <julio.montes@intel.com>
PCI bus rescan code was added long time ago in Clear Containers due to lack of ACPI support in QEMU 2.9 + q35 [1]. Now this code is messing up PCIe hotplug in Kata Containers. A workaround to this issue is the "lazy attach" mechanism [2] that hotplugs LBS (Large BAR space) devices after re-scanning the PCI bus, unfourtunately some non-LBS devices are being affected too, for instance SR-IOV devices. It would not make sense to lazy-attach non-LBS devices because kata will end up lazy-attaching all the devices, having said that, the PCI bus rescan code and the "lazy attach" mechanism should be removed Depends-on: github.com/kata-containers/runtime#2670 fixes kata-containers#781 fixes kata-containers/runtime#2664 [1] clearcontainers/agent#139 [2] kata-containers/runtime#2461 Signed-off-by: Julio Montes <julio.montes@intel.com>
The "lazy attach" mechanism [1] was added to hotplugs LBS (Large BAR space) devices after re-scanning the PCI bus, fixing LBS hotplug in kata containers. Since PCI rescan is removed in kata-containers/agent#782, lazy attach is not longer needed. fixes kata-containers#2664 [1] kata-containers#2461 Signed-off-by: Julio Montes <julio.montes@intel.com>
This is a solution to issue #2460 .
Since the pci rescan will conflict with shpchp / pciehp, we can attach the Nvidia GPU after creating the container, and then the pci rescan will not include the Nvidia GPU.
shpchp / pciehp will handle hot plugging of Nvidia GPU correctly.
There may be better solutions, but this is a working solution.