From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sasha Levin Subject: Re: [PATCH 5/5] ioeventfd: Introduce KVM_IOEVENTFD_FLAG_SOCKET Date: Sun, 10 Jul 2011 08:34:43 +0300 Message-ID: <1310276083.2393.6.camel@sasha> References: <1309927078-5983-1-git-send-email-levinsasha928@gmail.com> <1309927078-5983-5-git-send-email-levinsasha928@gmail.com> <20110706114203.GA18368@redhat.com> <1309964506.15123.13.camel@sasha> <20110706155135.GA21638@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org, Avi Kivity , Ingo Molnar , Marcelo Tosatti , Pekka Enberg To: "Michael S. Tsirkin" Return-path: Received: from mail-wy0-f174.google.com ([74.125.82.174]:34644 "EHLO mail-wy0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753940Ab1GJFet (ORCPT ); Sun, 10 Jul 2011 01:34:49 -0400 Received: by wyg8 with SMTP id 8so1998319wyg.19 for ; Sat, 09 Jul 2011 22:34:48 -0700 (PDT) In-Reply-To: <20110706155135.GA21638@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, 2011-07-06 at 20:58 +0300, Michael S. Tsirkin wrote: > On Wed, Jul 06, 2011 at 06:01:46PM +0300, Sasha Levin wrote: > > On Wed, 2011-07-06 at 14:42 +0300, Michael S. Tsirkin wrote: > > > On Wed, Jul 06, 2011 at 07:37:58AM +0300, Sasha Levin wrote: > > > > + if (p->sock) { > > > > + socket_write(p->sock, &data, sizeof(data)); > > > > + socket_read(p->sock, &data, sizeof(data)); > > > > + set_val(val, len, data.data); > > > > > > Same here. > > > > The socket_read() here I should leave blocking, and spin on it until I > > read something - right? > > I think it's best to exit to userspace. Since sock_recvmsg for AF_UNIX SEQPACKET is interruptible, if we fail the read here we'll take a regular MMIO exit and will allow the usermode to deal with the MMIO in a regular way. I've discussed the issue of usermode might having to handle the same MMIO read request twice with Michael, and the solution proposed was to add a new type of exit to handle this special case. After working on that solution a bit I saw it's adding a lot of code and complexity for this small issue, and I'm now thinking we may be better off with just handling reads twice in case of a signal just between socket_write() and socket_read() - once through the socket and once through a regular MMIO exit. -- Sasha.