From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=54886 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q09ZM-0001iD-He for qemu-devel@nongnu.org; Thu, 17 Mar 2011 05:32:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q09ZK-0004Im-Cu for qemu-devel@nongnu.org; Thu, 17 Mar 2011 05:32:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40232) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q09ZJ-0004IS-JS for qemu-devel@nongnu.org; Thu, 17 Mar 2011 05:32:34 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p2H9WWtv013129 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 17 Mar 2011 05:32:32 -0400 Date: Thu, 17 Mar 2011 11:32:06 +0200 From: Alon Levy Subject: Re: [Qemu-devel] [PATCH v3 4/4] hw/qxl-render: drop cursor locks, replace with pipe Message-ID: <20110317093206.GL7413@playa.tlv.redhat.com> References: <1300290769-31155-1-git-send-email-alevy@redhat.com> <1300290769-31155-5-git-send-email-alevy@redhat.com> <4D80E9E9.7000505@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4D80E9E9.7000505@redhat.com> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jes Sorensen Cc: hdegoede@redhat.com, uril@redhat.com, qemu-devel@nongnu.org, gleb@redhat.com On Wed, Mar 16, 2011 at 05:48:41PM +0100, Jes Sorensen wrote: > On 03/16/11 16:52, Alon Levy wrote: > > +void qxl_server_request_cursor_set(PCIQXLDevice *qxl, QEMUCursor *c, int x, int y) > > +{ > > + QXLServerCursorSetRequest req; > > + int r; > > + > > + req.req = QXL_SERVER_CURSOR_SET; > > + req.data.c = c; > > + req.data.x = x; > > + req.data.y = y; > > + r = write(qxl->ssd.pipe[1], &req, sizeof(req)); > > + assert(r == sizeof(req)); > > +} > > There's a number of asserts here, which I am not sure is a good thing. I > don't understand how far down the code this is, and if it is really > fatal if this write fails? A failure there means we can't write to a pipe between the server thread and the iothread (main thread). That is not supposed to happen - and if it does it means some operation by the spice server will never complete. Same for the asserts below, writes are from spice server thread, reads are in iothread. > > > +/* called from spice server thread context only */ > > +void qxl_server_request_cursor_move(PCIQXLDevice *qxl, int x, int y) > > +{ > > + QXLServerCursorMoveRequest req; > > + int r; > > + > > + req.req = QXL_SERVER_CURSOR_MOVE; > > + req.data.x = x; > > + req.data.y = y; > > + r = write(qxl->ssd.pipe[1], &req, sizeof(req)); > > + assert(r == sizeof(req)); > > ditto > > > +static void read_bytes(int fd, void *buf, int len_requested) > > +{ > > + int len; > > + int total_len = 0; > > + > > + do { > > + len = read(fd, buf, len_requested - total_len); > > + if (len < 0) { > > + if (errno == EINTR || errno == EAGAIN) { > > + continue; > > + } > > + perror("qxl: pipe_read: read failed"); > > + /* will abort once it's out of the while loop */ > > + break; > > + } > > + total_len += len; > > + buf = (uint8_t *)buf + len; > > + } while (total_len < len_requested); > > + assert(total_len == len_requested); > > and here? > > Cheers, > Jes > > >