All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Blue Swirl <blauwirbel@gmail.com>
Cc: qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH 2/6] memory: change dirty setting APIs to take a size
Date: Sun, 11 Dec 2011 11:20:46 +0200	[thread overview]
Message-ID: <4EE475EE.4070103@redhat.com> (raw)
In-Reply-To: <CAAu8pHsYtFV3RhRFhPNs8Xrj3W+R6uBYEy7sNnTt3-7RhTcOPA@mail.gmail.com>

On 12/10/2011 06:44 PM, Blue Swirl wrote:
> Instead of each target knowing or guessing the guest page size,
> just pass the desired size of dirtied memory area. This should also
> improve performance due to memset() optimizations.
>
>
> -static inline void cpu_physical_memory_set_dirty(ram_addr_t addr)
> +static inline void cpu_physical_memory_range_set_dirty(ram_addr_t start,
> +                                                       ram_addr_t size)
>  {

Since you're changing all callers in one patch, might as well keep the
shorter name.

> -    ram_list.phys_dirty[addr >> TARGET_PAGE_BITS] = 0xff;
> +    start >>= TARGET_PAGE_BITS;
> +    size += TARGET_PAGE_SIZE - 1;
> +    size >>= TARGET_PAGE_BITS;
> +

This is wrong, consider start == 0xfff && size == 2; you only dirty one
page.

> +    memset(&ram_list.phys_dirty[start], 0xff, size);
>  }
>
>  static inline int cpu_physical_memory_set_dirty_flags(ram_addr_t addr,
> diff --git a/hw/cirrus_vga.c b/hw/cirrus_vga.c
> @@ -1918,8 +1915,8 @@ static void
> cirrus_mem_writeb_mode4and5_8bpp(CirrusVGAState * s,
>  	val <<= 1;
>  	dst++;
>      }
> -    memory_region_set_dirty(&s->vga.vram, offset);
> -    memory_region_set_dirty(&s->vga.vram, offset + 7);
> +    memory_region_set_dirty(&s->vga.vram, offset, 1);
> +    memory_region_set_dirty(&s->vga.vram, offset + 7, 1);
>  }


memory_region_set_dirty(..., offset, 8) matches the preceding code better

> -void memory_region_set_dirty(MemoryRegion *mr, target_phys_addr_t addr)
> +void memory_region_set_dirty(MemoryRegion *mr, target_phys_addr_t addr,
> +                             target_phys_addr_t size)
>  {
>      assert(mr->terminates);
> -    return cpu_physical_memory_set_dirty(mr->ram_addr + addr);
> +    return cpu_physical_memory_range_set_dirty(mr->ram_addr + addr, size);
>  }
>
>  void memory_region_sync_dirty_bitmap(MemoryRegion *mr)
> diff --git a/memory.h b/memory.h
> index 53bf261..1f8b5a5 100644
> --- a/memory.h
> +++ b/memory.h
> @@ -318,10 +318,12 @@ bool memory_region_get_dirty(MemoryRegion *mr,
> target_phys_addr_t addr,
>   *
>   * Marks a page as dirty, after it has been dirtied outside guest code.

a range of bytes

>   *
> - * @mr: the memory region being queried.
> + * @mr: the memory region being dirtied.
>   * @addr: the address (relative to the start of the region) being dirtied.
> + * @size: size of the range being dirtied.
>   */
> -void memory_region_set_dirty(MemoryRegion *mr, target_phys_addr_t addr);
> +void memory_region_set_dirty(MemoryRegion *mr, target_phys_addr_t addr,
> +                             target_phys_addr_t size);
>
>

-- 
error compiling committee.c: too many arguments to function

  reply	other threads:[~2011-12-11  9:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-10 16:44 [Qemu-devel] [PATCH 2/6] memory: change dirty setting APIs to take a size Blue Swirl
2011-12-11  9:20 ` Avi Kivity [this message]
2011-12-12 10:45 ` Juan Quintela

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=4EE475EE.4070103@redhat.com \
    --to=avi@redhat.com \
    --cc=blauwirbel@gmail.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 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.