From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: [PATCH 1/3] Implement bare minimum of HYPER-V MSRs. Date: Wed, 13 Jan 2010 16:31:46 +0200 Message-ID: <20100113143146.GB7549@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> <4B4DD89B.2000701@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org To: Avi Kivity Return-path: Received: from mx1.redhat.com ([209.132.183.28]:31532 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751116Ab0AMObr (ORCPT ); Wed, 13 Jan 2010 09:31:47 -0500 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o0DEVlua025591 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 13 Jan 2010 09:31:47 -0500 Content-Disposition: inline In-Reply-To: <4B4DD89B.2000701@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, Jan 13, 2010 at 04:28:43PM +0200, Avi Kivity wrote: > 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. > It will still be {ret=val; break;}. 3 lines instead of one. -- Gleb.