summary refs log tree commit diff stats
path: root/migration/ram.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* ram: Use page number instead of an address for the bitmap operationsJuan Quintela2017-04-211-42/+34
| | | | | | | | | | | | | We use an unsigned long for the page number. Notice that our bitmaps already got that for the index, so we have that limit. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> -- rename page to page_abs everywhere. fix trace types for pages
* ram: reorganize last_sent_blockJuan Quintela2017-04-211-21/+15
| | | | | | | | | | We were setting it far away of when we changed it. Now everything is done inside save_page_header. Once there, reorganize code to pass RAMState. We also set CONTINUE flag in a single place. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com>
* ram: ram_discard_range() don't use the mis parameterJuan Quintela2017-04-211-6/+3
| | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com>
* ram: Pass RAMBlock to bitmap_syncJuan Quintela2017-04-211-4/+4
| | | | | | | | We change the meaning of start to be the offset from the beggining of the block. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
* ram: We don't need MigrationState parameter anymoreJuan Quintela2017-04-211-17/+10
| | | | | | | | Remove it from callers and callees. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com>
* migration: Remove MigrationState from migration_in_postcopyJuan Quintela2017-04-211-12/+10
| | | | | | | | | We need to call for the migrate_get_current() in more that half of the uses, so call that inside. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com>
* ram: Remove compression_switch and inline its logicJuan Quintela2017-04-211-4/+8
| | | | | | | | | | | | | | We can calculate its value, so we don't create a variable for it. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> -- After Peter and Dave review, I dropped the variable and just inlined the condition. Fix typo
* ram: Move QEMUFile into RAMStateJuan Quintela2017-04-211-47/+37
| | | | | | | | We receive the file from save_live operations and we don't use it until 3 or 4 levels of calls down. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
* ram: Add QEMUFile to RAMStateJuan Quintela2017-04-211-7/+10
| | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
* ram: Move postcopy_requests into RAMStateJuan Quintela2017-04-211-4/+9
| | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com>
* ram: Move dirty_pages_rate to RAMStateJuan Quintela2017-04-211-3/+9
| | | | | | | | | | | | | | Treat it like the rest of ram stats counters. Export its value the same way. As an added bonus, no more MigrationState used in migration_bitmap_sync(); Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com> -- Again, dave was the one reviewing it
* ram: Remove dirty_bytes_rateJuan Quintela2017-04-211-1/+0
| | | | | | | | | | | | It can be recalculated from dirty_pages_rate. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com> -- Dave was the one that reviewed it O:-)
* ram: Create ram_dirty_sync_count()Juan Quintela2017-04-211-1/+5
| | | | | | | | This is a ram field that was inside MigrationState. Move it to RAMState and make it the same that the other ram stats. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com>
* ram: Move src_page_req* to RAMStateJuan Quintela2017-04-211-23/+38
| | | | | | | | | This are the last postcopy fields still at MigrationState. Once there Move MigrationSrcPageRequest to ram.c and remove MigrationState parameters where appropiate. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com>
* ram: Move last_req_rb to RAMStateJuan Quintela2017-04-211-2/+5
| | | | | | | | | It was on MigrationState when it is only used inside ram.c for postcopy. Problem is that we need to access it without being able to pass it RAMState directly. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com>
* ram: Remove ram_save_remainingJuan Quintela2017-04-211-11/+6
| | | | | | | | | Just unfold it. Move ram_bytes_remaining() with the rest of exported functions. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com>
* ram: Use the RAMState bytes_transferred parameterJuan Quintela2017-04-211-48/+27
| | | | | | | | Somewhere it was passed by reference, just use it from RAMState. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com>
* ram: Move bytes_transferred into RAMStateJuan Quintela2017-04-211-18/+17
| | | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com>
* ram: Move migration_bitmap_rcu into RAMStateJuan Quintela2017-04-211-39/+47
| | | | | | | | Once there, rename the type to be shorter. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com>
* ram: Move migration_bitmap_mutex into RAMStateJuan Quintela2017-04-211-7/+8
| | | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com>
* ram: Everything was init to zero, so use memsetJuan Quintela2017-04-211-22/+3
| | | | | | | | And then init only things that are not zero by default. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com>
* ram: Move migration_dirty_pages to RAMStateJuan Quintela2017-04-211-14/+18
| | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com>
* ram: Move xbzrle_overflows into RAMStateJuan Quintela2017-04-211-16/+5
| | | | | | | | Once there, remove the now unused AccountingInfo struct and var. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com>
* ram: Move xbzrle_cache_miss_rate into RAMStateJuan Quintela2017-04-211-3/+5
| | | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com>
* ram: Move xbzrle_cache_miss into RAMStateJuan Quintela2017-04-211-5/+7
| | | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com>
* ram: Move xbzrle_pages into RAMStateJuan Quintela2017-04-211-4/+7
| | | | | | | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com> -- Comment why we need bytes and pages
* ram: Move xbzrle_bytes into RAMStateJuan Quintela2017-04-211-3/+5
| | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
* ram: Move iterations into RAMStateJuan Quintela2017-04-211-5/+7
| | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com>
* ram: Remove norm_mig_bytes_transferredJuan Quintela2017-04-211-5/+0
| | | | | | | Its value can be calculated by other exported. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
* ram: Move norm_pages to RAMStateJuan Quintela2017-04-211-12/+14
| | | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com>
* ram: Remove unused pages_skipped variableJuan Quintela2017-04-211-11/+0
| | | | | | | | | For compatibility, we need to still send a value, but just specify it and comment the fact. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com>
* ram: Remove unused dup_mig_bytes_transferred()Juan Quintela2017-04-211-5/+0
| | | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com>
* ram: Move dup_pages into RAMStateJuan Quintela2017-04-211-11/+18
| | | | | | | | Once there rename it to its actual meaning, zero_pages. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com>
* ram: Move iterations_prev into RAMStateJuan Quintela2017-04-211-7/+6
| | | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
* ram: Move xbzrle_cache_miss_prev into RAMStateJuan Quintela2017-04-211-4/+5
| | | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
* ram: Change num_dirty_pages_period type to uint64_tJuan Quintela2017-04-211-1/+1
| | | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com>
* ram: Move num_dirty_pages_period into RAMStateJuan Quintela2017-04-211-9/+11
| | | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com>
* ram: Change byte_xfer_{prev,now} type to uint64_tJuan Quintela2017-04-211-2/+2
| | | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com>
* ram: Move bytes_xfer_prev into RAMStateJuan Quintela2017-04-211-6/+7
| | | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com>
* ram: Move start time into RAMStateJuan Quintela2017-04-211-9/+11
| | | | | | | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com> -- Renamed start_time to time_last_bitmap_sync(peterx suggestion)
* ram: Move bitmap_sync_count into RAMStateJuan Quintela2017-04-211-11/+12
| | | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com>
* ram: Add dirty_rate_high_cnt to RAMStateJuan Quintela2017-04-211-10/+11
| | | | | | | | We need to add a parameter to several functions to make this work. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com>
* ram: Create RAMStateJuan Quintela2017-04-211-57/+83
| | | | | | | | | | | | | | | | | We create a struct where to put all the ram state Start with the following fields: last_seen_block, last_sent_block, last_offset, last_version and ram_bulk_stage are globals that are really related together. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com> -- Fix typo and warnings
* ram: Rename block_name to rbnameJuan Quintela2017-04-211-9/+8
| | | | | | | So all places are consistent on the naming of a block name parameter. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
* ram: Rename flush_page_queue() to migration_page_queue_free()Juan Quintela2017-04-211-2/+3
| | | | | | | | It reflects better what it does. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com>
* ram: Update all functions commentsJuan Quintela2017-04-211-121/+227
| | | | | | | | | | | | | Added doc comments for existing functions comment and rewrite them in a common style. Signed-off-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Peter Xu <peterx@redhat.com> -- Fix Peter Xu comments Improve postcopy comments as per reviews.
* Change the method to calculate dirty-pages-rateChao Fan2017-03-161-7/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | In function cpu_physical_memory_sync_dirty_bitmap, file include/exec/ram_addr.h: if (src[idx][offset]) { unsigned long bits = atomic_xchg(&src[idx][offset], 0); unsigned long new_dirty; new_dirty = ~dest[k]; dest[k] |= bits; new_dirty &= bits; num_dirty += ctpopl(new_dirty); } After these codes executed, only the pages not dirtied in bitmap(dest), but dirtied in dirty_memory[DIRTY_MEMORY_MIGRATION] will be calculated. For example: When ram_list.dirty_memory[DIRTY_MEMORY_MIGRATION] = 0b00001111, and atomic_rcu_read(&migration_bitmap_rcu)->bmap = 0b00000011, the new_dirty will be 0b00001100, and this function will return 2 but not 4 which is expected. the dirty pages in dirty_memory[DIRTY_MEMORY_MIGRATION] are all new, so these should be calculated also. Signed-off-by: Chao Fan <fanc.fnst@cn.fujitsu.com> Signed-off-by: Li Zhijian <lizhijian@cn.fujitsu.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Juan Quintela <quintela@redhat.com>
* postcopy: Send whole huge pagesDr. David Alan Gilbert2017-02-281-1/+5
| | | | | | | | | | | | The RAM save code uses ram_save_host_page to send whole host pages at a time; change this to use the host page size associated with the RAM Block which may be a huge page. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Laurent Vivier <lvivier@redhat.com> Message-Id: <20170224182844.32452-12-dgilbert@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
* postcopy: Load huge pages in one goDr. David Alan Gilbert2017-02-281-5/+8
| | | | | | | | | | | | | The existing postcopy RAM load loop already ensures that it glues together whole host-pages from the target page size chunks sent over the wire. Modify the definition of host page that it uses to be the RAM block page size and thus be huge pages where appropriate. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Laurent Vivier <lvivier@redhat.com> Message-Id: <20170224182844.32452-10-dgilbert@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
* postcopy: Plumb pagesize down into place helpersDr. David Alan Gilbert2017-02-281-7/+8
| | | | | | | | | | | | Now we deal with normal size pages and huge pages we need to tell the place handlers the size we're dealing with and make sure the temporary page is large enough. Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Reviewed-by: Juan Quintela <quintela@redhat.com> Reviewed-by: Laurent Vivier <lvivier@redhat.com> Message-Id: <20170224182844.32452-8-dgilbert@redhat.com> Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>