All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>
To: Avi Kivity <avi@redhat.com>
Cc: aliguori@us.ibm.com, mtosatti@redhat.com, qemu-devel@nongnu.org,
	ohmura.kei@lab.ntt.co.jp
Subject: [Qemu-devel] Re: [PATCH v3 1/6] Modify DIRTY_FLAG value and DIRTY_IDX introduce to use as indexes of bit-based phys_ram_dirty.
Date: Mon, 19 Apr 2010 19:30:40 +0900	[thread overview]
Message-ID: <4BCC30D0.3050407@lab.ntt.co.jp> (raw)
In-Reply-To: <4BCC2D34.1070401@redhat.com>

Avi Kivity wrote:
> On 04/19/2010 12:43 PM, Yoshiaki Tamura wrote:
>> It uses ffs() to convert DIRTY_FLAG to DIRTY_IDX.
>>
>> Signed-off-by: Yoshiaki Tamura<tamura.yoshiaki@lab.ntt.co.jp>
>> ---
>> cpu-all.h | 30 ++++++++++++++++++++++++++----
>> 1 files changed, 26 insertions(+), 4 deletions(-)
>>
>> diff --git a/cpu-all.h b/cpu-all.h
>> index f8bfa66..8c2d678 100644
>> --- a/cpu-all.h
>> +++ b/cpu-all.h
>> @@ -37,6 +37,9 @@
>>
>> #include "softfloat.h"
>>
>> +/* to use ffs in flag_to_idx() */
>> +#include<strings.h>
>> +
>> #if defined(HOST_WORDS_BIGENDIAN) != defined(TARGET_WORDS_BIGENDIAN)
>> #define BSWAP_NEEDED
>> #endif
>> @@ -853,7 +856,6 @@ target_phys_addr_t
>> cpu_get_phys_page_debug(CPUState *env, target_ulong addr);
>> /* memory API */
>>
>> extern int phys_ram_fd;
>> -extern uint8_t *phys_ram_dirty;
>> extern ram_addr_t ram_size;
>> extern ram_addr_t last_ram_offset;
>>
>> @@ -878,9 +880,29 @@ extern int mem_prealloc;
>> /* Set if TLB entry is an IO callback. */
>> #define TLB_MMIO (1<< 5)
>>
>> -#define VGA_DIRTY_FLAG 0x01
>> -#define CODE_DIRTY_FLAG 0x02
>> -#define MIGRATION_DIRTY_FLAG 0x08
>> +/* Use DIRTY_IDX as indexes of bit-based phys_ram_dirty. */
>> +#define MASTER_DIRTY_IDX 0
>> +#define VGA_DIRTY_IDX 1
>> +#define CODE_DIRTY_IDX 2
>> +#define MIGRATION_DIRTY_IDX 3
>> +#define NUM_DIRTY_IDX 4
>> +
>> +#define MASTER_DIRTY_FLAG (1<< MASTER_DIRTY_IDX)
>> +#define VGA_DIRTY_FLAG (1<< VGA_DIRTY_IDX)
>> +#define CODE_DIRTY_FLAG (1<< CODE_DIRTY_IDX)
>> +#define MIGRATION_DIRTY_FLAG (1<< MIGRATION_DIRTY_IDX)
>> +
>> +extern unsigned long *phys_ram_dirty[NUM_DIRTY_IDX];
>
> Please modify the bitmap definition in the patch where you start using
> it; this patch won't compile by itself, breaking bisection.

Sorry about that.
I would merge this with 2/6.

>
>> +
>> +static inline int flag_to_idx(int flag)
>> +{
>> + return ffs(flag) - 1;
>> +}
>> +
>> +static inline int idx_to_flag(int idx)
>> +{
>> + return 1<< idx;
>> +}
>>
>
> These should not be in global scope - it is not clear they refer to
> dirty bitmaps. Please rename or move to local scope.
>
> Alternatively, convert the callers to use *_DIRTY_IDX.

OK.  Let me rename it to, dirty_flag_to_idx() and dirty_idx_to_flag() respectively.

  reply	other threads:[~2010-04-19 10:30 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-19  9:43 [Qemu-devel] [PATCH v3 0/6] Introduce bit-based phys_ram_dirty, and bit-based dirty page checker Yoshiaki Tamura
2010-04-19  9:43 ` [Qemu-devel] [PATCH v3 1/6] Modify DIRTY_FLAG value and DIRTY_IDX introduce to use as indexes of bit-based phys_ram_dirty Yoshiaki Tamura
2010-04-19 10:15   ` [Qemu-devel] " Avi Kivity
2010-04-19 10:30     ` Yoshiaki Tamura [this message]
2010-04-19  9:43 ` [Qemu-devel] [PATCH v3 2/6] Introduce bit-based phys_ram_dirty for VGA, CODE, MIGRATION and MASTER Yoshiaki Tamura
2010-04-19 10:17   ` [Qemu-devel] " Avi Kivity
2010-04-19 10:36     ` Yoshiaki Tamura
2010-04-19 11:31       ` Yoshiaki Tamura
2010-04-19 11:38         ` Avi Kivity
2010-04-19 11:52           ` Yoshiaki Tamura
2010-04-19 11:56             ` Avi Kivity
2010-04-19 14:51               ` Yoshiaki Tamura
2010-04-19  9:43 ` [Qemu-devel] [PATCH v3 3/6] Modifies wrapper functions for byte-based phys_ram_dirty bitmap to bit-based phys_ram_dirty bitmap Yoshiaki Tamura
2010-04-19  9:43 ` [Qemu-devel] [PATCH v3 4/6] Introduce cpu_physical_memory_get_dirty_range() Yoshiaki Tamura
2010-04-19  9:43 ` [Qemu-devel] [PATCH v3 5/6] Use cpu_physical_memory_set_dirty_range() to update phys_ram_dirty Yoshiaki Tamura
2010-04-19  9:43 ` [Qemu-devel] [PATCH v3 6/6] Use cpu_physical_memory_get_dirty_range() to check multiple dirty pages Yoshiaki Tamura
2010-04-19 10:24 ` [Qemu-devel] Re: [PATCH v3 0/6] Introduce bit-based phys_ram_dirty, and bit-based dirty page checker Avi Kivity
2010-04-19 10:37   ` Yoshiaki Tamura

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=4BCC30D0.3050407@lab.ntt.co.jp \
    --to=tamura.yoshiaki@lab.ntt.co.jp \
    --cc=aliguori@us.ibm.com \
    --cc=avi@redhat.com \
    --cc=mtosatti@redhat.com \
    --cc=ohmura.kei@lab.ntt.co.jp \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.