From: Juan Quintela <quintela@redhat.com>
To: qemu-devel@nongnu.org
Cc: Andrei Gudkov <gudkov.andrei@huawei.com>,
Leonardo Bras <leobras@redhat.com>,
Chuan Zheng <zhengchuan@huawei.com>,
Juan Quintela <quintela@redhat.com>, Peter Xu <peterx@redhat.com>,
Zhenzhong Duan <zhenzhong.duan@intel.com>
Subject: [PATCH 1/3] migration: Teach dirtyrate about qemu_target_page_size()
Date: Thu, 11 May 2023 11:22:37 +0200 [thread overview]
Message-ID: <20230511092239.14607-2-quintela@redhat.com> (raw)
In-Reply-To: <20230511092239.14607-1-quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
---
migration/dirtyrate.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/migration/dirtyrate.c b/migration/dirtyrate.c
index 180ba38c7a..9aa092738c 100644
--- a/migration/dirtyrate.c
+++ b/migration/dirtyrate.c
@@ -17,6 +17,7 @@
#include "cpu.h"
#include "exec/ramblock.h"
#include "exec/ram_addr.h"
+#include "exec/target_page.h"
#include "qemu/rcu_queue.h"
#include "qemu/main-loop.h"
#include "qapi/qapi-commands-migration.h"
@@ -78,7 +79,7 @@ static int64_t do_calculate_dirtyrate(DirtyPageRecord dirty_pages,
uint64_t increased_dirty_pages =
dirty_pages.end_pages - dirty_pages.start_pages;
- memory_size_MB = (increased_dirty_pages * TARGET_PAGE_SIZE) >> 20;
+ memory_size_MB = (increased_dirty_pages * qemu_target_page_size()) >> 20;
return memory_size_MB * 1000 / calc_time_ms;
}
@@ -291,8 +292,8 @@ static void update_dirtyrate_stat(struct RamblockDirtyInfo *info)
DirtyStat.page_sampling.total_dirty_samples += info->sample_dirty_count;
DirtyStat.page_sampling.total_sample_count += info->sample_pages_count;
/* size of total pages in MB */
- DirtyStat.page_sampling.total_block_mem_MB += (info->ramblock_pages *
- TARGET_PAGE_SIZE) >> 20;
+ DirtyStat.page_sampling.total_block_mem_MB +=
+ (info->ramblock_pages * qemu_target_page_size()) >> 20;
}
static void update_dirtyrate(uint64_t msec)
@@ -315,10 +316,10 @@ static void update_dirtyrate(uint64_t msec)
static uint32_t get_ramblock_vfn_hash(struct RamblockDirtyInfo *info,
uint64_t vfn)
{
+ int page_size = qemu_target_page_size();
uint32_t crc;
- crc = crc32(0, (info->ramblock_addr +
- vfn * TARGET_PAGE_SIZE), TARGET_PAGE_SIZE);
+ crc = crc32(0, info->ramblock_addr + vfn * page_size, page_size);
trace_get_ramblock_vfn_hash(info->idstr, vfn, crc);
return crc;
--
2.40.1
next prev parent reply other threads:[~2023-05-11 9:23 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-11 9:22 [PATCH 0/3] migration: Make dirtyrate.c target independent Juan Quintela
2023-05-11 9:22 ` Juan Quintela [this message]
2023-05-11 11:07 ` [PATCH 1/3] migration: Teach dirtyrate about qemu_target_page_size() Richard Henderson
2023-05-11 11:44 ` Juan Quintela
2023-05-11 13:12 ` Juan Quintela
2023-05-11 14:36 ` gudkov.andrei--- via
2023-05-11 9:22 ` [PATCH 2/3] migration: Teach dirtyrate about qemu_target_page_bits() Juan Quintela
2023-05-11 11:08 ` Richard Henderson
2023-05-11 12:01 ` Philippe Mathieu-Daudé
2023-05-11 9:22 ` [PATCH 3/3] migration: Make dirtyrate.c target independent Juan Quintela
2023-05-11 11:09 ` Richard Henderson
2023-05-11 11:46 ` Juan Quintela
2023-05-11 11:52 ` Richard Henderson
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=20230511092239.14607-2-quintela@redhat.com \
--to=quintela@redhat.com \
--cc=gudkov.andrei@huawei.com \
--cc=leobras@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=zhengchuan@huawei.com \
--cc=zhenzhong.duan@intel.com \
/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).