qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Alexander Graf <agraf@suse.de>
Cc: qemu-devel@nongnu.org
Subject: [Qemu-devel] Re: [PATCH 2/3] Assume PPC64 host on PPC32 KVM
Date: Fri, 24 Jul 2009 12:59:17 +0200	[thread overview]
Message-ID: <4A699405.9010703@siemens.com> (raw)
In-Reply-To: <1248384704-47824-3-git-send-email-agraf@suse.de>

Alexander Graf wrote:
> When talking to the kernel about dirty maps, we need to find out which
> bits were actually set. This is done by set_bit and test_bit like
> functiontality which uses the "long" variable type.
> 
> Now, with PPC32 userspace and PPC64 kernel space (which is pretty common),
> we can't interpret the bits properly anymore, because we think long is
> 32 bits wide.
> 
> So for PPC dirty bitmap analysis, let's just assume we're always running
> on a PPC64 host. Currently there is no dirty bitmap implementation for
> PPC32 / PPCEMB anyways.
> 
> Unbreaks dirty logging on PPC.
> 
> Signed-off-by: Alexander Graf <agraf@suse.de>
> ---
>  kvm-all.c |    6 ++++++
>  1 files changed, 6 insertions(+), 0 deletions(-)
> 
> diff --git a/kvm-all.c b/kvm-all.c
> index 824bb4c..bfaa623 100644
> --- a/kvm-all.c
> +++ b/kvm-all.c
> @@ -357,7 +357,13 @@ int kvm_physical_sync_dirty_bitmap(target_phys_addr_t start_addr,
>          for (phys_addr = mem->start_addr, addr = mem->phys_offset;
>               phys_addr < mem->start_addr + mem->memory_size;
>               phys_addr += TARGET_PAGE_SIZE, addr += TARGET_PAGE_SIZE) {
> +#ifdef HOST_PPC
> +             /* Big endian keeps us from having different long sizes in user and
> +              * kernel space, so assume we're always on ppc64. */
> +            uint64_t *bitmap = (uint64_t *)d.dirty_bitmap;
> +#else
>              unsigned long *bitmap = (unsigned long *)d.dirty_bitmap;
> +#endif
>              unsigned nr = (phys_addr - mem->start_addr) >> TARGET_PAGE_BITS;
>              unsigned word = nr / (sizeof(*bitmap) * 8);
>              unsigned bit = nr % (sizeof(*bitmap) * 8);

This rather screams for a generic fix. Current code assumes
sizeof(unsigned long) == 8. That should already break on 32-bit x86
hosts. So either do (sizeof(*bitmap) * sizeof(unsigned long)) or switch
to uint64_t - but for ALL hosts.

Jan

-- 
Siemens AG, Corporate Technology, CT SE 2
Corporate Competence Center Embedded Linux

  parent reply	other threads:[~2009-07-24 10:59 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-23 21:31 [Qemu-devel] [PATCH 0/3] PPC KVM bringup patches round 2 Alexander Graf
2009-07-23 21:31 ` [Qemu-devel] [PATCH 1/3] Move mp_state to CPU_COMMON Alexander Graf
2009-07-23 21:31   ` [Qemu-devel] [PATCH 2/3] Assume PPC64 host on PPC32 KVM Alexander Graf
2009-07-23 21:31     ` [Qemu-devel] [PATCH 3/3] PPC: Round VGA BIOS size to page boundary Alexander Graf
2009-07-23 21:50       ` Alexander Graf
     [not found]       ` <m33a8m35kn.fsf@neno.mitica>
2009-07-24  9:25         ` [Qemu-devel] " Alexander Graf
2009-07-24 10:52       ` Jan Kiszka
2009-07-24 11:00         ` Alexander Graf
2009-07-24 10:59     ` Jan Kiszka [this message]
2009-07-24 11:03       ` [Qemu-devel] Re: [PATCH 2/3] Assume PPC64 host on PPC32 KVM Alexander Graf
2009-07-24 11:17         ` Jan Kiszka
2009-07-24 11:23           ` Alexander Graf
2009-07-24 11:51             ` Jan Kiszka
2009-07-24 11:56               ` Alexander Graf
2009-07-24 12:57                 ` Jan Kiszka
2009-07-24 13:05                   ` Alexander Graf
2009-07-24 13:15                     ` Jan Kiszka
2009-07-24 13:26                       ` Alexander Graf

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=4A699405.9010703@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=agraf@suse.de \
    --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 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).