[libvirt] [PATCH v2] qemuBuildMemoryBackendStr: Don't crash if no hugetlbfs is mounted

Peter Krempa pkrempa at redhat.com
Mon Sep 19 11:20:58 UTC 2016


On Mon, Sep 19, 2016 at 11:03:30 +0200, Michal Privoznik wrote:
> When trying to migrate a huge page enabled guest, I've noticed
> the following crash. Apparently, if no specific hugepages are
> requested:
> 
>   <memoryBacking>
>     <hugepages/>
>   </memoryBacking>

[...]

> ---
> 
> diff to v1:
> 
> - added a comment to qemuGetDefaultHugepath() as requested in the review
> 
>  src/qemu/qemu_command.c |  6 ++++++
>  src/qemu/qemu_conf.c    | 10 ++++++++++
>  2 files changed, 16 insertions(+)

[...]

> diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
> index dad8334..901ad23 100644
> --- a/src/qemu/qemu_conf.c
> +++ b/src/qemu/qemu_conf.c
> @@ -1450,6 +1450,16 @@ qemuGetHugepagePath(virHugeTLBFSPtr hugepage)
>      return ret;
>  }
>  
> +
> +/**
> + * qemuGetDefaultHugepath:
> + *
> + * Get default hugepages path for memory backend. Does not work
> + * well with @nhugetlbfs == 0 or @hugetlbfs == NULL.

'Callers must ensure that @hugetlbfs contains at least one entry.'
instead of the second sentence which doesn't really tell much.

Also add a description of the arguments since you are referring to them
in the comment.

> + *
> + * Returns 0 on success,
> + *        -1 otherwise.

These will fit on a signe line.

> + * */

ACK with the above issues resolved.

Peter




More information about the libvir-list mailing list