From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54147) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZzNdt-0003uu-Hb for qemu-devel@nongnu.org; Thu, 19 Nov 2015 06:44:46 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZzNdp-0004sr-H5 for qemu-devel@nongnu.org; Thu, 19 Nov 2015 06:44:45 -0500 Received: from mailout4.w1.samsung.com ([210.118.77.14]:44284) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZzNdp-0004rx-Ar for qemu-devel@nongnu.org; Thu, 19 Nov 2015 06:44:41 -0500 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NY2007AP8ME5QB0@mailout4.w1.samsung.com> for qemu-devel@nongnu.org; Thu, 19 Nov 2015 11:44:38 +0000 (GMT) From: Pavel Fedin References: <011b01d122af$c60f7ce0$522e76a0$@samsung.com> <20151119125348-mutt-send-email-mst@redhat.com> In-reply-to: <20151119125348-mutt-send-email-mst@redhat.com> Date: Thu, 19 Nov 2015 14:44:37 +0300 Message-id: <014b01d122bf$ab73dc90$025b95b0$@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit Content-language: ru Subject: Re: [Qemu-devel] [PATCH] virtio: Implement userspace forwarding for host notifiers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "'Michael S. Tsirkin'" Cc: 'Christian Borntraeger' , qemu-devel@nongnu.org Hello! > OK, that's better, thanks! Yes, indeed this was simple. > Why do we need > if (kvm_eventfds_enabled()) { > memory_region_add_eventfd(&proxy->iomem, VIRTIO_MMIO_QUEUENOTIFY, 4, > true, n, notifier); > } else if (!set_handler) { > virtio_queue_set_host_notifier_forwarding(vq); > } > everywhere though? > > Can't memory_region_add_eventfd DTRT depending on kvm etc? You know... I took a look at this, and yes, i could simply hook up emulation into memory region handlers. And everything that expects KVM eventfd binding will magically start working, probably rendering some bypass code obsolete. I have only one concern against this. qemu is a large piece of software, consisting of lots of components. I cannot test absolutely everything in every configuration. I suggest, old code was written with the assumption that if memory_region_add_eventfd() works, we are really using KVM acceleration. If we break this assumption, how much code will mysteriously misbehave instead of throwing "function not supported" error, which is quite easy to trace down and fix? What i would refactor, perhaps, is to add a return code to memory_region_add_eventfd(), so that it can signal failure instead of a critical abort, this would allow to get rid of kvm_eventfds_enabled() accompanying checks. Kind regards, Pavel Fedin Expert Engineer Samsung Electronics Research center Russia