|
|
9bac43 |
From 5707c2b3cc6e0312302642914154689d8afda7a0 Mon Sep 17 00:00:00 2001
|
|
|
9bac43 |
From: "Daniel P. Berrange" <berrange@redhat.com>
|
|
|
9bac43 |
Date: Mon, 5 Feb 2018 11:09:56 +0100
|
|
|
9bac43 |
Subject: [PATCH 02/20] ui: add tracing of VNC operations related to QIOChannel
|
|
|
9bac43 |
|
|
|
9bac43 |
RH-Author: Daniel P. Berrange <berrange@redhat.com>
|
|
|
9bac43 |
Message-id: <20180205111012.6210-2-berrange@redhat.com>
|
|
|
9bac43 |
Patchwork-id: 78884
|
|
|
9bac43 |
O-Subject: [RHV-7.5 qemu-kvm-rhev PATCH v2 01/17] ui: add tracing of VNC operations related to QIOChannel
|
|
|
9bac43 |
Bugzilla: 1527404
|
|
|
9bac43 |
RH-Acked-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
9bac43 |
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
|
|
|
9bac43 |
RH-Acked-by: Thomas Huth <thuth@redhat.com>
|
|
|
9bac43 |
|
|
|
9bac43 |
From: "Daniel P. Berrange" <berrange@redhat.com>
|
|
|
9bac43 |
|
|
|
9bac43 |
Trace anything which opens/closes/wraps a QIOChannel in the
|
|
|
9bac43 |
VNC server.
|
|
|
9bac43 |
|
|
|
9bac43 |
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
|
|
|
9bac43 |
Message-id: 20170921121528.23935-2-berrange@redhat.com
|
|
|
9bac43 |
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
|
|
|
9bac43 |
(cherry picked from commit ad6374c43e572e6e53020a97e72e9ea525b08334)
|
|
|
9bac43 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9bac43 |
---
|
|
|
9bac43 |
ui/trace-events | 6 ++++++
|
|
|
9bac43 |
ui/vnc-auth-vencrypt.c | 2 ++
|
|
|
9bac43 |
ui/vnc-ws.c | 6 +++---
|
|
|
9bac43 |
ui/vnc.c | 11 ++++++++---
|
|
|
9bac43 |
4 files changed, 19 insertions(+), 6 deletions(-)
|
|
|
9bac43 |
|
|
|
9bac43 |
diff --git a/ui/trace-events b/ui/trace-events
|
|
|
9bac43 |
index 34c2213..e4c02e4 100644
|
|
|
9bac43 |
--- a/ui/trace-events
|
|
|
9bac43 |
+++ b/ui/trace-events
|
|
|
9bac43 |
@@ -29,6 +29,12 @@ vnc_key_event_ext(bool down, int sym, int keycode, const char *name) "down %d, s
|
|
|
9bac43 |
vnc_key_event_map(bool down, int sym, int keycode, const char *name) "down %d, sym 0x%x -> keycode 0x%x [%s]"
|
|
|
9bac43 |
vnc_key_sync_numlock(bool on) "%d"
|
|
|
9bac43 |
vnc_key_sync_capslock(bool on) "%d"
|
|
|
9bac43 |
+vnc_client_eof(void *state, void *ioc) "VNC client EOF state=%p ioc=%p"
|
|
|
9bac43 |
+vnc_client_io_error(void *state, void *ioc, const char *msg) "VNC client I/O error state=%p ioc=%p errmsg=%s"
|
|
|
9bac43 |
+vnc_client_connect(void *state, void *ioc) "VNC client connect state=%p ioc=%p"
|
|
|
9bac43 |
+vnc_client_disconnect_start(void *state, void *ioc) "VNC client disconnect start state=%p ioc=%p"
|
|
|
9bac43 |
+vnc_client_disconnect_finish(void *state, void *ioc) "VNC client disconnect finish state=%p ioc=%p"
|
|
|
9bac43 |
+vnc_client_io_wrap(void *state, void *ioc, const char *type) "VNC client I/O wrap state=%p ioc=%p type=%s"
|
|
|
9bac43 |
|
|
|
9bac43 |
# ui/input.c
|
|
|
9bac43 |
input_event_key_number(int conidx, int number, const char *qcode, bool down) "con %d, key number 0x%x [%s], down %d"
|
|
|
9bac43 |
diff --git a/ui/vnc-auth-vencrypt.c b/ui/vnc-auth-vencrypt.c
|
|
|
9bac43 |
index c3eece4..2a3766a 100644
|
|
|
9bac43 |
--- a/ui/vnc-auth-vencrypt.c
|
|
|
9bac43 |
+++ b/ui/vnc-auth-vencrypt.c
|
|
|
9bac43 |
@@ -28,6 +28,7 @@
|
|
|
9bac43 |
#include "vnc.h"
|
|
|
9bac43 |
#include "qapi/error.h"
|
|
|
9bac43 |
#include "qemu/main-loop.h"
|
|
|
9bac43 |
+#include "trace.h"
|
|
|
9bac43 |
|
|
|
9bac43 |
static void start_auth_vencrypt_subauth(VncState *vs)
|
|
|
9bac43 |
{
|
|
|
9bac43 |
@@ -124,6 +125,7 @@ static int protocol_client_vencrypt_auth(VncState *vs, uint8_t *data, size_t len
|
|
|
9bac43 |
VNC_DEBUG("Start TLS VeNCrypt handshake process\n");
|
|
|
9bac43 |
object_unref(OBJECT(vs->ioc));
|
|
|
9bac43 |
vs->ioc = QIO_CHANNEL(tls);
|
|
|
9bac43 |
+ trace_vnc_client_io_wrap(vs, vs->ioc, "tls");
|
|
|
9bac43 |
vs->tls = qio_channel_tls_get_session(tls);
|
|
|
9bac43 |
|
|
|
9bac43 |
qio_channel_tls_handshake(tls,
|
|
|
9bac43 |
diff --git a/ui/vnc-ws.c b/ui/vnc-ws.c
|
|
|
9bac43 |
index eaf3095..6ccad22 100644
|
|
|
9bac43 |
--- a/ui/vnc-ws.c
|
|
|
9bac43 |
+++ b/ui/vnc-ws.c
|
|
|
9bac43 |
@@ -23,6 +23,7 @@
|
|
|
9bac43 |
#include "vnc.h"
|
|
|
9bac43 |
#include "io/channel-websock.h"
|
|
|
9bac43 |
#include "qemu/bswap.h"
|
|
|
9bac43 |
+#include "trace.h"
|
|
|
9bac43 |
|
|
|
9bac43 |
static void vncws_tls_handshake_done(QIOTask *task,
|
|
|
9bac43 |
gpointer user_data)
|
|
|
9bac43 |
@@ -53,7 +54,6 @@ gboolean vncws_tls_handshake_io(QIOChannel *ioc G_GNUC_UNUSED,
|
|
|
9bac43 |
QIOChannelTLS *tls;
|
|
|
9bac43 |
Error *err = NULL;
|
|
|
9bac43 |
|
|
|
9bac43 |
- VNC_DEBUG("TLS Websocket connection required\n");
|
|
|
9bac43 |
if (vs->ioc_tag) {
|
|
|
9bac43 |
g_source_remove(vs->ioc_tag);
|
|
|
9bac43 |
vs->ioc_tag = 0;
|
|
|
9bac43 |
@@ -73,9 +73,9 @@ gboolean vncws_tls_handshake_io(QIOChannel *ioc G_GNUC_UNUSED,
|
|
|
9bac43 |
|
|
|
9bac43 |
qio_channel_set_name(QIO_CHANNEL(tls), "vnc-ws-server-tls");
|
|
|
9bac43 |
|
|
|
9bac43 |
- VNC_DEBUG("Start TLS WS handshake process\n");
|
|
|
9bac43 |
object_unref(OBJECT(vs->ioc));
|
|
|
9bac43 |
vs->ioc = QIO_CHANNEL(tls);
|
|
|
9bac43 |
+ trace_vnc_client_io_wrap(vs, vs->ioc, "tls");
|
|
|
9bac43 |
vs->tls = qio_channel_tls_get_session(tls);
|
|
|
9bac43 |
|
|
|
9bac43 |
qio_channel_tls_handshake(tls,
|
|
|
9bac43 |
@@ -116,7 +116,6 @@ gboolean vncws_handshake_io(QIOChannel *ioc G_GNUC_UNUSED,
|
|
|
9bac43 |
VncState *vs = opaque;
|
|
|
9bac43 |
QIOChannelWebsock *wioc;
|
|
|
9bac43 |
|
|
|
9bac43 |
- VNC_DEBUG("Websocket negotiate starting\n");
|
|
|
9bac43 |
if (vs->ioc_tag) {
|
|
|
9bac43 |
g_source_remove(vs->ioc_tag);
|
|
|
9bac43 |
vs->ioc_tag = 0;
|
|
|
9bac43 |
@@ -127,6 +126,7 @@ gboolean vncws_handshake_io(QIOChannel *ioc G_GNUC_UNUSED,
|
|
|
9bac43 |
|
|
|
9bac43 |
object_unref(OBJECT(vs->ioc));
|
|
|
9bac43 |
vs->ioc = QIO_CHANNEL(wioc);
|
|
|
9bac43 |
+ trace_vnc_client_io_wrap(vs, vs->ioc, "websock");
|
|
|
9bac43 |
|
|
|
9bac43 |
qio_channel_websock_handshake(wioc,
|
|
|
9bac43 |
vncws_handshake_done,
|
|
|
9bac43 |
diff --git a/ui/vnc.c b/ui/vnc.c
|
|
|
9bac43 |
index 4e1d94f..66783ec 100644
|
|
|
9bac43 |
--- a/ui/vnc.c
|
|
|
9bac43 |
+++ b/ui/vnc.c
|
|
|
9bac43 |
@@ -1118,6 +1118,7 @@ static void vnc_disconnect_start(VncState *vs)
|
|
|
9bac43 |
if (vs->disconnecting) {
|
|
|
9bac43 |
return;
|
|
|
9bac43 |
}
|
|
|
9bac43 |
+ trace_vnc_client_disconnect_start(vs, vs->ioc);
|
|
|
9bac43 |
vnc_set_share_mode(vs, VNC_SHARE_MODE_DISCONNECTED);
|
|
|
9bac43 |
if (vs->ioc_tag) {
|
|
|
9bac43 |
g_source_remove(vs->ioc_tag);
|
|
|
9bac43 |
@@ -1131,6 +1132,8 @@ void vnc_disconnect_finish(VncState *vs)
|
|
|
9bac43 |
{
|
|
|
9bac43 |
int i;
|
|
|
9bac43 |
|
|
|
9bac43 |
+ trace_vnc_client_disconnect_finish(vs, vs->ioc);
|
|
|
9bac43 |
+
|
|
|
9bac43 |
vnc_jobs_join(vs); /* Wait encoding jobs */
|
|
|
9bac43 |
|
|
|
9bac43 |
vnc_lock_output(vs);
|
|
|
9bac43 |
@@ -1184,11 +1187,12 @@ ssize_t vnc_client_io_error(VncState *vs, ssize_t ret, Error **errp)
|
|
|
9bac43 |
{
|
|
|
9bac43 |
if (ret <= 0) {
|
|
|
9bac43 |
if (ret == 0) {
|
|
|
9bac43 |
- VNC_DEBUG("Closing down client sock: EOF\n");
|
|
|
9bac43 |
+ trace_vnc_client_eof(vs, vs->ioc);
|
|
|
9bac43 |
vnc_disconnect_start(vs);
|
|
|
9bac43 |
} else if (ret != QIO_CHANNEL_ERR_BLOCK) {
|
|
|
9bac43 |
- VNC_DEBUG("Closing down client sock: ret %zd (%s)\n",
|
|
|
9bac43 |
- ret, errp ? error_get_pretty(*errp) : "Unknown");
|
|
|
9bac43 |
+ trace_vnc_client_io_error(vs, vs->ioc,
|
|
|
9bac43 |
+ errp ? error_get_pretty(*errp) :
|
|
|
9bac43 |
+ "Unknown");
|
|
|
9bac43 |
vnc_disconnect_start(vs);
|
|
|
9bac43 |
}
|
|
|
9bac43 |
|
|
|
9bac43 |
@@ -2885,6 +2889,7 @@ static void vnc_connect(VncDisplay *vd, QIOChannelSocket *sioc,
|
|
|
9bac43 |
bool first_client = QTAILQ_EMPTY(&vd->clients);
|
|
|
9bac43 |
int i;
|
|
|
9bac43 |
|
|
|
9bac43 |
+ trace_vnc_client_connect(vs, sioc);
|
|
|
9bac43 |
vs->sioc = sioc;
|
|
|
9bac43 |
object_ref(OBJECT(vs->sioc));
|
|
|
9bac43 |
vs->ioc = QIO_CHANNEL(sioc);
|
|
|
9bac43 |
--
|
|
|
9bac43 |
1.8.3.1
|
|
|
9bac43 |
|