Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

images/inventory: add field for enabled plugins #2489

Open
wants to merge 1 commit into
base: criu-dev
Choose a base branch
from

Conversation

rst0git
Copy link
Member

@rst0git rst0git commented Sep 27, 2024

This pull request extends the inventory image with a plugins field that contains an array of names indicating which plugins were used during checkpointing, for example, to save GPU state. In particular, the CUDA and AMDGPU plugins are added to this field only when the checkpoint contains GPU state. This allows to disable unnecessary plugins during restore, show appropriate error messages if required CRIU plugins are missing, and migrate a process that does not use GPU from a GPU-enabled system to CPU-only environment.

@rst0git rst0git marked this pull request as draft September 27, 2024 17:15
@rst0git rst0git marked this pull request as ready for review September 27, 2024 18:08
criu/plugin.c Outdated Show resolved Hide resolved
images/inventory.proto Outdated Show resolved Hide resolved
@rst0git rst0git force-pushed the inventory-plugins branch 12 times, most recently from 0d79239 to 278c174 Compare October 7, 2024 15:29
@rst0git rst0git changed the title images/inventory: add fields for plugins images/inventory: add field for enabled plugins Oct 7, 2024
criu/image.c Show resolved Hide resolved
This patch extends the inventory image with a `plugins` field that
contains an array of plugins which were used during checkpoint,
for example, to save GPU state. In particular, the CUDA and AMDGPU
plugins are added to this field only when the checkpoint contains
GPU state. This allows to disable unnecessary plugins during restore,
show appropriate error messages if required CRIU plugin are missing,
and migrate a process that does not use GPU from a GPU-enabled system
to CPU-only environment.

We use the `optional plugins_entry` for backwards compatibility. This
entry allows us to distinguish between *unset* and *missing* field:

- When the field is missing, it indicates that the checkpoint was
  created with a previous version of CRIU, and all plugins should be
  *enabled* during restore.

- When the field is empty, it indicates that no plugins were used during
  checkpointing. Thus, all plugins can be *disabled* during restore.

Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
if (!plugin_added_to_inventory) {
status = add_inventory_plugin(CR_PLUGIN_DESC.name);
if (status)
pr_err("Failed to add CUDA plugin to inventory image\n");
Copy link
Member

Choose a reason for hiding this comment

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

should we return a non-zero code in this case?

@avagin
Copy link
Member

avagin commented Oct 14, 2024

I think we should introduce a test for this change.

return true; /* backwards compatibility */

if (n_inventory_plugins > 0) {
struct inventory_plugin *p, *tmp;
Copy link
Member

Choose a reason for hiding this comment

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

nit: add an empty line between declarations and the code block.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants