[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 43/65] ram: Rename qemu_target_page_bits() to qemu_ta
From: |
Juan Quintela |
Subject: |
[Qemu-devel] [PULL 43/65] ram: Rename qemu_target_page_bits() to qemu_target_page_size() |
Date: |
Fri, 21 Apr 2017 13:56:24 +0200 |
It was used as a size in all cases except one.
Signed-off-by: Juan Quintela <address@hidden>
Reviewed-by: Dr. David Alan Gilbert <address@hidden>
---
exec.c | 4 ++--
include/sysemu/sysemu.h | 2 +-
migration/migration.c | 4 ++--
migration/postcopy-ram.c | 8 ++++----
migration/savevm.c | 8 ++++----
5 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/exec.c b/exec.c
index c97ef4a..7a640c7 100644
--- a/exec.c
+++ b/exec.c
@@ -3307,9 +3307,9 @@ int cpu_memory_rw_debug(CPUState *cpu, target_ulong addr,
* Allows code that needs to deal with migration bitmaps etc to still be built
* target independent.
*/
-size_t qemu_target_page_bits(void)
+size_t qemu_target_page_size(void)
{
- return TARGET_PAGE_BITS;
+ return TARGET_PAGE_SIZE;
}
#endif
diff --git a/include/sysemu/sysemu.h b/include/sysemu/sysemu.h
index 576c7ce..16175f7 100644
--- a/include/sysemu/sysemu.h
+++ b/include/sysemu/sysemu.h
@@ -67,7 +67,7 @@ int qemu_reset_requested_get(void);
void qemu_system_killed(int signal, pid_t pid);
void qemu_system_reset(bool report);
void qemu_system_guest_panicked(GuestPanicInformation *info);
-size_t qemu_target_page_bits(void);
+size_t qemu_target_page_size(void);
void qemu_add_exit_notifier(Notifier *notify);
void qemu_remove_exit_notifier(Notifier *notify);
diff --git a/migration/migration.c b/migration/migration.c
index 7da16cf..92a3754 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -654,7 +654,7 @@ static void populate_ram_info(MigrationInfo *info,
MigrationState *s)
info->ram->skipped = 0;
info->ram->normal = norm_mig_pages_transferred();
info->ram->normal_bytes = norm_mig_pages_transferred() *
- (1ul << qemu_target_page_bits());
+ qemu_target_page_size();
info->ram->mbps = s->mbps;
info->ram->dirty_sync_count = ram_dirty_sync_count();
info->ram->postcopy_requests = ram_postcopy_requests();
@@ -2009,7 +2009,7 @@ static void *migration_thread(void *opaque)
10000 is a small enough number for our purposes */
if (ram_dirty_pages_rate() && transferred_bytes > 10000) {
s->expected_downtime = ram_dirty_pages_rate() *
- (1ul << qemu_target_page_bits()) / bandwidth;
+ qemu_target_page_size() / bandwidth;
}
qemu_file_reset_rate_limit(s->to_dst_file);
diff --git a/migration/postcopy-ram.c b/migration/postcopy-ram.c
index dc80dbb..8756364 100644
--- a/migration/postcopy-ram.c
+++ b/migration/postcopy-ram.c
@@ -123,7 +123,7 @@ bool postcopy_ram_supported_by_host(void)
struct uffdio_range range_struct;
uint64_t feature_mask;
- if ((1ul << qemu_target_page_bits()) > pagesize) {
+ if (qemu_target_page_size() > pagesize) {
error_report("Target page size bigger than host page size");
goto out;
}
@@ -745,10 +745,10 @@ PostcopyDiscardState
*postcopy_discard_send_init(MigrationState *ms,
void postcopy_discard_send_range(MigrationState *ms, PostcopyDiscardState *pds,
unsigned long start, unsigned long length)
{
- size_t tp_bits = qemu_target_page_bits();
+ size_t tp_size = qemu_target_page_size();
/* Convert to byte offsets within the RAM block */
- pds->start_list[pds->cur_entry] = (start - pds->offset) << tp_bits;
- pds->length_list[pds->cur_entry] = length << tp_bits;
+ pds->start_list[pds->cur_entry] = (start - pds->offset) * tp_size;
+ pds->length_list[pds->cur_entry] = length * tp_size;
trace_postcopy_discard_send_range(pds->ramblock_name, start, length);
pds->cur_entry++;
pds->nsentwords++;
diff --git a/migration/savevm.c b/migration/savevm.c
index 853a81a..bbf055d 100644
--- a/migration/savevm.c
+++ b/migration/savevm.c
@@ -871,7 +871,7 @@ void qemu_savevm_send_postcopy_advise(QEMUFile *f)
{
uint64_t tmp[2];
tmp[0] = cpu_to_be64(ram_pagesize_summary());
- tmp[1] = cpu_to_be64(1ul << qemu_target_page_bits());
+ tmp[1] = cpu_to_be64(qemu_target_page_size());
trace_qemu_savevm_send_postcopy_advise();
qemu_savevm_command_send(f, MIG_CMD_POSTCOPY_ADVISE, 16, (uint8_t *)tmp);
@@ -1390,13 +1390,13 @@ static int
loadvm_postcopy_handle_advise(MigrationIncomingState *mis)
}
remote_tps = qemu_get_be64(mis->from_src_file);
- if (remote_tps != (1ul << qemu_target_page_bits())) {
+ if (remote_tps != qemu_target_page_size()) {
/*
* Again, some differences could be dealt with, but for now keep it
* simple.
*/
- error_report("Postcopy needs matching target page sizes (s=%d d=%d)",
- (int)remote_tps, 1 << qemu_target_page_bits());
+ error_report("Postcopy needs matching target page sizes (s=%d d=%zd)",
+ (int)remote_tps, qemu_target_page_size());
return -1;
}
--
2.9.3
- [Qemu-devel] [PULL 33/65] ram: Move src_page_req* to RAMState, (continued)
- [Qemu-devel] [PULL 33/65] ram: Move src_page_req* to RAMState, Juan Quintela, 2017/04/21
- [Qemu-devel] [PULL 34/65] ram: Create ram_dirty_sync_count(), Juan Quintela, 2017/04/21
- [Qemu-devel] [PULL 35/65] ram: Remove dirty_bytes_rate, Juan Quintela, 2017/04/21
- [Qemu-devel] [PULL 36/65] ram: Move dirty_pages_rate to RAMState, Juan Quintela, 2017/04/21
- [Qemu-devel] [PULL 37/65] ram: Move postcopy_requests into RAMState, Juan Quintela, 2017/04/21
- [Qemu-devel] [PULL 38/65] ram: Add QEMUFile to RAMState, Juan Quintela, 2017/04/21
- [Qemu-devel] [PULL 39/65] ram: Move QEMUFile into RAMState, Juan Quintela, 2017/04/21
- [Qemu-devel] [PULL 40/65] ram: Remove compression_switch and inline its logic, Juan Quintela, 2017/04/21
- [Qemu-devel] [PULL 41/65] migration: Remove MigrationState from migration_in_postcopy, Juan Quintela, 2017/04/21
- [Qemu-devel] [PULL 42/65] ram: We don't need MigrationState parameter anymore, Juan Quintela, 2017/04/21
- [Qemu-devel] [PULL 43/65] ram: Rename qemu_target_page_bits() to qemu_target_page_size(),
Juan Quintela <=
- [Qemu-devel] [PULL 44/65] ram: Add page-size to output in 'info migrate', Juan Quintela, 2017/04/21
- [Qemu-devel] [PULL 45/65] ram: Pass RAMBlock to bitmap_sync, Juan Quintela, 2017/04/21
- [Qemu-devel] [PULL 46/65] ram: ram_discard_range() don't use the mis parameter, Juan Quintela, 2017/04/21
- [Qemu-devel] [PULL 47/65] ram: reorganize last_sent_block, Juan Quintela, 2017/04/21
- [Qemu-devel] [PULL 48/65] ram: Use page number instead of an address for the bitmap operations, Juan Quintela, 2017/04/21
- [Qemu-devel] [PULL 49/65] ram: Remember last_page instead of last_offset, Juan Quintela, 2017/04/21
- [Qemu-devel] [PULL 50/65] ram: Change offset field in PageSearchStatus to page, Juan Quintela, 2017/04/21
- [Qemu-devel] [PULL 52/65] ram: rename last_ram_offset() last_ram_pages(), Juan Quintela, 2017/04/21
- [Qemu-devel] [PULL 54/65] migration: Remove MigrationState parameter from migration_is_idle(), Juan Quintela, 2017/04/21
- [Qemu-devel] [PULL 51/65] ram: Use ramblock and page offset instead of absolute offset, Juan Quintela, 2017/04/21