From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Peter Xu <peterx@redhat.com>
Cc: Juan Quintela <quintela@redhat.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 40/51] ram: Rename qemu_target_page_bits() to qemu_target_page_size()
Date: Thu, 30 Mar 2017 09:55:46 +0100 [thread overview]
Message-ID: <20170330085545.GB2800@work-vm> (raw)
In-Reply-To: <20170330080334.GB21915@pxdev.xzpeter.org>
* Peter Xu (peterx@redhat.com) wrote:
> On Thu, Mar 23, 2017 at 09:45:33PM +0100, Juan Quintela wrote:
> > It was used as a size in all cases except one.
>
> Considering that:
>
> - qemu_target_page_bits() is only used in migration codes, in only
> several places below
>
> - migration codes is using TARGET_PAGE_{BITS|SIZE} a lot as well
>
> How about we just remove this function, and directly use
> TARGET_PAGE_{BITS|SIZE}?
We can't because the TARGET_* macros are defined in headers
that are only allowed to be included in target-specific builds.
Most of QEMUs code (including all migration/*) is built
target independent and so the headers error if we try and include
them.
That's why I added qemu_target_page_bits()
Dave
> Thanks,
>
> >
> > Signed-off-by: Juan Quintela <quintela@redhat.com>
> > ---
> > 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 e57a8a2..9a4c385 100644
> > --- a/exec.c
> > +++ b/exec.c
> > @@ -3349,9 +3349,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 3f99ab3..92c3c6b 100644
> > --- a/migration/migration.c
> > +++ b/migration/migration.c
> > @@ -646,7 +646,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();
> > @@ -2001,7 +2001,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
> >
> >
>
> -- peterx
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
next prev parent reply other threads:[~2017-03-30 8:56 UTC|newest]
Thread overview: 167+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-23 20:44 [Qemu-devel] [PATCH v2 00/51] Creating RAMState for migration Juan Quintela
2017-03-23 20:44 ` [Qemu-devel] [PATCH 01/51] ram: Update all functions comments Juan Quintela
2017-03-24 9:55 ` Peter Xu
2017-03-24 11:44 ` Juan Quintela
2017-03-26 13:43 ` Peter Xu
2017-03-28 18:32 ` Juan Quintela
2017-03-31 14:43 ` Dr. David Alan Gilbert
2017-04-03 20:40 ` Juan Quintela
2017-03-31 15:51 ` Dr. David Alan Gilbert
2017-04-04 17:12 ` Juan Quintela
2017-03-23 20:44 ` [Qemu-devel] [PATCH 02/51] ram: rename block_name to rbname Juan Quintela
2017-03-24 11:11 ` Dr. David Alan Gilbert
2017-03-24 17:15 ` Eric Blake
2017-03-28 10:52 ` Juan Quintela
2017-03-23 20:44 ` [Qemu-devel] [PATCH 03/51] ram: Create RAMState Juan Quintela
2017-03-27 4:43 ` Peter Xu
2017-03-23 20:44 ` [Qemu-devel] [PATCH 04/51] ram: Add dirty_rate_high_cnt to RAMState Juan Quintela
2017-03-27 7:24 ` Peter Xu
2017-03-23 20:44 ` [Qemu-devel] [PATCH 05/51] ram: Move bitmap_sync_count into RAMState Juan Quintela
2017-03-27 7:34 ` Peter Xu
2017-03-28 10:56 ` Juan Quintela
2017-03-29 6:55 ` Peter Xu
2017-03-29 8:56 ` Juan Quintela
2017-03-29 9:07 ` Peter Xu
2017-03-23 20:44 ` [Qemu-devel] [PATCH 06/51] ram: Move start time " Juan Quintela
2017-03-27 7:54 ` Peter Xu
2017-03-28 11:00 ` Juan Quintela
2017-03-23 20:45 ` [Qemu-devel] [PATCH 07/51] ram: Move bytes_xfer_prev " Juan Quintela
2017-03-27 8:04 ` Peter Xu
2017-03-23 20:45 ` [Qemu-devel] [PATCH 08/51] ram: Move num_dirty_pages_period " Juan Quintela
2017-03-27 8:07 ` Peter Xu
2017-03-23 20:45 ` [Qemu-devel] [PATCH 09/51] ram: Move xbzrle_cache_miss_prev " Juan Quintela
2017-03-23 20:45 ` [Qemu-devel] [PATCH 10/51] ram: Move iterations_prev " Juan Quintela
2017-03-23 20:45 ` [Qemu-devel] [PATCH 11/51] ram: Move dup_pages " Juan Quintela
2017-03-27 9:23 ` Peter Xu
2017-03-28 18:43 ` Juan Quintela
2017-03-29 7:02 ` Peter Xu
2017-03-29 8:26 ` Juan Quintela
2017-03-31 14:58 ` Dr. David Alan Gilbert
2017-03-23 20:45 ` [Qemu-devel] [PATCH 12/51] ram: Remove unused dup_mig_bytes_transferred() Juan Quintela
2017-03-27 9:24 ` Peter Xu
2017-03-23 20:45 ` [Qemu-devel] [PATCH 13/51] ram: Remove unused pages_skipped variable Juan Quintela
2017-03-27 9:26 ` Peter Xu
2017-03-23 20:45 ` [Qemu-devel] [PATCH 14/51] ram: Move norm_pages to RAMState Juan Quintela
2017-03-27 9:43 ` Peter Xu
2017-03-23 20:45 ` [Qemu-devel] [PATCH 15/51] ram: Remove norm_mig_bytes_transferred Juan Quintela
2017-03-23 20:45 ` [Qemu-devel] [PATCH 16/51] ram: Move iterations into RAMState Juan Quintela
2017-03-27 10:46 ` Peter Xu
2017-03-28 18:34 ` Juan Quintela
2017-03-23 20:45 ` [Qemu-devel] [PATCH 17/51] ram: Move xbzrle_bytes " Juan Quintela
2017-03-24 10:12 ` Dr. David Alan Gilbert
2017-03-27 10:48 ` Peter Xu
2017-03-23 20:45 ` [Qemu-devel] [PATCH 18/51] ram: Move xbzrle_pages " Juan Quintela
2017-03-24 10:13 ` Dr. David Alan Gilbert
2017-03-27 10:59 ` Peter Xu
2017-03-23 20:45 ` [Qemu-devel] [PATCH 19/51] ram: Move xbzrle_cache_miss " Juan Quintela
2017-03-24 10:15 ` Dr. David Alan Gilbert
2017-03-27 11:00 ` Peter Xu
2017-03-23 20:45 ` [Qemu-devel] [PATCH 20/51] ram: Move xbzrle_cache_miss_rate " Juan Quintela
2017-03-24 10:17 ` Dr. David Alan Gilbert
2017-03-27 11:01 ` Peter Xu
2017-03-23 20:45 ` [Qemu-devel] [PATCH 21/51] ram: Move xbzrle_overflows " Juan Quintela
2017-03-24 10:22 ` Dr. David Alan Gilbert
2017-03-27 11:03 ` Peter Xu
2017-03-23 20:45 ` [Qemu-devel] [PATCH 22/51] ram: Move migration_dirty_pages to RAMState Juan Quintela
2017-03-30 6:24 ` Peter Xu
2017-03-23 20:45 ` [Qemu-devel] [PATCH 23/51] ram: Everything was init to zero, so use memset Juan Quintela
2017-03-29 17:14 ` Dr. David Alan Gilbert
2017-03-30 6:25 ` Peter Xu
2017-03-23 20:45 ` [Qemu-devel] [PATCH 24/51] ram: Move migration_bitmap_mutex into RAMState Juan Quintela
2017-03-30 6:25 ` Peter Xu
2017-03-30 8:49 ` Dr. David Alan Gilbert
2017-03-23 20:45 ` [Qemu-devel] [PATCH 25/51] ram: Move migration_bitmap_rcu " Juan Quintela
2017-03-30 6:25 ` Peter Xu
2017-03-23 20:45 ` [Qemu-devel] [PATCH 26/51] ram: Move bytes_transferred " Juan Quintela
2017-03-29 17:38 ` Dr. David Alan Gilbert
2017-03-30 6:26 ` Peter Xu
2017-03-23 20:45 ` [Qemu-devel] [PATCH 27/51] ram: Use the RAMState bytes_transferred parameter Juan Quintela
2017-03-30 6:27 ` Peter Xu
2017-03-30 16:05 ` Juan Quintela
2017-03-23 20:45 ` [Qemu-devel] [PATCH 28/51] ram: Remove ram_save_remaining Juan Quintela
2017-03-24 15:34 ` Dr. David Alan Gilbert
2017-03-30 6:24 ` Peter Xu
2017-03-30 16:07 ` Juan Quintela
2017-03-31 2:57 ` Peter Xu
2017-03-23 20:45 ` [Qemu-devel] [PATCH 29/51] ram: Move last_req_rb to RAMState Juan Quintela
2017-03-30 6:49 ` Peter Xu
2017-03-30 16:08 ` Juan Quintela
2017-03-31 3:00 ` Peter Xu
2017-03-23 20:45 ` [Qemu-devel] [PATCH 30/51] ram: Move src_page_req* " Juan Quintela
2017-03-30 6:56 ` Peter Xu
2017-03-30 16:09 ` Juan Quintela
2017-03-31 15:25 ` Dr. David Alan Gilbert
2017-04-01 7:15 ` Peter Xu
2017-04-05 10:27 ` Dr. David Alan Gilbert
2017-03-31 16:52 ` Dr. David Alan Gilbert
2017-04-04 17:42 ` Juan Quintela
2017-04-05 10:34 ` Dr. David Alan Gilbert
2017-03-23 20:45 ` [Qemu-devel] [PATCH 31/51] ram: Create ram_dirty_sync_count() Juan Quintela
2017-03-29 9:06 ` Peter Xu
2017-03-23 20:45 ` [Qemu-devel] [PATCH 32/51] ram: Remove dirty_bytes_rate Juan Quintela
2017-03-30 7:00 ` Peter Xu
2017-03-23 20:45 ` [Qemu-devel] [PATCH 33/51] ram: Move dirty_pages_rate to RAMState Juan Quintela
2017-03-30 7:04 ` Peter Xu
2017-03-23 20:45 ` [Qemu-devel] [PATCH 34/51] ram: Move postcopy_requests into RAMState Juan Quintela
2017-03-30 7:06 ` Peter Xu
2017-03-23 20:45 ` [Qemu-devel] [PATCH 35/51] ram: Add QEMUFile to RAMState Juan Quintela
2017-03-24 10:52 ` Dr. David Alan Gilbert
2017-03-24 11:14 ` Juan Quintela
2017-03-23 20:45 ` [Qemu-devel] [PATCH 36/51] ram: Move QEMUFile into RAMState Juan Quintela
2017-03-31 14:21 ` Dr. David Alan Gilbert
2017-03-23 20:45 ` [Qemu-devel] [PATCH 37/51] ram: Move compression_switch to RAMState Juan Quintela
2017-03-29 18:02 ` Dr. David Alan Gilbert
2017-03-30 16:19 ` Juan Quintela
2017-03-30 16:27 ` Juan Quintela
2017-03-30 7:52 ` Peter Xu
2017-03-30 16:30 ` Juan Quintela
2017-03-31 3:04 ` Peter Xu
2017-03-23 20:45 ` [Qemu-devel] [PATCH 38/51] migration: Remove MigrationState from migration_in_postcopy Juan Quintela
2017-03-24 15:27 ` Dr. David Alan Gilbert
2017-03-30 8:06 ` Peter Xu
2017-03-23 20:45 ` [Qemu-devel] [PATCH 39/51] ram: We don't need MigrationState parameter anymore Juan Quintela
2017-03-24 15:28 ` Dr. David Alan Gilbert
2017-03-30 8:05 ` Peter Xu
2017-03-23 20:45 ` [Qemu-devel] [PATCH 40/51] ram: Rename qemu_target_page_bits() to qemu_target_page_size() Juan Quintela
2017-03-24 15:32 ` Dr. David Alan Gilbert
2017-03-30 8:03 ` Peter Xu
2017-03-30 8:55 ` Dr. David Alan Gilbert [this message]
2017-03-30 9:11 ` Juan Quintela
2017-03-23 20:45 ` [Qemu-devel] [PATCH 41/51] Add page-size to output in 'info migrate' Juan Quintela
2017-03-24 17:17 ` Eric Blake
2017-03-23 20:45 ` [Qemu-devel] [PATCH 42/51] ram: Pass RAMBlock to bitmap_sync Juan Quintela
2017-03-24 1:10 ` Yang Hongyang
2017-03-24 8:29 ` Juan Quintela
2017-03-24 9:11 ` Yang Hongyang
2017-03-24 10:05 ` Juan Quintela
2017-03-28 17:12 ` Dr. David Alan Gilbert
2017-03-28 18:45 ` Juan Quintela
2017-03-30 9:07 ` Dr. David Alan Gilbert
2017-03-30 11:38 ` Juan Quintela
2017-03-30 19:10 ` Dr. David Alan Gilbert
2017-04-04 17:46 ` Juan Quintela
2017-03-23 20:45 ` [Qemu-devel] [PATCH 43/51] ram: ram_discard_range() don't use the mis parameter Juan Quintela
2017-03-29 18:43 ` Dr. David Alan Gilbert
2017-03-30 10:28 ` Peter Xu
2017-03-23 20:45 ` [Qemu-devel] [PATCH 44/51] ram: reorganize last_sent_block Juan Quintela
2017-03-31 8:35 ` Peter Xu
2017-03-31 8:40 ` Dr. David Alan Gilbert
2017-03-23 20:45 ` [Qemu-devel] [PATCH 45/51] ram: Use page number instead of an address for the bitmap operations Juan Quintela
2017-03-31 12:22 ` Dr. David Alan Gilbert
2017-04-04 18:21 ` Juan Quintela
2017-03-23 20:45 ` [Qemu-devel] [PATCH 46/51] ram: Remember last_page instead of last_offset Juan Quintela
2017-03-31 9:09 ` Dr. David Alan Gilbert
2017-04-04 18:24 ` Juan Quintela
2017-03-23 20:45 ` [Qemu-devel] [PATCH 47/51] ram: Change offset field in PageSearchStatus to page Juan Quintela
2017-03-31 12:31 ` Dr. David Alan Gilbert
2017-03-23 20:45 ` [Qemu-devel] [PATCH 48/51] ram: Use ramblock and page offset instead of absolute offset Juan Quintela
2017-03-31 17:17 ` Dr. David Alan Gilbert
2017-03-23 20:45 ` [Qemu-devel] [PATCH 49/51] ram: rename last_ram_offset() last_ram_pages() Juan Quintela
2017-03-31 14:23 ` Dr. David Alan Gilbert
2017-03-23 20:45 ` [Qemu-devel] [PATCH 50/51] ram: Use RAMBitmap type for coherence Juan Quintela
2017-03-31 14:27 ` Dr. David Alan Gilbert
2017-03-23 20:45 ` [Qemu-devel] [PATCH 51/51] migration: Remove MigrationState parameter from migration_is_idle() Juan Quintela
2017-03-24 16:38 ` Dr. David Alan Gilbert
2017-03-31 14:34 ` [Qemu-devel] [PATCH v2 00/51] Creating RAMState for migration Dr. David Alan Gilbert
2017-04-04 17:22 ` Juan Quintela
2017-04-04 17:36 ` Dr. David Alan Gilbert
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=20170330085545.GB2800@work-vm \
--to=dgilbert@redhat.com \
--cc=peterx@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=quintela@redhat.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).