[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v7 27/42] postcopy: ram_enable_notify to switch
From: |
Juan Quintela |
Subject: |
Re: [Qemu-devel] [PATCH v7 27/42] postcopy: ram_enable_notify to switch on userfault |
Date: |
Mon, 13 Jul 2015 14:10:13 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
"Dr. David Alan Gilbert (git)" <address@hidden> wrote:
> From: "Dr. David Alan Gilbert" <address@hidden>
>
> Mark the area of RAM as 'userfault'
> Start up a fault-thread to handle any userfaults we might receive
> from it (to be filled in later)
>
> Signed-off-by: Dr. David Alan Gilbert <address@hidden>
> Reviewed-by: David Gibson <address@hidden>
> ---
> include/migration/migration.h | 3 ++
> include/migration/postcopy-ram.h | 6 ++++
> migration/postcopy-ram.c | 69
> +++++++++++++++++++++++++++++++++++++++-
> migration/savevm.c | 9 ++++++
> 4 files changed, 86 insertions(+), 1 deletion(-)
>
> diff --git a/include/migration/migration.h b/include/migration/migration.h
> index 98e2568..e6585c5 100644
> --- a/include/migration/migration.h
> +++ b/include/migration/migration.h
> @@ -69,6 +69,9 @@ struct MigrationIncomingState {
> */
> QemuEvent main_thread_load_event;
>
> + QemuThread fault_thread;
Best name ever? Well, it could be "wrong_thread" O:-)
> +static void *postcopy_ram_fault_thread(void *opaque)
> +{
> + MigrationIncomingState *mis = (MigrationIncomingState *)opaque;
Uneeded cast.
> +
> + fprintf(stderr, "postcopy_ram_fault_thread\n");
> + /* TODO: In later patch */
> + qemu_sem_post(&mis->fault_thread_sem);
> + while (1) {
> + /* TODO: In later patch */
> + }
> +
> + return NULL;
> +}
> +
> +int postcopy_ram_enable_notify(MigrationIncomingState *mis)
> +{
> + /* Create the fault handler thread and wait for it to be ready */
> + qemu_sem_init(&mis->fault_thread_sem, 0);
> + qemu_thread_create(&mis->fault_thread, "postcopy/fault",
> + postcopy_ram_fault_thread, mis, QEMU_THREAD_JOINABLE);
> + qemu_sem_wait(&mis->fault_thread_sem);
> + qemu_sem_destroy(&mis->fault_thread_sem);
> +
> + /* Mark so that we get notified of accesses to unwritten areas */
> + if (qemu_ram_foreach_block(ram_block_enable_notify, mis)) {
> + return -1;
> + }
> +
> + return 0;
> +}
> +
> #else
> /* No target OS support, stubs just fail */
> -
This belongs in a different patch O:-)
If you have to resend, just change them.
Reviewed-by: Juan Quintela <address@hidden>
- Re: [Qemu-devel] [PATCH v7 27/42] postcopy: ram_enable_notify to switch on userfault,
Juan Quintela <=