From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58045) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fLskB-0008NE-Is for qemu-devel@nongnu.org; Thu, 24 May 2018 12:05:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fLsk8-0006f9-5G for qemu-devel@nongnu.org; Thu, 24 May 2018 12:05:35 -0400 Received: from mga04.intel.com ([192.55.52.120]:11082) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fLsk7-0006eS-RQ for qemu-devel@nongnu.org; Thu, 24 May 2018 12:05:32 -0400 Date: Fri, 25 May 2018 00:05:50 +0800 From: Tiwei Bie Message-ID: <20180524160549.GA15321@debian> References: <20180524103336.21233-1-tiwei.bie@intel.com> <20180524103336.21233-5-tiwei.bie@intel.com> <20180524184438-mutt-send-email-mst@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180524184438-mutt-send-email-mst@kernel.org> Subject: Re: [Qemu-devel] [PATCH 4/6] vhost-user: support registering external host notifiers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: jasowang@redhat.com, qemu-devel@nongnu.org, virtio-dev@lists.oasis-open.org On Thu, May 24, 2018 at 06:49:47PM +0300, Michael S. Tsirkin wrote: > On Thu, May 24, 2018 at 06:33:34PM +0800, Tiwei Bie wrote: > > This patch introduces VHOST_USER_PROTOCOL_F_HOST_NOTIFIER. > > With this feature negotiated, vhost-user backend can register > > memory region based host notifiers. And it will allow the guest > > driver in the VM to notify the hardware accelerator at the > > vhost-user backend directly. > > > > Signed-off-by: Tiwei Bie > > So maybe we don't need a new VHOST_USER_PROTOCOL_F_SLAVE_SEND_FD? > Let's check VHOST_USER_PROTOCOL_F_HOST_NOTIFIER instead? Yeah. I think it would be the best choice! If this feature (HOST NOTIFIER) is negotiated, it means the QEMU is able to safely receive (the expected number of) file descriptors. > > > --- [...] > > +typedef struct VhostUserHostNotifier { > > + MemoryRegion mr; > > + void *addr; > > + bool set; > > +} VhostUserHostNotifier; > > > > typedef struct VhostUserState { > > CharBackend *chr; > > + VhostUserHostNotifier notifier[VIRTIO_QUEUE_MAX]; > > } VhostUserState; > > So this notifier is per-queue. Can't we maintain it in > NetVhostUserState then? This notifier is per virtio-queue. But NetVhostUserState is per net-queue-pair. And ideally, I think this structure shouldn't be visible to net/vhost-user, vhost-user-scsi, vhost-user-crypto, etc. Best regards, Tiwei Bie