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

virtcontainers: apply devices constraints#701

Closed
devimc wants to merge 1 commit into
kata-containers:masterfrom
devimc:topic/applyConstraints
Closed

virtcontainers: apply devices constraints#701
devimc wants to merge 1 commit into
kata-containers:masterfrom
devimc:topic/applyConstraints

Conversation

@devimc
Copy link
Copy Markdown

@devimc devimc commented Sep 5, 2018

Apply devices constraints to the container in the virtual machine

Depends-on: github.com/kata-containers/agent#352

fixes #656

Signed-off-by: Julio Montes julio.montes@intel.com

@opendev-zuul
Copy link
Copy Markdown

opendev-zuul Bot commented Sep 5, 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

@amshinde
Copy link
Copy Markdown
Member

amshinde commented Sep 5, 2018

@devimc Lets verify this change works with device passthrough.

Comment thread virtcontainers/kata_agent.go Outdated
@@ -669,7 +669,6 @@ func constraintGRPCSpec(grpcSpec *grpc.Spec) {
// By now only CPU constraints are supported
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The comment is outdated even before this PR.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

good catch! thanks

@katacontainersbot
Copy link
Copy Markdown
Contributor

PSS Measurement:
Qemu: 169741 KB
Proxy: 4054 KB
Shim: 9115 KB

Memory inside container:
Total Memory: 2043460 KB
Free Memory: 2003556 KB

Apply devices constraints to the container in the virtual machine

Depends-on: github.com/kata-containers/agent#352

fixes kata-containers#656

Signed-off-by: Julio Montes <julio.montes@intel.com>
@devimc devimc force-pushed the topic/applyConstraints branch from c257eea to a825fda Compare September 5, 2018 18:44
@devimc
Copy link
Copy Markdown
Author

devimc commented Sep 5, 2018

@amshinde do you know if currently we have a device passthrough test?

https://github.com/kata-containers/tests/blob/master/integration/docker/run_test.go#L85-L138

@opendev-zuul
Copy link
Copy Markdown

opendev-zuul Bot commented Sep 5, 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
Copy Markdown
Contributor

PSS Measurement:
Qemu: 167558 KB
Proxy: 4175 KB
Shim: 8804 KB

Memory inside container:
Total Memory: 2043460 KB
Free Memory: 2003440 KB

@xindazhao
Copy link
Copy Markdown
Contributor

xindazhao commented Sep 6, 2018

Hi, is there any difference in the use of docker command by using device constrain? I use following command to enable INTEL GPU device support, with this commit added in, the GPU device node "/dev/dri/card0" and "/dev/dri/renderD128" can be seen in container, but returns error if open() the device node. Without this commit, everything works well.
What changes do I have to make in the command line to adapt to device constrains?

docker run -it --runtime=kata-runtime --rm --device=/dev/vfio/0 -v /dev:/dev ubuntu /bin/bash

@devimc
Copy link
Copy Markdown
Author

devimc commented Sep 7, 2018

@xindazhao this patch is to honour the devices cgroup, for example if you want to grant access to /dev/dri/card0 then you have to use --device /dev/dri/card0 in the command line. The problem with vfio devices is that once they are unbind'd from the host other devices like --device /dev/dri/card0 are no more visible, hence docker run --runtime kata-runtime --device /dev/dri/card0 -it --rm ubuntu bash fails with following error docker: Error response from daemon: linux runtime spec devices: error gathering device information while adding custom device "/dev/dri/card0": no such file or directory.
@xindazhao I have some ideas to fix the issue your are facing, is there a way to know which devices were bind'd or are part of a vfio device?, for example if you passthrough /dev/vfio/0, how I can identify that /dev/dri/card0 and /dev/dri/renderD128 were created because of /dev/vfio/0 was attached?

@xindazhao
Copy link
Copy Markdown
Contributor

There is no direct relationship between the VFIO node and GPU device node. In the GVT-g (VFIO Mdev) scenario, multiple virtual GPUs share a physical GPU. We append different VFIO nodes (/dev/vfio/0, /dev/vfio/1 /dev/vfio/2 ....) to the docker command line, but in the guest VM, all the GPU device nodes that you see might be the same "/dev/dri/card0" and "/dev/dri/renderD128"

@sboeuf
Copy link
Copy Markdown

sboeuf commented Sep 11, 2018

@devimc what's the story on this PR? What is the blocker to make CI passing so that we can move to a mergeable state?

@sboeuf sboeuf added the enhancement Improvement to an existing feature label Sep 12, 2018
@devimc
Copy link
Copy Markdown
Author

devimc commented Sep 18, 2018

if device constrains are applied, we'll face issues with vfio devices see #701 (comment)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

enhancement Improvement to an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support devices constraints

7 participants