From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=37126 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PzuVQ-0005pH-Ah for qemu-devel@nongnu.org; Wed, 16 Mar 2011 13:27:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PzuVO-0007Rg-Lo for qemu-devel@nongnu.org; Wed, 16 Mar 2011 13:27:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:1031) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PzuVO-0007Qr-DD for qemu-devel@nongnu.org; Wed, 16 Mar 2011 13:27:30 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p2GHRFXt010271 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 16 Mar 2011 13:27:29 -0400 Message-ID: <4D80E9E9.7000505@redhat.com> Date: Wed, 16 Mar 2011 17:48:41 +0100 From: Jes Sorensen MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH v3 4/4] hw/qxl-render: drop cursor locks, replace with pipe References: <1300290769-31155-1-git-send-email-alevy@redhat.com> <1300290769-31155-5-git-send-email-alevy@redhat.com> In-Reply-To: <1300290769-31155-5-git-send-email-alevy@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alon Levy Cc: hdegoede@redhat.com, uril@redhat.com, qemu-devel@nongnu.org, gleb@redhat.com 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? > +/* 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