-
Notifications
You must be signed in to change notification settings - Fork 373
virtcontainers: POC support for coldplugging PCI devices #705
Conversation
Adds support for coldplugging PCI devices at VM boot rather than hotplugging. Fixes: kata-containers#704 Signed-off-by: Edward Guzman <[email protected]>
PSS Measurement: Memory inside container: |
Build failed (third-party-check pipeline) integration testing with
|
Thank you for raising this! But if you want to modify govmm codes, you should also raise a PR in https://github.com/intel/govmm. When that PR gets merged, change this PR to 2 commits. The first one uses dep to import vendor changes, the second one is changes in this repo. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for raising @eguzman3! I appreciate this is a POC but have a few questions.
Ideally, we'd also have some unit tests to supplement the code changes and as noted the vendor changes would need to be made upstream first.
} | ||
|
||
// getBDF returns the BDF of pci device | ||
// Expected input strng format is [<domain>]:[<bus>][<slot>].[<func>] eg. 0000:02:10.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't that be (missing colon after [<bus>]
?):
// Expected input strng format is [<domain>]:[<bus>]:[<slot>].[<func>] eg. 0000:02:10.0
} | ||
|
||
func checkForPCIColdPlug(device spec.LinuxDevice, hConfig *vc.HypervisorConfig) bool { | ||
if !strings.Contains(device.Path, "/dev/vfio/") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be strings.HasPrefix()
?
} | ||
|
||
pathTokens := strings.Split(device.Path, "/") | ||
if len(pathTokens) != 4 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a comment documenting the expected format so this token value is clearer?
# A list of parameters to pass to the vfio-pci driver when coldplugging | ||
# devices. This is a semicolon-separated list of device option lists where | ||
# a device option list is comma-separated list where the first entry is | ||
# the device's BDF. All devices that will be coldplugged should be added |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm finding this a little difficult to read. Could it be changed to something like this without losing the meaning?:
A semi-colon separated list of parameters to pass to the vfio-pci driver when coldplugging
devices. Each list element is itself a comma separated list of options which must start with the BDF of the device to be cold-plugged and optionally followed by one or more device-specific options.
|
||
// PCIColdplugDeviceOpts is used to indicate what paramaters | ||
// should be passed to vfio-pci for coldplugged devices | ||
PCIColdplugDeviceOpts []string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not really clear why PCIColdplugDeviceOpts
is separate from PCIColdplugDeviceOpts
. How about something like:
type PCIDevice {
Name string
Options []string
}
type HypervisorConfig struct {
:
PCIColdplugDevices []PCIDevice
}
Splitting the bdf and its options apart would also solve the issue in checkForPCIColdPlug()
I think.
tokens := strings.Split(deviceSysStr, ":") | ||
|
||
if len(tokens) != 3 { | ||
return "", fmt.Errorf("Incorrect number of tokens found while parsing bdf for device : %s", deviceSysStr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd consider making the 3
a const
and adding that to the returned error so we log 3
vs. len(tokens)
.
|
||
for _, bdf := range bdfs { | ||
for _, opts := range hConfig.PCIColdplugDeviceOpts { | ||
if strings.Contains(opts, bdf) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if a devices options contained a reference to another BDF? If that's possible, this won't be reliable.
Hi @eguzman3 , thanks for your PR! Can you address comment #704 (comment) ? We need a clear understanding about the scenario. |
Hi, @eguzman3 any updates on this? thx! |
Ping @eguzman3. |
I will try to run some tests on a system we have that has 16 GPUs with a large BAR size: |
@flx42 Do you solve other problems? |
@eguzman3 any updates? (from your weekly kata herder) |
Nope, no progress on this side. Thanks for all the feedback in #704, I think we'll reopen if/when needed. |
/do-not-merge |
Ok - closing. Let us know if you want this re-opened... |
New Firecracker v0.20.0 has changed the host-initiated vsock connection protocol to include a trivial handshake. The new protocol looks like this: - [host] CONNECT <port><LF> - [guest/success] OK <assigned_host_port><LF> Fixes: kata-containers#705 Signed-off-by: Penny Zheng <[email protected]>
This file is mainly used by kata-runtime and missing logging part. We add one new "agent-client" log field here, and Plz notice that, you should turn on the `kata-runtime` debug option to see the output. Fixes: kata-containers#705 Depends-on: github.com/kata-containers#2379 Signed-off-by: Penny Zheng <[email protected]>
Adds support for coldplugging PCI devices at VM boot rather than hotplugging.
Adds two cli config options
pci_coldplug_groups
defines a list of IOMMU groups that should be coldplugged when supplied via--device=/dev/vfio/XX
pci_coldplug_device_opts
defines a list of per-device vfio-pci options to be passed on the qemu cli when coldplugging these devicesFixes: #704
Signed-off-by: Edward Guzman [email protected]