Re: [PATCH v0 3/4] migration: add background snapshot

2020-07-29 Thread Peter Xu
On Wed, Jul 29, 2020 at 03:54:46PM +0300, Denis Plotnikov wrote: > > Besides current solution, do you think we can make it simpler by only > > deliver > > the fault request to the background thread? We can let the background > > thread > > to do all the rests and IIUC we can drop all the

Re: [PATCH v0 3/4] migration: add background snapshot

2020-07-29 Thread Denis Plotnikov
On 29.07.2020 16:27, Dr. David Alan Gilbert wrote: ... /** * ram_find_and_save_block: finds a dirty page and sends it to f * @@ -1782,6 +2274,7 @@ static int ram_find_and_save_block(RAMState *rs, bool last_stage) pss.block = rs->last_seen_block; pss.page =

Re: [PATCH v0 3/4] migration: add background snapshot

2020-07-29 Thread Dr. David Alan Gilbert
* Denis Plotnikov (dplotni...@virtuozzo.com) wrote: > > > On 27.07.2020 19:48, Dr. David Alan Gilbert wrote: > > * Denis Plotnikov (dplotni...@virtuozzo.com) wrote: > ... > > > +static void page_fault_thread_stop(void) > > > +{ > > > +if (page_fault_fd) { > > > +close(page_fault_fd);

Re: [PATCH v0 3/4] migration: add background snapshot

2020-07-29 Thread Denis Plotnikov
On 24.07.2020 03:08, Peter Xu wrote: On Wed, Jul 22, 2020 at 11:11:32AM +0300, Denis Plotnikov wrote: +/** + * ram_copy_page: make a page copy + * + * Used in the background snapshot to make a copy of a memeory page. + * Ensures that the memeory page is copied only once. + * When a page copy

Re: [PATCH v0 3/4] migration: add background snapshot

2020-07-29 Thread Denis Plotnikov
On 24.07.2020 01:15, Peter Xu wrote: On Wed, Jul 22, 2020 at 11:11:32AM +0300, Denis Plotnikov wrote: +static void *background_snapshot_thread(void *opaque) +{ +MigrationState *m = opaque; +QIOChannelBuffer *bioc; +QEMUFile *fb; +int res = 0; + +rcu_register_thread(); + +

Re: [PATCH v0 3/4] migration: add background snapshot

2020-07-28 Thread Denis Plotnikov
On 27.07.2020 19:48, Dr. David Alan Gilbert wrote: * Denis Plotnikov (dplotni...@virtuozzo.com) wrote: ... +static void page_fault_thread_stop(void) +{ +if (page_fault_fd) { +close(page_fault_fd); +page_fault_fd = 0; +} I think you need to do that after you've done

Re: [PATCH v0 3/4] migration: add background snapshot

2020-07-27 Thread Dr. David Alan Gilbert
* Denis Plotnikov (dplotni...@virtuozzo.com) wrote: > By the moment, making a vm snapshot may cause a significant vm downtime, > depending on the vm RAM size and the performance of disk storing > the vm snapshot. This happens because the VM has to be paused until all > vmstate including RAM is

Re: [PATCH v0 3/4] migration: add background snapshot

2020-07-23 Thread Peter Xu
On Wed, Jul 22, 2020 at 11:11:32AM +0300, Denis Plotnikov wrote: > +/** > + * ram_copy_page: make a page copy > + * > + * Used in the background snapshot to make a copy of a memeory page. > + * Ensures that the memeory page is copied only once. > + * When a page copy is done, restores read/write

Re: [PATCH v0 3/4] migration: add background snapshot

2020-07-23 Thread Peter Xu
On Wed, Jul 22, 2020 at 11:11:32AM +0300, Denis Plotnikov wrote: > +static void *background_snapshot_thread(void *opaque) > +{ > +MigrationState *m = opaque; > +QIOChannelBuffer *bioc; > +QEMUFile *fb; > +int res = 0; > + > +rcu_register_thread(); > + > +

[PATCH v0 3/4] migration: add background snapshot

2020-07-22 Thread Denis Plotnikov
By the moment, making a vm snapshot may cause a significant vm downtime, depending on the vm RAM size and the performance of disk storing the vm snapshot. This happens because the VM has to be paused until all vmstate including RAM is written. To reduce the downtime, the background snapshot