From mboxrd@z Thu Jan 1 00:00:00 1970 From: Pekka Enberg Subject: Re: [PATCH 5/5] ioeventfd: Introduce KVM_IOEVENTFD_FLAG_SOCKET Date: Wed, 13 Jul 2011 14:14:26 +0300 Message-ID: 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> <1310552810.14379.1.camel@lappy> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Cc: "Michael S. Tsirkin" , kvm@vger.kernel.org, Avi Kivity , Ingo Molnar , Marcelo Tosatti To: Sasha Levin Return-path: Received: from mail-vx0-f174.google.com ([209.85.220.174]:39776 "EHLO mail-vx0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964915Ab1GMLO1 (ORCPT ); Wed, 13 Jul 2011 07:14:27 -0400 Received: by vxb39 with SMTP id 39so4082931vxb.19 for ; Wed, 13 Jul 2011 04:14:26 -0700 (PDT) In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: On Wed, Jul 13, 2011 at 1:56 PM, Pekka Enberg wrote: > On Wed, Jul 13, 2011 at 1:26 PM, Sasha Levin wrote: >> The problem is that if we received a signal during the read notification >> the write and before receiving the read, we have to go back to >> userspace. >> >> This means that userspace will see same read request twice (once in the >> socket and once in the MMIO exit). > > So the problem is only in ioeventfd_read() if socket_write() succeeds > but socket_read() fails? If so, can we do the socket_read() somewhere > else in the code which is able to restart it? > > AFAICT, both ioeventfd_read() and ioeventfd_write() should -ENOSUPP if > socket_write() fails. If socket_write() succeeds, we should return > -EINTR and teach vcpu_mmio_read() and kernel_pio() to KVM_EXIT_INTR in > those cases. We'll can just restart the read, no? The only > complication I can see is that ioeventfd_read() needs to keep track if > it did the socket_write() already or not. Maybe struct _ioeventfd could hold a flag that tells ioevenfd_read() that the write part was already successful?