qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [RFC PATCH qemu] qapi: Add query-memory-checksum


From: Eric Blake
Subject: Re: [Qemu-devel] [RFC PATCH qemu] qapi: Add query-memory-checksum
Date: Wed, 21 Aug 2019 20:33:04 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0

On 8/21/19 8:16 PM, Alexey Kardashevskiy wrote:
> This returns MD5 checksum of all RAM blocks for migration debugging
> as this is way faster than saving the entire RAM to a file and checking
> that.
> 
> Signed-off-by: Alexey Kardashevskiy <address@hidden>
> ---
> 
> 
> I am actually wondering if there is an easier way of getting these
> checksums and I just do not see it, it cannot be that we fixed all
> memory migration bugs :)

I'm not sure whether the command itself makes sense, but for the interface:


> +++ b/qapi/misc.json
> @@ -1194,6 +1194,33 @@
>  ##
>  { 'command': 'query-memory-size-summary', 'returns': 'MemoryInfo' }
>  
> +##
> +# @MemoryChecksum:
> +#
> +# A string with MD5 checksum of all RAMBlocks.
> +#
> +# @checksum: the checksum.
> +#
> +# Since: 3.2.0

This should be 4.2, not 3.2.

> +##
> +{ 'struct': 'MemoryChecksum',
> +  'data'  : { 'checksum': 'str' } }
> +
> +##
> +# @query-memory-checksum:
> +#
> +# Return the MD5 checksum of all RAMBlocks.
> +#
> +# Example:
> +#
> +# -> { "execute": "query-memory-checksum" }
> +# <- { "return": { "checksum": "a0880304994f64cb2edad77b9a1cd58f" } }
> +#
> +# Since: 3.2.0

and again

> +##
> +{ 'command': 'query-memory-checksum',
> +  'returns': 'MemoryChecksum' }
> +
>  

> +++ b/exec.c
> @@ -2050,6 +2050,22 @@ void *qemu_ram_get_host_addr(RAMBlock *rb)
>      return rb->host;
>  }
>  
> +gchar *qemu_ram_chksum(void)

gchar is a pointless glib type.  Use 'char' instead.

> +{
> +    struct RAMBlock *rb;
> +    GChecksum *chksum = g_checksum_new(G_CHECKSUM_MD5);
> +    gchar *ret;
> +
> +    RAMBLOCK_FOREACH(rb) {
> +        g_checksum_update(chksum, qemu_ram_get_host_addr(rb),
> +                          qemu_ram_get_used_length(rb));
> +    }
> +    ret = g_strdup(g_checksum_get_string(chksum));
> +    g_checksum_free(chksum);
> +
> +    return ret;
> +}

How long does this take to run?  Is it something where you really want
to block the guest while chewing over the guest's entire memory?

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]