-
Notifications
You must be signed in to change notification settings - Fork 374
virtcontainers: network: Add VFIO hotplug support #620
Conversation
@amshinde PTAL |
virtcontainers/network.go
Outdated
@@ -417,7 +417,29 @@ func (endpoint *PhysicalEndpoint) Detach(netNsCreated bool, netNsPath string) er | |||
|
|||
// HotAttach for physical endpoint not supported yet | |||
func (endpoint *PhysicalEndpoint) HotAttach(h hypervisor) error { | |||
return fmt.Errorf("PhysicalEndpoint does not support Hot attach") | |||
networkLogger().WithField("endpoint-type", "physical").Info("Attaching endpoint (hotplug)") |
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.
You will need to implement HotDetach as well for physical interface.
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.
Implementing HotDetach()
needs some more rework. It needs the ID of the device to be stored, but the structures don't provide this ability. The hot detach requires more work, and can be handled in a follow up PR.
Build failed (third-party-check pipeline) integration testing with
|
PSS Measurement: Memory inside container: |
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.
LTGM with just one nit.
virtcontainers/network.go
Outdated
@@ -417,7 +417,29 @@ func (endpoint *PhysicalEndpoint) Detach(netNsCreated bool, netNsPath string) er | |||
|
|||
// HotAttach for physical endpoint not supported yet |
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.
This comment is going to be obsolete with this PR :)
virtcontainers/network.go
Outdated
BDF: endpoint.BDF, | ||
} | ||
|
||
_, err = h.hotplugAddDevice(d, vfioDev) |
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.
Since you are doing the rework, how about we use sandbox.DeviceManager
to manage vfio devices?
e.g.
dev, err := sandbox.DeviceManager.NewDevice(deviceInfo{})
sandbox.DeviceManager.AttachDevice(dev.DeviceID(), sandbox)
This can gurantee we manage devices with same struct and after container exits, every devices can be detached correctly.
This will also need some rework as PhysicalEndpoint doesn't have a sandbox
field
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.
@WeiZhang555 I wanted to enable VFIO net hotplug support in order to support #600 but now that I have posted #623 , I think I can spend more time to actually do this PR more properly.
I'll try to spend some time to use the DeviceManager, so that I can implement the detach too ;)
Just added do-not-merge label, as this PR should use the DeviceManager model to be able to detach devices. |
Need #758 to be fixed first. |
#758 has now landed :) |
virtcontainers/network.go
Outdated
} | ||
id := hex.EncodeToString(randBytes) | ||
|
||
// TODO: use device manager as general device management entrance |
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 make this an issue or we'll forget ;)
@sboeuf Any updates? |
@amshinde if we do so, we wont have the hot-detach implementation. I am fine either way. |
@sboeuf ping (From your weekly Kata herder) |
@sboeuf nudge. |
@sboeuf - another conflicted branch. |
In order to support full network hotplug, it's mandatory that we can support the hotplug of a VFIO device for the network interface. Fixes kata-containers#619 Signed-off-by: Sebastien Boeuf <[email protected]>
@jodh-intel rebased! |
/test |
} | ||
id := hex.EncodeToString(randBytes) | ||
|
||
// TODO: use device manager as general device management entrance |
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 remove, or add an issue URL here maybe?
func (endpoint *PhysicalEndpoint) HotAttach(h hypervisor) error { | ||
return fmt.Errorf("PhysicalEndpoint does not support Hot attach") | ||
networkLogger().WithField("endpoint-type", "physical").Info("Attaching endpoint (hotplug)") |
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.
Suggestion:
networkLogger().WithField("endpoint-type", "physical").Info("Attaching endpoint (hotplug)") | |
networkLogger().WithField("endpoint-type", "physical").Info("Hot attaching endpoint") |
Alternatively, add a field for hotplug
.
@@ -98,9 +100,31 @@ func (endpoint *PhysicalEndpoint) Detach(netNsCreated bool, netNsPath string) er | |||
return bindNICToHost(endpoint) | |||
} | |||
|
|||
// HotAttach for physical endpoint not supported yet | |||
// HotAttach for physical endpoint |
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 about HotDetach()
?
/me blows the dust off and pings @sboeuf... |
/retest |
@sboeuf @caoruidong ping |
Another August '18 vintage PR. @sboeuf - what's the plan here? |
Same here, let's close and get back to it if really needed. |
When agent runs as init, it is not able to read `/proc/self/cmdline` because of `/proc` has not been mounted when the C constructor is called. This reverts commit cfbd8c9. fixes kata-containers#620 Signed-off-by: Julio Montes <[email protected]>
In order to support full network hotplug, it's mandatory that we can
support the hotplug of a VFIO device for the network interface.
Fixes #619
Signed-off-by: Sebastien Boeuf [email protected]