All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL for-2.9 0/3] bugfixes: xhci, input-linux and vnc
@ 2017-04-03 10:28 Gerd Hoffmann
  2017-04-03 10:28 ` [Qemu-devel] [PULL 1/3] xhci: flush dequeue pointer to endpoint context Gerd Hoffmann
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Gerd Hoffmann @ 2017-04-03 10:28 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

  Hi,

Bugfix collection for the next 2.9-rc.

please pull,
  Gerd

The following changes since commit 95b31d709ba343ad237c3630047ee7438bac4065:

  Merge remote-tracking branch 'remotes/awilliam/tags/vfio-updates-20170331.0' into staging (2017-03-31 18:06:13 +0100)

are available in the git repository at:

  git://git.kraxel.org/qemu tags/pull-fixes-20170403-1

for you to fetch changes up to fa03cb7fd212bc07f0253db9ea436383ddc6c08f:

  vnc: allow to connect with add_client when -vnc none (2017-04-03 11:48:55 +0200)

----------------------------------------------------------------
bugfixes: xhci, input-linux and vnc

----------------------------------------------------------------
Gerd Hoffmann (1):
      xhci: flush dequeue pointer to endpoint context

Javier Celaya (1):
      Fix input-linux reading from device

Marc-André Lureau (1):
      vnc: allow to connect with add_client when -vnc none

 hw/usb/hcd-xhci.c |  4 +++-
 ui/input-linux.c  | 17 ++++++++++++-----
 ui/vnc.c          |  8 ++++----
 3 files changed, 19 insertions(+), 10 deletions(-)

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Qemu-devel] [PULL 1/3] xhci: flush dequeue pointer to endpoint context
  2017-04-03 10:28 [Qemu-devel] [PULL for-2.9 0/3] bugfixes: xhci, input-linux and vnc Gerd Hoffmann
@ 2017-04-03 10:28 ` Gerd Hoffmann
  2017-04-03 10:28 ` [Qemu-devel] [PULL 2/3] Fix input-linux reading from device Gerd Hoffmann
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Gerd Hoffmann @ 2017-04-03 10:28 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann

When done processing a endpoint ring we must update the dequeue pointer
in the endpoint context in guest memory.  This is needed to make sure
the guest has a correct view of things and also to make live migration
work properly, because xhci post_load restores alot of the state from
xhci data structures in guest memory.

Add xhci_set_ep_state() call to do that.

The recursive calls stopped by commit
ddb603ab6c981c1d67cb42266fc700c33e5b2d8f had the (unintentional) side
effect to hiding this bug.  xhci_set_ep_state() was called before
processing, to set the state to running, which updated the dequeue
pointer too.

Reported-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
Message-id: 20170331102521.29253-1-kraxel@redhat.com
---
 hw/usb/hcd-xhci.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
index f0af852..a2d3143 100644
--- a/hw/usb/hcd-xhci.c
+++ b/hw/usb/hcd-xhci.c
@@ -2063,7 +2063,7 @@ static void xhci_kick_ep(XHCIState *xhci, unsigned int slotid,
 static void xhci_kick_epctx(XHCIEPContext *epctx, unsigned int streamid)
 {
     XHCIState *xhci = epctx->xhci;
-    XHCIStreamContext *stctx;
+    XHCIStreamContext *stctx = NULL;
     XHCITransfer *xfer;
     XHCIRing *ring;
     USBEndpoint *ep = NULL;
@@ -2186,6 +2186,8 @@ static void xhci_kick_epctx(XHCIEPContext *epctx, unsigned int streamid)
             break;
         }
     }
+    /* update ring dequeue ptr */
+    xhci_set_ep_state(xhci, epctx, stctx, epctx->state);
     epctx->kick_active--;
 
     ep = xhci_epid_to_usbep(epctx);
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Qemu-devel] [PULL 2/3] Fix input-linux reading from device
  2017-04-03 10:28 [Qemu-devel] [PULL for-2.9 0/3] bugfixes: xhci, input-linux and vnc Gerd Hoffmann
  2017-04-03 10:28 ` [Qemu-devel] [PULL 1/3] xhci: flush dequeue pointer to endpoint context Gerd Hoffmann
@ 2017-04-03 10:28 ` Gerd Hoffmann
  2017-04-03 10:28 ` [Qemu-devel] [PULL 3/3] vnc: allow to connect with add_client when -vnc none Gerd Hoffmann
  2017-04-03 11:56 ` [Qemu-devel] [PULL for-2.9 0/3] bugfixes: xhci, input-linux and vnc Peter Maydell
  3 siblings, 0 replies; 5+ messages in thread
From: Gerd Hoffmann @ 2017-04-03 10:28 UTC (permalink / raw)
  To: qemu-devel; +Cc: Javier Celaya, Gerd Hoffmann

From: Javier Celaya <jcelaya@gmail.com>

The evdev devices in input-linux.c are read in blocks of one whole
event. If there are not enough bytes available, they are discarded,
instead of being kept for the next read operation. This results in
lost events, of even non-working devices.

This patch keeps track of the number of bytes to be read to fill up
a whole event, and then handle it.

Changes from v1 to v2:
- Fix: Calculate offset on each iteration

Changes from v2 to v3:
- Fix coding style
- Store offset instead of bytes to be read

Signed-off-by: Javier Celaya <jcelaya@gmail.com>
Message-id: 20170327182624.2914-1-jcelaya@gmail.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/input-linux.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/ui/input-linux.c b/ui/input-linux.c
index ac31f47..dc0613c 100644
--- a/ui/input-linux.c
+++ b/ui/input-linux.c
@@ -169,6 +169,8 @@ struct InputLinux {
     bool        has_abs_x;
     int         num_keys;
     int         num_btns;
+    struct input_event event;
+    int         read_offset;
 
     QTAILQ_ENTRY(InputLinux) next;
 };
@@ -327,25 +329,30 @@ static void input_linux_handle_mouse(InputLinux *il, struct input_event *event)
 static void input_linux_event(void *opaque)
 {
     InputLinux *il = opaque;
-    struct input_event event;
     int rc;
+    int read_size;
+    uint8_t *p = (uint8_t *)&il->event;
 
     for (;;) {
-        rc = read(il->fd, &event, sizeof(event));
-        if (rc != sizeof(event)) {
+        read_size = sizeof(il->event) - il->read_offset;
+        rc = read(il->fd, &p[il->read_offset], read_size);
+        if (rc != read_size) {
             if (rc < 0 && errno != EAGAIN) {
                 fprintf(stderr, "%s: read: %s\n", __func__, strerror(errno));
                 qemu_set_fd_handler(il->fd, NULL, NULL, NULL);
                 close(il->fd);
+            } else if (rc > 0) {
+                il->read_offset += rc;
             }
             break;
         }
+        il->read_offset = 0;
 
         if (il->num_keys) {
-            input_linux_handle_keyboard(il, &event);
+            input_linux_handle_keyboard(il, &il->event);
         }
         if (il->has_rel_x && il->num_btns) {
-            input_linux_handle_mouse(il, &event);
+            input_linux_handle_mouse(il, &il->event);
         }
     }
 }
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [Qemu-devel] [PULL 3/3] vnc: allow to connect with add_client when -vnc none
  2017-04-03 10:28 [Qemu-devel] [PULL for-2.9 0/3] bugfixes: xhci, input-linux and vnc Gerd Hoffmann
  2017-04-03 10:28 ` [Qemu-devel] [PULL 1/3] xhci: flush dequeue pointer to endpoint context Gerd Hoffmann
  2017-04-03 10:28 ` [Qemu-devel] [PULL 2/3] Fix input-linux reading from device Gerd Hoffmann
@ 2017-04-03 10:28 ` Gerd Hoffmann
  2017-04-03 11:56 ` [Qemu-devel] [PULL for-2.9 0/3] bugfixes: xhci, input-linux and vnc Peter Maydell
  3 siblings, 0 replies; 5+ messages in thread
From: Gerd Hoffmann @ 2017-04-03 10:28 UTC (permalink / raw)
  To: qemu-devel; +Cc: Marc-André Lureau, Gerd Hoffmann

From: Marc-André Lureau <marcandre.lureau@redhat.com>

Do not skip VNC initialization, in particular of auth method when vnc is
configured without sockets, since we should still allow connections
through QMP add_client.

Fixes:
https://bugzilla.redhat.com/show_bug.cgi?id=1434551

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-id: 20170328160646.21250-1-marcandre.lureau@redhat.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 ui/vnc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/ui/vnc.c b/ui/vnc.c
index 821acdd..243e99b 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -3786,10 +3786,6 @@ void vnc_display_open(const char *id, Error **errp)
         goto fail;
     }
 
-    if (saddr == NULL) {
-        return;
-    }
-
     password = qemu_opt_get_bool(opts, "password", false);
     if (password) {
         if (fips_get_state()) {
@@ -3974,6 +3970,10 @@ void vnc_display_open(const char *id, Error **errp)
         register_displaychangelistener(&vd->dcl);
     }
 
+    if (saddr == NULL) {
+        goto cleanup;
+    }
+
     if (reverse) {
         if (vnc_display_connect(vd, saddr, nsaddr, wsaddr, nwsaddr, errp) < 0) {
             goto fail;
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [Qemu-devel] [PULL for-2.9 0/3] bugfixes: xhci, input-linux and vnc
  2017-04-03 10:28 [Qemu-devel] [PULL for-2.9 0/3] bugfixes: xhci, input-linux and vnc Gerd Hoffmann
                   ` (2 preceding siblings ...)
  2017-04-03 10:28 ` [Qemu-devel] [PULL 3/3] vnc: allow to connect with add_client when -vnc none Gerd Hoffmann
@ 2017-04-03 11:56 ` Peter Maydell
  3 siblings, 0 replies; 5+ messages in thread
From: Peter Maydell @ 2017-04-03 11:56 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: QEMU Developers

On 3 April 2017 at 11:28, Gerd Hoffmann <kraxel@redhat.com> wrote:
>   Hi,
>
> Bugfix collection for the next 2.9-rc.
>
> please pull,
>   Gerd
>
> The following changes since commit 95b31d709ba343ad237c3630047ee7438bac4065:
>
>   Merge remote-tracking branch 'remotes/awilliam/tags/vfio-updates-20170331.0' into staging (2017-03-31 18:06:13 +0100)
>
> are available in the git repository at:
>
>   git://git.kraxel.org/qemu tags/pull-fixes-20170403-1
>
> for you to fetch changes up to fa03cb7fd212bc07f0253db9ea436383ddc6c08f:
>
>   vnc: allow to connect with add_client when -vnc none (2017-04-03 11:48:55 +0200)
>
> ----------------------------------------------------------------
> bugfixes: xhci, input-linux and vnc
>
> ----------------------------------------------------------------
> Gerd Hoffmann (1):
>       xhci: flush dequeue pointer to endpoint context
>
> Javier Celaya (1):
>       Fix input-linux reading from device
>
> Marc-André Lureau (1):
>       vnc: allow to connect with add_client when -vnc none

Applied, thanks.

-- PMM

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-04-03 11:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-03 10:28 [Qemu-devel] [PULL for-2.9 0/3] bugfixes: xhci, input-linux and vnc Gerd Hoffmann
2017-04-03 10:28 ` [Qemu-devel] [PULL 1/3] xhci: flush dequeue pointer to endpoint context Gerd Hoffmann
2017-04-03 10:28 ` [Qemu-devel] [PULL 2/3] Fix input-linux reading from device Gerd Hoffmann
2017-04-03 10:28 ` [Qemu-devel] [PULL 3/3] vnc: allow to connect with add_client when -vnc none Gerd Hoffmann
2017-04-03 11:56 ` [Qemu-devel] [PULL for-2.9 0/3] bugfixes: xhci, input-linux and vnc Peter Maydell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.