From: Jan Kiszka <jan.kiszka@web.de>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: aliguori@us.ibm.com, mtosatti@redhat.com, qemu-devel@nongnu.org,
Avi Kivity <avi@redhat.com>
Subject: Re: [Qemu-devel] [PATCH, RESEND] kvm: Fix dirty tracking with large kernel page size
Date: Tue, 03 Apr 2012 09:08:16 +0200 [thread overview]
Message-ID: <4F7AA1E0.2070201@web.de> (raw)
In-Reply-To: <1333339457-13854-1-git-send-email-david@gibson.dropbear.id.au>
[-- Attachment #1: Type: text/plain, Size: 2295 bytes --]
On 2012-04-02 06:04, David Gibson wrote:
> From: Ben Herrenschmidt <benh@kernel.crashing.org>
>
> If the kernel page size is larger than TARGET_PAGE_SIZE, which
> happens for example on ppc64 with kernels compiled for 64K pages,
> the dirty tracking doesn't work.
>
> Cc: Avi Kivity <avi@redhat.com>
> Cc: Marcelo Tosatti <mtosatti@redhat.com>
>
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
> ---
> kvm-all.c | 6 ++++--
> 1 files changed, 4 insertions(+), 2 deletions(-)
>
> I've sent this a number of times now, the last couple without comment.
> It fixes a real bug, please apply.
>
> diff --git a/kvm-all.c b/kvm-all.c
> index ba2cee1..7e44429 100644
> --- a/kvm-all.c
> +++ b/kvm-all.c
> @@ -354,6 +354,7 @@ static int kvm_get_dirty_pages_log_range(MemoryRegionSection *section,
> unsigned long page_number, c;
> target_phys_addr_t addr, addr1;
> unsigned int len = ((section->size / TARGET_PAGE_SIZE) + HOST_LONG_BITS - 1) / HOST_LONG_BITS;
> + unsigned long hpratio = getpagesize() / TARGET_PAGE_SIZE;
>
> /*
> * bitmap-traveling is faster than memory-traveling (for addr...)
> @@ -365,10 +366,11 @@ static int kvm_get_dirty_pages_log_range(MemoryRegionSection *section,
> do {
> j = ffsl(c) - 1;
> c &= ~(1ul << j);
> - page_number = i * HOST_LONG_BITS + j;
> + page_number = (i * HOST_LONG_BITS + j) * hpratio;
> addr1 = page_number * TARGET_PAGE_SIZE;
> addr = section->offset_within_region + addr1;
> - memory_region_set_dirty(section->mr, addr, TARGET_PAGE_SIZE);
> + memory_region_set_dirty(section->mr, addr,
> + TARGET_PAGE_SIZE * hpratio);
> } while (c != 0);
> }
> }
Ack for this, but - as proposed earlier - please add an
assert(TARGET_PAGE_SIZE <= getpagesize()) + comment to kvm_init().
Also, what's about coalesced MMIO? I see that the ring definition
depends on [TARGET_]PAGE_SIZE. What page size does the power kernel use
for it, and does it make a relevant difference for space?
Jan
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
next prev parent reply other threads:[~2012-04-03 7:08 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-02 4:04 [Qemu-devel] [PATCH, RESEND] kvm: Fix dirty tracking with large kernel page size David Gibson
2012-04-02 4:14 ` Benjamin Herrenschmidt
2012-04-03 7:08 ` Jan Kiszka [this message]
2012-04-04 1:12 ` David Gibson
2012-04-04 10:58 ` Jan Kiszka
2012-04-04 14:24 ` David Gibson
2012-04-05 7:32 ` Jan Kiszka
-- strict thread matches above, loose matches on Subject: below --
2012-04-04 1:15 David Gibson
2012-04-04 8:41 ` Avi Kivity
2012-05-09 22:23 ` Anthony Liguori
2012-05-10 9:27 ` Avi Kivity
2012-05-10 10:49 ` Jan Kiszka
2012-05-10 10:55 ` Avi Kivity
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=4F7AA1E0.2070201@web.de \
--to=jan.kiszka@web.de \
--cc=aliguori@us.ibm.com \
--cc=avi@redhat.com \
--cc=david@gibson.dropbear.id.au \
--cc=mtosatti@redhat.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 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).