From: Eric Blake <eblake@redhat.com>
To: Ashijeet Acharya <ashijeetacharya@gmail.com>, quintela@redhat.com
Cc: lcapitulino@redhat.com, amit.shah@redhat.com, armbru@redhat.com,
"dgilbert@redhat.com" <dgilbert@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
"Daniel P. Berrange" <berrange@redhat.com>,
QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH v3] Move max-bandwidth and downtime-limit into migrate_set_parameter for both hmp and qmp
Date: Thu, 8 Sep 2016 10:39:33 -0500 [thread overview]
Message-ID: <132c6969-9cf8-4d5d-8bd3-93c914f26908@redhat.com> (raw)
In-Reply-To: <CAC2QTZYUq+zdhrn9BiVC5P4SHP9FC7+j9+-XY3n-8bJn9biphA@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 2357 bytes --]
On 09/08/2016 10:30 AM, Ashijeet Acharya wrote:
>>>> + if (has_downtime_limit) {
>>>> + downtime_limit *= 1000000; /* convert to nanoseconds */
>>>
>>> Are you sure this won't overflow?
>>
>> Ashijeet, Eric mere means that if downtime_limit is bigger that
>> INT64_MAX/1000000, then you get an overflow with the multiplication.
>
> Oh I get it now.
>
>> Notice that if it overflows, the value is already quite big O:-)
>>
>> 2^63/1000/1000/1000/3600/24/365
>> 292.47
>>
>> Allowing "only" 292 years of downtime should be enough for the time
>> being (famous last words) O:-)
>>
>
> Haha! 292 years seems sufficient. :-)
But it still means we should explicitly check that whatever number the
user inputs is not wrapping around to a smaller actual downtime -
especially since wraparound to a small number CAN be observed within a
human lifespan, for some values of wraparound. Either give the user an
error (their input was too big; preferred) or silently convert the
user's too-large input to the maximum possible (they won't live long
enough to notice the difference, not ideal, but if reporting an error is
too hard, it is workable).
>>>> +
>>>> + qmp_migrate_set_parameters(has_compress_level, valueint,
>>>> + has_compress_threads, valueint,
>>>
>>> Ugg. This looks gross. No need to name a bunch of variables set to
>>> false, when you can instead use QAPI's boxed conventions to pass a
>>> pointer to a struct, and rely on 0-initialization of the struct to leave
>>> all the parameters that you don't care about unmentioned.
>>
>> We should change qmp_migrate_set_parameters to your new api. I fully
>> agree that this is gross, but it is the way it was written, nothing to
>> do with this patch, really.
>
> Yeah, you expressed your disgust about this in your 'to-do list of
> migration mail' too I remember.
Okay, I'll take the hint and submit a patch to convert migration to use
the new boxed parameters from QAPI. It's an independent change, but you
would then rebase your series on top of my patch (or if yours lands
first, my work would remove the additions in yours, for some churn in
the code base, but no real harm done).
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
prev parent reply other threads:[~2016-09-08 15:39 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-06 13:39 [Qemu-devel] [PATCH v3] Move max-bandwidth and downtime-limit into migrate_set_parameter for both hmp and qmp Ashijeet Acharya
2016-09-07 8:41 ` Juan Quintela
2016-09-07 12:52 ` Ashijeet Acharya
2016-09-07 22:03 ` Eric Blake
2016-09-08 7:55 ` Ashijeet Acharya
2016-09-08 14:41 ` Juan Quintela
2016-09-08 15:30 ` Ashijeet Acharya
2016-09-08 15:39 ` Eric Blake [this message]
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=132c6969-9cf8-4d5d-8bd3-93c914f26908@redhat.com \
--to=eblake@redhat.com \
--cc=amit.shah@redhat.com \
--cc=armbru@redhat.com \
--cc=ashijeetacharya@gmail.com \
--cc=berrange@redhat.com \
--cc=dgilbert@redhat.com \
--cc=lcapitulino@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.com \
/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).