[Qemu-devel] [PATCH 4/4] ui: extend VNC trottling tracing to SASL codepaths

Daniel P. Berrangé posted 4 patches 8 years ago
[Qemu-devel] [PATCH 4/4] ui: extend VNC trottling tracing to SASL codepaths
Posted by Daniel P. Berrangé 8 years ago
In previous commit:

  commit 6aa22a29187e1908f5db738d27c64a9efc8d0bfa
  Author: Daniel P. Berrange <berrange@redhat.com>
  Date:   Mon Dec 18 19:12:27 2017 +0000

    ui: add trace events related to VNC client throttling

trace points related to unthrottling client I/O were missed from the
SASL codepaths.

Reported-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
 ui/vnc-auth-sasl.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/ui/vnc-auth-sasl.c b/ui/vnc-auth-sasl.c
index 8ebd0d3d00..3751a777a4 100644
--- a/ui/vnc-auth-sasl.c
+++ b/ui/vnc-auth-sasl.c
@@ -79,12 +79,23 @@ size_t vnc_client_write_sasl(VncState *vs)
 
     vs->sasl.encodedOffset += ret;
     if (vs->sasl.encodedOffset == vs->sasl.encodedLength) {
+        bool throttled = vs->force_update_offset != 0;
+        size_t offset;
         if (vs->sasl.encodedRawLength >= vs->force_update_offset) {
             vs->force_update_offset = 0;
         } else {
             vs->force_update_offset -= vs->sasl.encodedRawLength;
         }
+        if (throttled && vs->force_update_offset == 0) {
+            trace_vnc_client_unthrottle_forced(vs, vs->ioc);
+        }
+        offset = vs->output.offset;
         buffer_advance(&vs->output, vs->sasl.encodedRawLength);
+        if (offset >= vs->throttle_output_offset &&
+            vs->output.offset < vs->throttle_output_offset) {
+            trace_vnc_client_unthrottle_incremental(vs, vs->ioc,
+                                                    vs->output.offset);
+        }
         vs->sasl.encoded = NULL;
         vs->sasl.encodedOffset = vs->sasl.encodedLength = 0;
     }
-- 
2.14.3


Re: [Qemu-devel] [PATCH 4/4] ui: extend VNC trottling tracing to SASL codepaths
Posted by Laszlo Ersek 8 years ago
On 02/05/18 12:49, Daniel P. Berrangé wrote:
> In previous commit:
> 
>   commit 6aa22a29187e1908f5db738d27c64a9efc8d0bfa
>   Author: Daniel P. Berrange <berrange@redhat.com>
>   Date:   Mon Dec 18 19:12:27 2017 +0000
> 
>     ui: add trace events related to VNC client throttling
> 
> trace points related to unthrottling client I/O were missed from the
> SASL codepaths.
> 
> Reported-by: Laszlo Ersek <lersek@redhat.com>
> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> ---
>  ui/vnc-auth-sasl.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/ui/vnc-auth-sasl.c b/ui/vnc-auth-sasl.c
> index 8ebd0d3d00..3751a777a4 100644
> --- a/ui/vnc-auth-sasl.c
> +++ b/ui/vnc-auth-sasl.c
> @@ -79,12 +79,23 @@ size_t vnc_client_write_sasl(VncState *vs)
>  
>      vs->sasl.encodedOffset += ret;
>      if (vs->sasl.encodedOffset == vs->sasl.encodedLength) {
> +        bool throttled = vs->force_update_offset != 0;
> +        size_t offset;
>          if (vs->sasl.encodedRawLength >= vs->force_update_offset) {
>              vs->force_update_offset = 0;
>          } else {
>              vs->force_update_offset -= vs->sasl.encodedRawLength;
>          }
> +        if (throttled && vs->force_update_offset == 0) {
> +            trace_vnc_client_unthrottle_forced(vs, vs->ioc);
> +        }
> +        offset = vs->output.offset;
>          buffer_advance(&vs->output, vs->sasl.encodedRawLength);
> +        if (offset >= vs->throttle_output_offset &&
> +            vs->output.offset < vs->throttle_output_offset) {
> +            trace_vnc_client_unthrottle_incremental(vs, vs->ioc,
> +                                                    vs->output.offset);
> +        }
>          vs->sasl.encoded = NULL;
>          vs->sasl.encodedOffset = vs->sasl.encodedLength = 0;
>      }
> 

Reviewed-by: Laszlo Ersek <lersek@redhat.com>

Thank you!
Laszlo