Patchwork [v5,5/6] ps2: output warning when event queue full

login
register
mail settings
Submitter Amos Kong
Date July 26, 2012, 4:49 a.m.
Message ID <1343278141-10843-6-git-send-email-akong@redhat.com>
Download mbox | patch
Permalink /patch/173335/
State New
Headers show

Comments

Amos Kong - July 26, 2012, 4:49 a.m.
Event would be ignored if ps2 queue is full, this patch
added a warning in ignore path.

Signed-off-by: Amos Kong <akong@redhat.com>
---
 hw/ps2.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
Blue Swirl - July 27, 2012, 7:24 p.m.
On Thu, Jul 26, 2012 at 4:49 AM, Amos Kong <akong@redhat.com> wrote:
> Event would be ignored if ps2 queue is full, this patch
> added a warning in ignore path.
>
> Signed-off-by: Amos Kong <akong@redhat.com>
> ---
>  hw/ps2.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/hw/ps2.c b/hw/ps2.c
> index f93cd24..799c36b 100644
> --- a/hw/ps2.c
> +++ b/hw/ps2.c
> @@ -137,8 +137,10 @@ void ps2_queue(void *opaque, int b)
>      PS2State *s = (PS2State *)opaque;
>      PS2Queue *q = &s->queue;
>
> -    if (q->count >= PS2_QUEUE_SIZE)
> +    if (q->count >= PS2_QUEUE_SIZE) {
> +        fprintf(stderr, "ps2: warning: event queue full\n");

This spams console at guest's will. Please use DPRINTF.

>          return;
> +    }
>      q->data[q->wptr] = b;
>      if (++q->wptr == PS2_QUEUE_SIZE)
>          q->wptr = 0;
> --
> 1.7.1
>
>

Patch

diff --git a/hw/ps2.c b/hw/ps2.c
index f93cd24..799c36b 100644
--- a/hw/ps2.c
+++ b/hw/ps2.c
@@ -137,8 +137,10 @@  void ps2_queue(void *opaque, int b)
     PS2State *s = (PS2State *)opaque;
     PS2Queue *q = &s->queue;
 
-    if (q->count >= PS2_QUEUE_SIZE)
+    if (q->count >= PS2_QUEUE_SIZE) {
+        fprintf(stderr, "ps2: warning: event queue full\n");
         return;
+    }
     q->data[q->wptr] = b;
     if (++q->wptr == PS2_QUEUE_SIZE)
         q->wptr = 0;