qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alexey Kardashevskiy <aik@ozlabs.ru>
To: Eric Blake <eblake@redhat.com>, qemu-devel@nongnu.org
Cc: Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [RFC PATCH qemu] qapi: Add query-memory-checksum
Date: Thu, 22 Aug 2019 13:20:43 +1000	[thread overview]
Message-ID: <2535da96-5e47-b840-d91c-d4d71a9b5981@ozlabs.ru> (raw)
In-Reply-To: <b9098689-a8cb-0c68-0065-f9362cdcb32d@redhat.com>



On 22/08/2019 11:33, Eric Blake wrote:
> 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 <aik@ozlabs.ru>
>> ---
>>
>>
>> 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?


10-20 times faster than "pmemsave" and blocking the guest is not a 
problem here as both - source and destination - guests are stopped 
(otherwise the checksum does not make sense).



-- 
Alexey


  reply	other threads:[~2019-08-22  3:22 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-22  1:16 [Qemu-devel] [RFC PATCH qemu] qapi: Add query-memory-checksum Alexey Kardashevskiy
2019-08-22  1:33 ` Eric Blake
2019-08-22  3:20   ` Alexey Kardashevskiy [this message]
2019-08-22 14:16 ` Markus Armbruster
2019-08-22 14:49   ` Daniel P. Berrangé
2019-08-23  5:49     ` Markus Armbruster
2019-08-23  9:23       ` Daniel P. Berrangé
2019-08-23 11:41         ` Markus Armbruster
2019-08-26  4:28           ` Alexey Kardashevskiy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2535da96-5e47-b840-d91c-d4d71a9b5981@ozlabs.ru \
    --to=aik@ozlabs.ru \
    --cc=eblake@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).