From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcelo Tosatti Subject: Re: [PATCHv5 1/4] Provide userspace IO exit completion callback. Date: Thu, 2 Aug 2012 16:26:29 -0300 Message-ID: <20120802192629.GA28613@amt.cnet> References: <1343659101-24877-1-git-send-email-gleb@redhat.com> <1343659101-24877-2-git-send-email-gleb@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org, avi@redhat.com To: Gleb Natapov Return-path: Received: from mx1.redhat.com ([209.132.183.28]:21644 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753640Ab2HBUho (ORCPT ); Thu, 2 Aug 2012 16:37:44 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q72KbiRi031440 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 2 Aug 2012 16:37:44 -0400 Content-Disposition: inline In-Reply-To: <1343659101-24877-2-git-send-email-gleb@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Mon, Jul 30, 2012 at 05:38:18PM +0300, Gleb Natapov wrote: > int r; > @@ -5554,9 +5568,13 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) > } > } > > - r = complete_mmio(vcpu); > - if (r <= 0) > - goto out; > + if (unlikely(vcpu->arch.complete_userspace_io)) { > + int (*cui)(struct kvm_vcpu *) = vcpu->arch.complete_userspace_io; > + vcpu->arch.complete_userspace_io = NULL; > + r = cui(vcpu); > + if (r <= 0) > + goto out; > + } Would it be worthwhile to add BUG/WARN_ONs here checking for variables that represent valid mmio/pio, but without complete_userspace_io function pointer set? (you do that in the reverse case, inside the complete_userspace_io function pointers).