[CRIU] [PATCH] aio: Add plugin for waiting AIO in-flight reqs

Pavel Emelyanov xemul at virtuozzo.com
Tue Apr 5 09:32:00 PDT 2016


On 04/05/2016 01:10 PM, Kirill Tkhai wrote:
> This is possibility to wait AIO in-flight reqs before
> we collect AIO rings info.

Plugins are designed to support functionality that is not
generic to be implemented inside criu, not to hook in
experimental stuff that has not yet hit the mainstream
kernel repo :)

If we have an experimental API for waiting AIO then let's
discuss it on the lkml and put respective code directly
into criu (dev branch), not via plugins.

-- Pavel

> Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
> ---
>  criu/aio.c                 |   13 +++++++++++--
>  criu/cr-dump.c             |    2 +-
>  criu/include/aio.h         |    2 +-
>  criu/include/criu-plugin.h |    3 +++
>  4 files changed, 16 insertions(+), 4 deletions(-)
> 
> diff --git a/criu/aio.c b/criu/aio.c
> index 888a640..6bee66d 100644
> --- a/criu/aio.c
> +++ b/criu/aio.c
> @@ -3,6 +3,7 @@
>  #include <stdbool.h>
>  #include "vma.h"
>  #include "xmalloc.h"
> +#include "plugin.h"
>  #include "aio.h"
>  #include "parasite.h"
>  #include "parasite-syscall.h"
> @@ -70,12 +71,12 @@ unsigned long aio_rings_args_size(struct vm_area_list *vmas)
>  		vmas->nr_aios * sizeof(struct parasite_aio);
>  }
>  
> -int parasite_collect_aios(struct parasite_ctl *ctl, struct vm_area_list *vmas)
> +int parasite_collect_aios(struct parasite_ctl *ctl, pid_t pid, struct vm_area_list *vmas)
>  {
>  	struct vma_area *vma;
>  	struct parasite_check_aios_args *aa;
>  	struct parasite_aio *pa;
> -	int i;
> +	int i, ret;
>  
>  	if (!vmas->nr_aios)
>  		return 0;
> @@ -106,6 +107,14 @@ int parasite_collect_aios(struct parasite_ctl *ctl, struct vm_area_list *vmas)
>  	}
>  	aa->nr_rings = vmas->nr_aios;
>  
> +	ret = run_plugins(AIO_WAIT_REQS, pid);
> +	if (ret == -ENOTSUP) {
> +		pr_info_once("AIO_WAIT_REQS plugin was not found\n");
> +	} else if (ret < 0) {
> +		pr_err("Can't execute AIO_WAIT_REQS plugin: ret=%d\n", ret);
> +		return -1;
> +	}
> +
>  	if (parasite_execute_daemon(PARASITE_CMD_CHECK_AIOS, ctl))
>  		return -1;
>  
> diff --git a/criu/cr-dump.c b/criu/cr-dump.c
> index 6d3ccd1..623e6ed 100644
> --- a/criu/cr-dump.c
> +++ b/criu/cr-dump.c
> @@ -1263,7 +1263,7 @@ static int dump_one_task(struct pstree_item *item)
>  		goto err_cure_imgset;
>  	}
>  
> -	ret = parasite_collect_aios(parasite_ctl, &vmas); /* FIXME -- merge with above */
> +	ret = parasite_collect_aios(parasite_ctl, pid, &vmas); /* FIXME -- merge with above */
>  	if (ret) {
>  		pr_err("Failed to check aio rings (pid: %d)\n", pid);
>  		goto err_cure_imgset;
> diff --git a/criu/include/aio.h b/criu/include/aio.h
> index 1e08775..3124164 100644
> --- a/criu/include/aio.h
> +++ b/criu/include/aio.h
> @@ -6,7 +6,7 @@
>  int dump_aio_ring(MmEntry *mme, struct vma_area *vma);
>  void free_aios(MmEntry *mme);
>  struct parasite_ctl;
> -int parasite_collect_aios(struct parasite_ctl *, struct vm_area_list *);
> +int parasite_collect_aios(struct parasite_ctl *, pid_t pid, struct vm_area_list *);
>  unsigned long aio_rings_args_size(struct vm_area_list *);
>  
>  struct aio_ring {
> diff --git a/criu/include/criu-plugin.h b/criu/include/criu-plugin.h
> index b76f5f8..1d06a94 100644
> --- a/criu/include/criu-plugin.h
> +++ b/criu/include/criu-plugin.h
> @@ -50,6 +50,8 @@ enum {
>  
>  	CR_PLUGIN_HOOK__DUMP_EXT_LINK		= 6,
>  
> +	CR_PLUGIN_HOOK__AIO_WAIT_REQS		= 7,
> +
>  	CR_PLUGIN_HOOK__MAX
>  };
>  
> @@ -63,6 +65,7 @@ DECLARE_PLUGIN_HOOK_ARGS(CR_PLUGIN_HOOK__RESTORE_EXT_FILE, int id);
>  DECLARE_PLUGIN_HOOK_ARGS(CR_PLUGIN_HOOK__DUMP_EXT_MOUNT, char *mountpoint, int id);
>  DECLARE_PLUGIN_HOOK_ARGS(CR_PLUGIN_HOOK__RESTORE_EXT_MOUNT, int id, char *mountpoint, char *old_root, int *is_file);
>  DECLARE_PLUGIN_HOOK_ARGS(CR_PLUGIN_HOOK__DUMP_EXT_LINK, int index, int type, char *kind);
> +DECLARE_PLUGIN_HOOK_ARGS(CR_PLUGIN_HOOK__AIO_WAIT_REQS, pid_t pid);
>  
>  enum {
>  	CR_PLUGIN_STAGE__DUMP,
> 
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://lists.openvz.org/mailman/listinfo/criu
> .
> 



More information about the CRIU mailing list