From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Michael S. Tsirkin" Subject: Re: [PATCH 5/5] ioeventfd: Introduce KVM_IOEVENTFD_FLAG_SOCKET Date: Sun, 10 Jul 2011 11:05:59 +0300 Message-ID: <20110710080559.GC1630@redhat.com> 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> <1310276083.2393.6.camel@sasha> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org, Avi Kivity , Ingo Molnar , Marcelo Tosatti , Pekka Enberg To: Sasha Levin Return-path: Received: from mx1.redhat.com ([209.132.183.28]:21821 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755419Ab1GJIF5 (ORCPT ); Sun, 10 Jul 2011 04:05:57 -0400 Content-Disposition: inline In-Reply-To: <1310276083.2393.6.camel@sasha> Sender: kvm-owner@vger.kernel.org List-ID: On Sun, Jul 10, 2011 at 08:34:43AM +0300, Sasha Levin wrote: > 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. The problem with this approach would be reads with a side-effect though: for example, the IRQ status read in virtio clears the status register. I don't insist on a new type of exit, just pointing out the problem. > -- > > Sasha.