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: Tue, 12 Jul 2011 14:23:44 +0300 Message-ID: <1310469824.2393.22.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> <1310276083.2393.6.camel@sasha> <20110710080559.GC1630@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-ww0-f44.google.com ([74.125.82.44]:60849 "EHLO mail-ww0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752958Ab1GLLXu (ORCPT ); Tue, 12 Jul 2011 07:23:50 -0400 Received: by wwe5 with SMTP id 5so4832231wwe.1 for ; Tue, 12 Jul 2011 04:23:49 -0700 (PDT) In-Reply-To: <20110710080559.GC1630@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Sun, 2011-07-10 at 11:05 +0300, Michael S. Tsirkin wrote: > 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. I agree with you, I don't have a better solution either. I don't feel it's worth it adding so much code for read support to properly work. Can we do this patch series without socket read support at the moment? -- Sasha.