* [PATCH] memory: Fix start offset for bitmap log_clear hook
@ 2020-02-18 10:19 Matt Borgerson
2020-02-18 16:53 ` Peter Xu
0 siblings, 1 reply; 4+ messages in thread
From: Matt Borgerson @ 2020-02-18 10:19 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, Matt Borgerson, peterx, rth
Currently only the final page offset is being passed to the `log_clear`
hook via `memory_region_clear_dirty_bitmap` after it is used as an
iterator in `cpu_physical_memory_test_and_clear_dirty`. This patch
corrects the start address and size of the region.
Signed-off-by: Matt Borgerson <contact@mborgerson.com>
---
exec.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/exec.c b/exec.c
index 8e9cc3b47c..f0f7d0be49 100644
--- a/exec.c
+++ b/exec.c
@@ -1314,7 +1314,7 @@ bool cpu_physical_memory_test_and_clear_dirty(ram_addr_t start,
unsigned client)
{
DirtyMemoryBlocks *blocks;
- unsigned long end, page;
+ unsigned long end, page, start_page;
bool dirty = false;
RAMBlock *ramblock;
uint64_t mr_offset, mr_size;
@@ -1324,7 +1324,8 @@ bool cpu_physical_memory_test_and_clear_dirty(ram_addr_t start,
}
end = TARGET_PAGE_ALIGN(start + length) >> TARGET_PAGE_BITS;
- page = start >> TARGET_PAGE_BITS;
+ start_page = start >> TARGET_PAGE_BITS;
+ page = start_page;
WITH_RCU_READ_LOCK_GUARD() {
blocks = atomic_rcu_read(&ram_list.dirty_memory[client]);
@@ -1344,8 +1345,8 @@ bool cpu_physical_memory_test_and_clear_dirty(ram_addr_t start,
page += num;
}
- mr_offset = (ram_addr_t)(page << TARGET_PAGE_BITS) - ramblock->offset;
- mr_size = (end - page) << TARGET_PAGE_BITS;
+ mr_offset = (ram_addr_t)(start_page << TARGET_PAGE_BITS) - ramblock->offset;
+ mr_size = (end - start_page) << TARGET_PAGE_BITS;
memory_region_clear_dirty_bitmap(ramblock->mr, mr_offset, mr_size);
}
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] memory: Fix start offset for bitmap log_clear hook
2020-02-18 10:19 [PATCH] memory: Fix start offset for bitmap log_clear hook Matt Borgerson
@ 2020-02-18 16:53 ` Peter Xu
2020-02-25 20:46 ` Matt Borgerson
0 siblings, 1 reply; 4+ messages in thread
From: Peter Xu @ 2020-02-18 16:53 UTC (permalink / raw)
To: Matt Borgerson; +Cc: pbonzini, qemu-devel, rth
On Tue, Feb 18, 2020 at 03:19:10AM -0700, Matt Borgerson wrote:
> Currently only the final page offset is being passed to the `log_clear`
> hook via `memory_region_clear_dirty_bitmap` after it is used as an
> iterator in `cpu_physical_memory_test_and_clear_dirty`. This patch
> corrects the start address and size of the region.
>
> Signed-off-by: Matt Borgerson <contact@mborgerson.com>
Looks correct, thanks!
Reviewed-by: Peter Xu <peterx@redhat.com>
--
Peter Xu
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] memory: Fix start offset for bitmap log_clear hook
2020-02-18 16:53 ` Peter Xu
@ 2020-02-25 20:46 ` Matt Borgerson
2020-03-02 16:34 ` Paolo Bonzini
0 siblings, 1 reply; 4+ messages in thread
From: Matt Borgerson @ 2020-02-25 20:46 UTC (permalink / raw)
To: Peter Xu; +Cc: pbonzini, qemu-devel, rth
[ ping ]
Hi Paolo, would you mind taking a quick look at this patch for
memory.c to consider
it for merge? This resolves an issue with dirty bits not being cleared
as expected.
Here's the Patchwork link: http://patchwork.ozlabs.org/patch/1240121/
Thanks for your time!
Matt
On Tue, Feb 18, 2020 at 9:53 AM Peter Xu <peterx@redhat.com> wrote:
>
> On Tue, Feb 18, 2020 at 03:19:10AM -0700, Matt Borgerson wrote:
> > Currently only the final page offset is being passed to the `log_clear`
> > hook via `memory_region_clear_dirty_bitmap` after it is used as an
> > iterator in `cpu_physical_memory_test_and_clear_dirty`. This patch
> > corrects the start address and size of the region.
> >
> > Signed-off-by: Matt Borgerson <contact@mborgerson.com>
>
> Looks correct, thanks!
>
> Reviewed-by: Peter Xu <peterx@redhat.com>
>
> --
> Peter Xu
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] memory: Fix start offset for bitmap log_clear hook
2020-02-25 20:46 ` Matt Borgerson
@ 2020-03-02 16:34 ` Paolo Bonzini
0 siblings, 0 replies; 4+ messages in thread
From: Paolo Bonzini @ 2020-03-02 16:34 UTC (permalink / raw)
To: Matt Borgerson, Peter Xu; +Cc: qemu-devel, rth
On 25/02/20 21:46, Matt Borgerson wrote:
> [ ping ]
>
> Hi Paolo, would you mind taking a quick look at this patch for
> memory.c to consider
> it for merge? This resolves an issue with dirty bits not being cleared
> as expected.
>
> Here's the Patchwork link: http://patchwork.ozlabs.org/patch/1240121/
>
> Thanks for your time!
Yes, I queued it now.
Thanks!
Paolo
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-03-02 16:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-18 10:19 [PATCH] memory: Fix start offset for bitmap log_clear hook Matt Borgerson
2020-02-18 16:53 ` Peter Xu
2020-02-25 20:46 ` Matt Borgerson
2020-03-02 16:34 ` Paolo Bonzini
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).