From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sheng Yang Subject: Re: [PATCH 3/4] KVM: Emulate MSI-X table in kernel Date: Tue, 1 Mar 2011 21:01:09 +0800 Message-ID: <20110301130109.GA23877@syang10-desktop> References: <1298877605-12782-1-git-send-email-sheng@linux.intel.com> <1298877605-12782-4-git-send-email-sheng@linux.intel.com> <20110228112728.GF28006@redhat.com> <201103011410.37997.sheng@linux.intel.com> <20110301122002.GA13990@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Avi Kivity , Marcelo Tosatti , Alex Williamson , kvm@vger.kernel.org To: "Michael S. Tsirkin" Return-path: Received: from mga02.intel.com ([134.134.136.20]:5603 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752350Ab1CAM6V (ORCPT ); Tue, 1 Mar 2011 07:58:21 -0500 Content-Disposition: inline In-Reply-To: <20110301122002.GA13990@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Tue, Mar 01, 2011 at 02:20:02PM +0200, Michael S. Tsirkin wrote: > On Tue, Mar 01, 2011 at 02:10:37PM +0800, Sheng Yang wrote: > > On Monday 28 February 2011 19:27:29 Michael S. Tsirkin wrote: > > > On Mon, Feb 28, 2011 at 03:20:04PM +0800, Sheng Yang wrote: > > > > @@ -1877,6 +1879,24 @@ static long kvm_vm_ioctl(struct file *filp, > > > > > > > > mutex_unlock(&kvm->lock); > > > > break; > > > > > > > > #endif > > > > > > > > + case KVM_REGISTER_MSIX_MMIO: { > > > > + struct kvm_msix_mmio_user mmio_user; > > > > + > > > > + r = -EFAULT; > > > > + if (copy_from_user(&mmio_user, argp, sizeof mmio_user)) > > > > + goto out; > > > > + r = kvm_vm_ioctl_register_msix_mmio(kvm, &mmio_user); > > > > + break; > > > > + } > > > > + case KVM_UNREGISTER_MSIX_MMIO: { > > > > + struct kvm_msix_mmio_user mmio_user; > > > > + > > > > + r = -EFAULT; > > > > + if (copy_from_user(&mmio_user, argp, sizeof mmio_user)) > > > > + goto out; > > > > + r = kvm_vm_ioctl_unregister_msix_mmio(kvm, &mmio_user); > > > > + break; > > > > + } > > > > > > > > default: > > > > r = kvm_arch_vm_ioctl(filp, ioctl, arg); > > > > if (r == -ENOTTY) > > > > > > > > @@ -1988,6 +2008,12 @@ static int kvm_dev_ioctl_create_vm(void) > > > > > > > > return r; > > > > > > > > } > > > > > > > > #endif > > > > > > > > + r = kvm_register_msix_mmio_dev(kvm); > > > > + if (r < 0) { > > > > + kvm_put_kvm(kvm); > > > > + return r; > > > > + } > > > > + > > > > > > Need to fix error handling below as well? > > > Better do it with chained gotos if yes. > > > > Let's make it another separate patch. > > Well you add a new failure mode, you need to cleanup > properly ... Oh, I think kvm_put_kvm() should take care of this? -- regards Yang, Sheng