From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: Re: [PATCH v2] KVM: Factor out kvm_vcpu_kick to arch-generic code Date: Mon, 6 Feb 2012 18:22:28 -0200 Message-ID: <20120206202228.GA23796@amt.cnet> References: <20120125042739.16236.95639.stgit@localhost> <20120206182504.GC19821@amt.cnet> <4F3032AC.10809@web.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Christoffer Dall , kvm@vger.kernel.org, Marc.Zyngier@arm.com, agraf@suse.de, kvm-ppc@vger.kernel.org, avi@redhat.com, tech@virtualopensystems.com To: Jan Kiszka Return-path: Received: from mx1.redhat.com ([209.132.183.28]:61401 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753620Ab2BFUYn (ORCPT ); Mon, 6 Feb 2012 15:24:43 -0500 Content-Disposition: inline In-Reply-To: <4F3032AC.10809@web.de> Sender: kvm-owner@vger.kernel.org List-ID: On Mon, Feb 06, 2012 at 09:06:04PM +0100, Jan Kiszka wrote: > On 2012-02-06 19:25, Marcelo Tosatti wrote: > >> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > >> index c38efd7..a1761ff 100644 > >> --- a/arch/x86/kvm/x86.c > >> +++ b/arch/x86/kvm/x86.c > >> @@ -2252,7 +2252,6 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) > >> kvm_make_request(KVM_REQ_CLOCK_UPDATE, vcpu); > >> if (vcpu->cpu != cpu) > >> kvm_migrate_timers(vcpu); > >> - vcpu->cpu = cpu; > >> } > > > > This is wrong, kvm_sched_in fails to see vcpu->cpu properly. Please > > keep vcpu->cpu assignment in arch code. > > True, but then kvm_sched_in is a better place for this assignment (as > it's central), no? > > Jan Not necessarily. Arch code might want to have: kvm_arch_vcpu_load() { cpu = smp_processor_id(); if (vcpu->cpu != cpu) { localize vcpu to cpu vcpu->cpu = cpu } call functions which use vcpu->cpu }