All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: asmetanin@virtuozzo.com, qemu-devel@nongnu.org
Cc: "Denis V. Lunev" <den@openvz.org>,
	"Richard Henderson" <rth@twiddle.net>,
	"Eduardo Habkost" <ehabkost@redhat.com>,
	"Andreas Färber" <afaerber@suse.de>,
	"Marcelo Tosatti" <mtosatti@redhat.com>,
	"Roman Kagan" <rkagan@virtuozzo.com>,
	kvm@vger.kernel.org
Subject: Re: [PATCH v2 2/5] target-i386/kvm: Hyper-V SynIC MSR's support
Date: Wed, 11 Nov 2015 10:17:18 +0100	[thread overview]
Message-ID: <5643079E.8010908@redhat.com> (raw)
In-Reply-To: <564305B4.9060907@virtuozzo.com>



On 11/11/2015 10:09, Andrey Smetanin wrote:
>>
>> I would prefer to put this in kvm_arch_init_vcpu, if possible.
>>
> Ok. I think the kvm_arch_init_vcpu() is called after migration restores
> cpu->env->msr_hv_synic_* values, so unconditional initialization of
> cpu->env->msr_hv_synic_* values can overwrite migrated values. The check
> "if (!env->msr_hv_synic_version) {" is neccessary for first time
> initialization to protect against such overwriting. This is why this
> code migrates 'msr_hv_synic_version' value.

No, kvm_arch_init_vcpu is called at the very beginning, when the VCPU
thread is created.

main
-> machine_class->init
-> pc_init1
-> pc_cpus_init
-> pc_new_cpu
-> cpu_x86_create
-> object_property_set_bool
-> x86_cpu_realizefn
-> qemu_init_vcpu
-> qemu_kvm_start_vcpu
-> qemu_kvm_cpu_thread_fn (in new thread)
-> kvm_init_vcpu
-> kvm_arch_init_vcpu

This is long before qemu_start_incoming_migration, which is among the
last things done before calling main_loop

Paolo

WARNING: multiple messages have this Message-ID (diff)
From: Paolo Bonzini <pbonzini@redhat.com>
To: asmetanin@virtuozzo.com, qemu-devel@nongnu.org
Cc: "Eduardo Habkost" <ehabkost@redhat.com>,
	kvm@vger.kernel.org, "Marcelo Tosatti" <mtosatti@redhat.com>,
	"Roman Kagan" <rkagan@virtuozzo.com>,
	"Denis V. Lunev" <den@openvz.org>,
	"Andreas Färber" <afaerber@suse.de>,
	"Richard Henderson" <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH v2 2/5] target-i386/kvm: Hyper-V SynIC MSR's support
Date: Wed, 11 Nov 2015 10:17:18 +0100	[thread overview]
Message-ID: <5643079E.8010908@redhat.com> (raw)
In-Reply-To: <564305B4.9060907@virtuozzo.com>



On 11/11/2015 10:09, Andrey Smetanin wrote:
>>
>> I would prefer to put this in kvm_arch_init_vcpu, if possible.
>>
> Ok. I think the kvm_arch_init_vcpu() is called after migration restores
> cpu->env->msr_hv_synic_* values, so unconditional initialization of
> cpu->env->msr_hv_synic_* values can overwrite migrated values. The check
> "if (!env->msr_hv_synic_version) {" is neccessary for first time
> initialization to protect against such overwriting. This is why this
> code migrates 'msr_hv_synic_version' value.

No, kvm_arch_init_vcpu is called at the very beginning, when the VCPU
thread is created.

main
-> machine_class->init
-> pc_init1
-> pc_cpus_init
-> pc_new_cpu
-> cpu_x86_create
-> object_property_set_bool
-> x86_cpu_realizefn
-> qemu_init_vcpu
-> qemu_kvm_start_vcpu
-> qemu_kvm_cpu_thread_fn (in new thread)
-> kvm_init_vcpu
-> kvm_arch_init_vcpu

This is long before qemu_start_incoming_migration, which is among the
last things done before calling main_loop

Paolo

  reply	other threads:[~2015-11-11  9:17 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-10 12:52 [PATCH v2 0/5] QEMU: Hyper-V SynIC support Andrey Smetanin
2015-11-10 12:52 ` [Qemu-devel] " Andrey Smetanin
2015-11-10 12:52 ` [PATCH v2 1/5] headers: Linux kernel Hyper-V SynIC defines Andrey Smetanin
2015-11-10 12:52   ` [Qemu-devel] " Andrey Smetanin
2015-11-10 12:52 ` [PATCH v2 2/5] target-i386/kvm: Hyper-V SynIC MSR's support Andrey Smetanin
2015-11-10 12:52   ` [Qemu-devel] " Andrey Smetanin
2015-11-10 13:14   ` Paolo Bonzini
2015-11-10 13:14     ` [Qemu-devel] " Paolo Bonzini
2015-11-11  9:09     ` Andrey Smetanin
2015-11-11  9:09       ` [Qemu-devel] " Andrey Smetanin
2015-11-11  9:17       ` Paolo Bonzini [this message]
2015-11-11  9:17         ` Paolo Bonzini
2015-11-11  9:25         ` Andrey Smetanin
2015-11-11  9:25           ` [Qemu-devel] " Andrey Smetanin
2015-11-11 10:05           ` Paolo Bonzini
2015-11-11 10:05             ` [Qemu-devel] " Paolo Bonzini
2015-11-11 10:18     ` [PATCH v3 " Andrey Smetanin
2015-11-11 10:18       ` [Qemu-devel] " Andrey Smetanin
2015-11-11 11:17       ` Paolo Bonzini
2015-11-11 11:17         ` [Qemu-devel] " Paolo Bonzini
2015-11-10 12:52 ` [PATCH v2 3/5] kvm: Hyper-V SynIC irq routing support Andrey Smetanin
2015-11-10 12:52   ` [Qemu-devel] " Andrey Smetanin
2015-11-10 12:52 ` [PATCH v2 4/5] target-i386/hyperv: Hyper-V SynIC SINT routing and vcpu exit Andrey Smetanin
2015-11-10 12:52   ` [Qemu-devel] " Andrey Smetanin
2015-11-10 12:52 ` [PATCH v2 5/5] hw/misc: Hyper-V test device 'hyperv-testdev' Andrey Smetanin
2015-11-10 12:52   ` [Qemu-devel] " Andrey Smetanin

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=5643079E.8010908@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=afaerber@suse.de \
    --cc=asmetanin@virtuozzo.com \
    --cc=den@openvz.org \
    --cc=ehabkost@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=mtosatti@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rkagan@virtuozzo.com \
    --cc=rth@twiddle.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.