qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Sanidhya Kashyap <sanidhya.iiith@gmail.com>
To: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: Amit Shah <amit.shah@redhat.com>,
	qemu list <qemu-devel@nongnu.org>,
	Juan Quintela <quintela@redhat.com>
Subject: Re: [Qemu-devel] [PATCH v4 3/8] BitmapLog: bitmap dump code via QAPI framework with runstates
Date: Fri, 18 Jul 2014 23:48:58 +0530	[thread overview]
Message-ID: <53C96512.2040204@gmail.com> (raw)
In-Reply-To: <20140718111228.GE2384@work-vm>

>> +#define RAMBLOCK_NAME_LENGTH (1<<8)
> 
> Be careful; making this bigger would break migration formats,
> making it smaller would probably break migration loading.
>

its the same as previous, will write it explicitly. What I think is that
we should make name_length to be global. I have seen at most of the
places that we are using 256 as length, why can't we use a variable?

>> +
>> +enum {
>> +    LOG_BITMAP_STATE_ERROR = -1,
>> +    LOG_BITMAP_STATE_NONE,
>> +    LOG_BITMAP_STATE_SETUP,
>> +    LOG_BITMAP_STATE_ACTIVE,
>> +    LOG_BITMAP_STATE_CANCELING,
>> +    LOG_BITMAP_STATE_COMPLETED
>> +};
> 
> I'd be tempted to give that enum a name and use it as the type
> for functions that pass the state around (although I realise
> you have to be careful with the variable having to be an int
> for the atomic).
>

will see what can be done.


>> +static inline void logging_lock(void)
>> +{
>> +    qemu_mutex_lock_iothread();
>> +    qemu_mutex_lock_ramlist();
>> +}
> 
> I wonder how often you can really not have the ramlist locked; if stuff
> is added/removed the last_ram_offset would change, so to really be safe
> you probably need to hold it for much longer than you currently do -
> but that might not be practical.
> 

I didn't realize that. I will try to make suitable changes in my code to
cater to those added/removed last_ram_offset.

>> +static inline void logging_bitmap_set_dirty(ram_addr_t addr)
>> +{
>> +    int nr  = addr >> TARGET_PAGE_BITS;
> 
> Be careful; int is too small; long is probably what's
> needed (which I think is the type of the parameter to set_bit).
> 

My mistake. I will rectify it!

>> +static inline bool value_in_range(int64_t value, int64_t min_value,
>> +                                  int64_t max_value, const char *str,
>> +                                  Error **errp)
>> +{
>> +    if (value < min_value) {
>> +        error_setg(errp, "%s's value must be greater than %ld",
>> +                         str, min_value);
>> +        return false;
>> +    }
>> +    if (value > max_value) {
>> +        error_setg(errp, "%s's value must be less than %ld",
>> +                         str, max_value);
>> +        return false;
>> +    }
>> +    return true;
>> +}
> 
> This seems a pretty generic function; could it go somewhere
> in util or the like?
> 
okay.

>> +
>> +static void dirty_bitmap_sync(void)
>> +{
>> +    RAMBlock *block;
>> +    address_space_sync_dirty_bitmap(&address_space_memory);
>> +    QTAILQ_FOREACH(block, &ram_list.blocks, next) {
>> +        qemu_bitmap_sync_range(block->mr->ram_addr, block->length,
>> +                               logging_bitmap, false);
>> +    }
>> +}
> 
> I think that should be logging_dirty_bitmap_sync since it's
> specific to logging_bitmap.
> 

okay. Will change it.

>> +
>> +static void logging_state_update_status(BitmapLogState *b)
>> +{
>> +    switch (b->state) {
>> +    case LOG_BITMAP_STATE_ACTIVE:
>> +        logging_state_set_status(b, LOG_BITMAP_STATE_ACTIVE,
>> +                                    LOG_BITMAP_STATE_COMPLETED);
>> +        return;
>> +    case LOG_BITMAP_STATE_CANCELING:
>> +        logging_state_set_status(b, LOG_BITMAP_STATE_CANCELING,
>> +                                    LOG_BITMAP_STATE_COMPLETED);
>> +        return;
>> +    case LOG_BITMAP_STATE_ERROR:
>> +        logging_state_set_status(b, LOG_BITMAP_STATE_ERROR,
>> +                                    LOG_BITMAP_STATE_COMPLETED);
>> +    }
>> +    return;
>> +}
> 
> I didn't really see the point of this at first, but I guess
> it always moves to 'COMPLETED' unless you're already at completed
> or in NONE; but then perhaps:
> 
>     int s = b->state;
>     switch (s) {
>     case LOG_BITMAP_STATE_ACTIVE:
>     case LOG_BITMAP_STATE_CANCELING:
>     case LOG_BITMAP_STATE_ERROR:
>        logging_state_set_status(b, s,
>                                    LOG_BITMAP_STATE_COMPLETED);
>        return;
>    }
>    return;
> 
> would be more obvious (note I only read the state once)
> 

Yup, will save some code and reduce confusion.

-- 
-----

Sanidhya Kashyap

  reply	other threads:[~2014-07-18 18:19 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-17 11:21 [Qemu-devel] [PATCH v4 0/8] Obtain dirty bitmap via VM logging Sanidhya Kashyap
2014-07-17 11:21 ` [Qemu-devel] [PATCH v4 1/8] enable sharing of the function between migration and bitmap dump Sanidhya Kashyap
2014-07-18 11:00   ` Dr. David Alan Gilbert
2014-07-17 11:21 ` [Qemu-devel] [PATCH v4 2/8] RunState: added two new flags for bitmap dump and migration process Sanidhya Kashyap
2014-07-18 11:02   ` Dr. David Alan Gilbert
2014-07-18 12:16   ` Eric Blake
2014-07-18 18:01     ` Sanidhya Kashyap
2014-07-17 11:21 ` [Qemu-devel] [PATCH v4 3/8] BitmapLog: bitmap dump code via QAPI framework with runstates Sanidhya Kashyap
2014-07-18 11:12   ` Dr. David Alan Gilbert
2014-07-18 18:18     ` Sanidhya Kashyap [this message]
2014-07-18 11:14   ` Dr. David Alan Gilbert
2014-07-18 18:09     ` Sanidhya Kashyap
2014-07-18 12:20   ` Eric Blake
2014-07-17 11:21 ` [Qemu-devel] [PATCH v4 4/8] BitmapLog: hmp interface for dirty bitmap dump Sanidhya Kashyap
2014-07-18 11:15   ` Dr. David Alan Gilbert
2014-07-17 11:21 ` [Qemu-devel] [PATCH v4 5/8] BitmapLog: cancel mechanism for an already running dump bitmap process Sanidhya Kashyap
2014-07-18 12:22   ` Eric Blake
2014-07-18 17:51     ` Sanidhya Kashyap
2014-07-17 11:21 ` [Qemu-devel] [PATCH v4 6/8] BitmapLog: set the frequency of the " Sanidhya Kashyap
2014-07-18 12:28   ` Eric Blake
2014-07-17 11:21 ` [Qemu-devel] [PATCH v4 7/8] BitmapLog: get the information about the parameters Sanidhya Kashyap
2014-07-18 12:35   ` Eric Blake
2014-07-18 17:41     ` Sanidhya Kashyap
2014-07-17 11:21 ` [Qemu-devel] [PATCH v4 8/8] BitmapLog: python script for extracting bitmap from a binary file Sanidhya Kashyap
2014-07-18 11:17   ` Dr. David Alan Gilbert
2014-07-18 10:56 ` [Qemu-devel] [PATCH v4 0/8] Obtain dirty bitmap via VM logging Dr. David Alan Gilbert
2014-07-18 13:42   ` Eric Blake
2014-07-18 17:28   ` Sanidhya Kashyap
2014-07-18 17:42     ` Dr. David Alan Gilbert
2014-07-18 12:39 ` Eric Blake

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=53C96512.2040204@gmail.com \
    --to=sanidhya.iiith@gmail.com \
    --cc=amit.shah@redhat.com \
    --cc=dgilbert@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).