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

runtime: Enable file based backend#1657

Merged
devimc merged 1 commit intokata-containers:masterfrom
ganeshmaharaj:filebackend
May 28, 2019
Merged

runtime: Enable file based backend#1657
devimc merged 1 commit intokata-containers:masterfrom
ganeshmaharaj:filebackend

Conversation

@ganeshmaharaj
Copy link
Copy Markdown
Contributor

A file based memory backend mapped to the host, fot eg: '/dev/shm' will
be used by virtio-fs for performance reasons. This change is a generic
implementation of that for kata. This will be enabled default for
virtio-fs negating the need to enable hugepages in that scenario. This
option can be used without virtio-fs by setting 'file_mem_backend' to
the location in the configuration file. Default value is an empty
string.

Fixes: #1656
Signed-off-by: Ganesh Maharaj Mahalingam ganesh.mahalingam@intel.com

@ganeshmaharaj
Copy link
Copy Markdown
Contributor Author

Copy link
Copy Markdown

@sboeuf sboeuf left a comment

Choose a reason for hiding this comment

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

Looks good thanks @ganeshmaharaj

@sboeuf
Copy link
Copy Markdown

sboeuf commented May 10, 2019

/test

# result in memory pre allocation
#enable_hugepages = true

# Enable file based guest memory support. The default is an empty string which
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This is making the qemu config file deviate further from the firecracker one. Is this change qemu specific? If so, please could you mention that in the commit to make it clear.

Related: discussions on breaking up the config file into fragments - #1648

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good point. Let me see if this at all will work with firecracker and then comment back here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@jodh-intel verified with @mcastelino that this feature will not work on firecracker. I have since removed the config from the firecracker hypervisor invocation and cleaned up the code. Will do a follow-on document update regarding this and hugepages.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks @ganeshmaharaj !

return incoming
}

func (q *qemu) setupFileBackedMem(knobs *govmmQemu.Knobs, memory *govmmQemu.Memory) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

There are now 3 users:

  1. VM templating, see setupTemplate()
  2. virtio-fs
  3. Explicit file_mem_backend in configuration.toml

Additionally, all other vhost-user devices also require this setting if hugepages is disabled. Perhaps it should be enabled automatically for all vhost-user devices, not just virtio-fs?

When VM templating is enabled together with virtio-fs the MemoryPath is ignored in favor of FileBackedMemRootDir. Did you check that VM templating still works in this case?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@ganeshmaharaj We also have a gap around memory hotplug. Our memory hotplug model should also switch over to file_mem_backend for all hotplugged dimms also when this is flipped. All the vhost-user backends may or may not tolerate this, but we should ensure we do not end up with a mix of file backed and no file backed DIMMs.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@ganeshmaharaj just to be clear, when you flip this flag every DIMM should be file backed. (This also applies to huge pages). So this will be a good time to fix hotplug handling overall. It can be in a separate PR as this feature is experimental in this release. But before we move it out of experimental we need to make the change as kubernetes will break as it relies heavily on memory hotplug support today.

/cc @dagrh

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.

@mcastelino It is a common use case for vm templating to mix file backed and non-file backed DIMMs. When we unmix them, vm templating's initial memory path should be excluded since it is always file backed.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@bergwolf fair enough. However vhost-user backends will break if we do not make them all file based. So when vhost-user is used, we should default all DIMMs to file based. When it is not in use we should allow the mixing.

However it may just be easier to go one way or the other. (If the overhead is marginal)

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.

@mcastelino Once vm template's initial memory path is excluded, I'm all for it to never mix the two.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Have fixed the choices on multiple scenarios. VM Templating gets the high priority off all. If VM templating is not enabled, the user's filebacking location will be used and fallback is /dev/shm. @stefanha I was not able to get VM templating to work with virtio-fs. That is now next in the list of things to tackle once this patch lands. @mcastelino @bergwolf so will memory hotplug and removing the mixing of memory backends.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@bergwolf @ganeshmaharaj in summary if VM templating is enabled then virtio-fs cannot be used. Actually any vhost-user implementation cannot be used.

If I understand right this is due to the fact that the file backing the templated RAM is setup with share=off. Is that a correct summary. So this is independent of hotplug right?

Can we add this as a known limitation to the documentation?

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.

@ganeshmaharaj @mcastelino I think it is a problem due to kata/govmm implementation. vm template is using its own dimm, and virtio-fs is using its own dimm. Their share property is independent to each other. I don't see why we cannot make them work together.

@mcastelino mcastelino mentioned this pull request May 15, 2019
@renzhengeek
Copy link
Copy Markdown

Tested here, it'd solved my problem, so looking for this been merged ASAP :)

@ganeshmaharaj ganeshmaharaj force-pushed the filebackend branch 2 times, most recently from 9ef20dd to 42a17ff Compare May 21, 2019 15:58
@ganeshmaharaj
Copy link
Copy Markdown
Contributor Author

/test

@nitkon
Copy link
Copy Markdown
Contributor

nitkon commented May 22, 2019

/test-power

@ganeshmaharaj ganeshmaharaj force-pushed the filebackend branch 2 times, most recently from 281a4aa to 9a7fd4d Compare May 24, 2019 03:36
A file based memory backend mapped to the host, fot eg: '/dev/shm' will
be used by virtio-fs for performance reasons. This change is a generic
implementation of that for kata. This will be enabled default for
virtio-fs negating the need to enable hugepages in that scenario. This
option can be used without virtio-fs by setting 'file_mem_backend' to
the location in the configuration file. Default value is an empty
string.

Fixes: kata-containers#1656
Signed-off-by: Ganesh Maharaj Mahalingam <ganesh.mahalingam@intel.com>
@ganeshmaharaj
Copy link
Copy Markdown
Contributor Author

/test

@codecov
Copy link
Copy Markdown

codecov bot commented May 24, 2019

Codecov Report

Merging #1657 into master will decrease coverage by <.01%.
The diff coverage is 100%.

@@            Coverage Diff             @@
##           master    #1657      +/-   ##
==========================================
- Coverage   54.57%   54.56%   -0.01%     
==========================================
  Files         106      106              
  Lines       12765    12792      +27     
==========================================
+ Hits         6966     6980      +14     
- Misses       4966     4975       +9     
- Partials      833      837       +4

@raravena80
Copy link
Copy Markdown
Member

@ganeshmaharaj any updates? Seems it's approved but a test failing.

@ganeshmaharaj
Copy link
Copy Markdown
Contributor Author

@raravena80 i believe the fedora failure is a known one that folks have been debugging now to figure out the rootcause. There are multiple bugs/PRs towards this. kata-containers/tests#1449, kata-containers/tests#1531

@ganeshmaharaj
Copy link
Copy Markdown
Contributor Author

i believe this patch is ready to be merged into the tree if there are no objections.

cc @kata-containers/runtime

@devimc devimc merged commit 919615f into kata-containers:master May 28, 2019
@ganeshmaharaj ganeshmaharaj deleted the filebackend branch May 28, 2019 19:29
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enable file based memory backend