From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 1/3] Implement bare minimum of HYPER-V MSRs. Date: Wed, 13 Jan 2010 16:28:43 +0200 Message-ID: <4B4DD89B.2000701@redhat.com> References: <1263391197-9883-1-git-send-email-gleb@redhat.com> <1263391197-9883-2-git-send-email-gleb@redhat.com> <4B4DD6ED.8060101@redhat.com> <20100113142646.GZ7549@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: Gleb Natapov Return-path: Received: from mx1.redhat.com ([209.132.183.28]:54136 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755305Ab0AMO2o (ORCPT ); Wed, 13 Jan 2010 09:28:44 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o0DESiOC024883 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 13 Jan 2010 09:28:44 -0500 In-Reply-To: <20100113142646.GZ7549@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 01/13/2010 04:26 PM, Gleb Natapov wrote: > On Wed, Jan 13, 2010 at 04:21:33PM +0200, Avi Kivity wrote: > >>> int kvm_set_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 data) >>> { >>> switch (msr) { >>> @@ -1117,6 +1181,16 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 data) >>> pr_unimpl(vcpu, "unimplemented perfctr wrmsr: " >>> "0x%x data 0x%llx\n", msr, data); >>> break; >>> + case HV_X64_MSR_GUEST_OS_ID ... HV_X64_MSR_SINT15: >>> + if (kvm_hv_msr_partition_wide(msr)) { >>> + int r; >>> + mutex_lock(&vcpu->kvm->lock); >>> + r = set_msr_hyperv_pw(vcpu, msr, data); >>> + mutex_unlock(&vcpu->kvm->lock); >>> >> We do have locking. Any reason not to put it in set_msr_hyperv_pw? >> Seems cleaner. >> >> > Actually the way I did it looks cleaner to me. If locking is done inside > set_msr_hyperv_pw() then each simple "return" statement there will have > to be changed into {ret=val; goto unlock;}. > > A break should suffice. -- error compiling committee.c: too many arguments to function