qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v4 43/47] Host page!=target page: Cleanup bitmap


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH v4 43/47] Host page!=target page: Cleanup bitmaps
Date: Tue, 27 Jan 2015 10:20:49 +0000

On 3 October 2014 at 18:47, Dr. David Alan Gilbert (git)
<address@hidden> wrote:

Just noticed after writing most of this email that this is an
old patch with new review comments. I'm sending the below
anyway in case some of it is still valid...

>  /*
> + * Utility for the outgoing postcopy code.
> + *
> + * Discard any partially sent host-page size chunks, mark any partially
> + * dirty host-page size chunks as all dirty.
> + *
> + * Returns: 0 on success
> + */
> +static int postcopy_chunk_hostpages(MigrationState *ms)
> +{
> +    struct RAMBlock *block;
> +    unsigned int host_bits = sysconf(_SC_PAGESIZE) / TARGET_PAGE_SIZE;

I'm guessing this won't build on Win32. Can you use getpagesize() ?
We provide a compat wrapper for that in util/ as necessary.

What happens if the TARGET_PAGE_SIZE is larger than the
host page size? (If you want MIN(host page size, TARGET_PAGE_SIZE)
try qemu_host_page_size, see page_size_init()).

> +    uint32_t host_mask;
> +
> +    /* Should be a power of 2 */
> +    assert(host_bits && !(host_bits & (host_bits - 1)));

assert(is_power_of_2(host_bits));

> +    /*
> +     * If the host_bits isn't a division of 32 (the minimum long size)
> +     * then the code gets a lot more complex; disallow for now
> +     * (I'm not aware of a system where it's true anyway)
> +     */
> +    assert((32 % host_bits) == 0);
> +
> +    /* A mask, starting at bit 0, containing host_bits continuous set bits */
> +    host_mask =  (1u << host_bits) - 1;

If the host has 64K pages and the guest TARGET_PAGE_SIZE is 1K
(eg ARM) then this will shift off the end of your uint32_t.

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]