From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 2/4] KVM: Extended shared_msr_global to per CPU Date: Thu, 17 Dec 2009 17:06:11 +0200 Message-ID: <4B2A48E3.2060404@redhat.com> References: <4B28A6A2.3090802@redhat.com> <1261042355-32381-1-git-send-email-sheng@linux.intel.com> <4B2A08A8.7080603@redhat.com> <200912172301.33033.sheng@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Marcelo Tosatti , kvm@vger.kernel.org To: Sheng Yang Return-path: Received: from mx1.redhat.com ([209.132.183.28]:44659 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1762552AbZLQPGO (ORCPT ); Thu, 17 Dec 2009 10:06:14 -0500 In-Reply-To: <200912172301.33033.sheng@linux.intel.com> Sender: kvm-owner@vger.kernel.org List-ID: On 12/17/2009 05:01 PM, Sheng Yang wrote: > >>> -void kvm_define_shared_msr(unsigned slot, u32 msr) >>> +static void shared_msr_update(unsigned slot, u32 msr) >>> { >>> - int cpu; >>> + struct kvm_shared_msrs *smsr; >>> u64 value; >>> >>> + smsr =&__get_cpu_var(shared_msrs); >>> + /* only read, and nobody should modify it at this time, >>> + * so don't need lock */ >>> + if (slot>= shared_msrs_global.nr) { >>> + printk(KERN_ERR "kvm: invalid MSR slot!"); >>> + return; >>> + } >>> + if (smsr->values[slot].initialized) >>> + return; >>> >> I don't think .initialized is worthwhile. shared_msr_update is run very >> rarely. >> > The reason is, after cpu hotplug, the MSR_TSC_AUX would be rewritten by > vsyscall_init again. But in the hotplug notifier chain, KVM has higher > priority(20 vs 0 for vsyscall_init), so maybe the rdmsr() here would get a > bogus value... Then I think prevent it from initializing again should be > safer. > > So let's raise vsyscall_init's priority? > But I just think of another issue: if we hot plug in a cpu(without hot plug > off), it would have a bogus value as well in the same path? Sound > troublesome... > Removing .initialized would take care of this issue. -- error compiling committee.c: too many arguments to function