Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

virtcontainers: network: Add VFIO hotplug support #620

Closed
wants to merge 1 commit into from

Conversation

sboeuf
Copy link

@sboeuf sboeuf commented Aug 21, 2018

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]

@egernst egernst added the review label Aug 21, 2018
@sboeuf sboeuf requested a review from amshinde August 21, 2018 19:32
@sboeuf
Copy link
Author

sboeuf commented Aug 21, 2018

@amshinde PTAL

@@ -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)")
Copy link
Member

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.

Copy link
Author

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.

@opendev-zuul
Copy link

opendev-zuul bot commented Aug 21, 2018

Build failed (third-party-check pipeline) integration testing with
OpenStack. For information on how to proceed, see
http://docs.openstack.org/infra/manual/developers.html#automated-testing

@katacontainersbot
Copy link
Contributor

PSS Measurement:
Qemu: 166119 KB
Proxy: 4066 KB
Shim: 8788 KB

Memory inside container:
Total Memory: 2043464 KB
Free Memory: 2003192 KB

Copy link
Member

@bergwolf bergwolf left a 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.

@@ -417,7 +417,29 @@ func (endpoint *PhysicalEndpoint) Detach(netNsCreated bool, netNsPath string) er

// HotAttach for physical endpoint not supported yet
Copy link
Member

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 :)

BDF: endpoint.BDF,
}

_, err = h.hotplugAddDevice(d, vfioDev)
Copy link
Member

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

Copy link
Author

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 ;)

@sboeuf
Copy link
Author

sboeuf commented Aug 23, 2018

Just added do-not-merge label, as this PR should use the DeviceManager model to be able to detach devices.

@sboeuf sboeuf added the feature New functionality label Sep 12, 2018
@sboeuf
Copy link
Author

sboeuf commented Sep 19, 2018

Need #758 to be fixed first.

@jodh-intel
Copy link
Contributor

#758 has now landed :)

}
id := hex.EncodeToString(randBytes)

// TODO: use device manager as general device management entrance
Copy link
Contributor

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 ;)

@amshinde
Copy link
Member

amshinde commented Oct 8, 2018

@sboeuf Any updates?
Also, I think its fine not to use the Devicemanager for now, since I think its cleaner to keep the network devices separate from sandbox devices.

@sboeuf
Copy link
Author

sboeuf commented Oct 8, 2018

@amshinde if we do so, we wont have the hot-detach implementation. I am fine either way.

@raravena80
Copy link
Member

@sboeuf ping (From your weekly Kata herder)

@raravena80
Copy link
Member

@sboeuf nudge.

@raravena80
Copy link
Member

@sboeuf @amshinde are we merging this eventually?

@jodh-intel
Copy link
Contributor

@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]>
@sboeuf
Copy link
Author

sboeuf commented Jan 8, 2019

@jodh-intel rebased!

@sboeuf
Copy link
Author

sboeuf commented Jan 8, 2019

/test

}
id := hex.EncodeToString(randBytes)

// TODO: use device manager as general device management entrance
Copy link
Contributor

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)")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion:

Suggested change
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about HotDetach()?

@jodh-intel
Copy link
Contributor

/me blows the dust off and pings @sboeuf...

@caoruidong
Copy link
Member

/retest

@raravena80
Copy link
Member

raravena80 commented Feb 4, 2019

@sboeuf @caoruidong ping

@jodh-intel
Copy link
Contributor

Another August '18 vintage PR. @sboeuf - what's the plan here?

@sboeuf
Copy link
Author

sboeuf commented Feb 26, 2019

Same here, let's close and get back to it if really needed.

@sboeuf sboeuf closed this Feb 26, 2019
egernst pushed a commit to egernst/runtime that referenced this pull request Feb 9, 2021
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]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature New functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants