Skip to contentSkip to conversation

i386/vmmouse: Properly reset state

PATCH In review Jan Kiszka 3 participants 6 messages Jul 21, 2019 – Aug 29, 2019

lore
Share & tools
lore

Jan Kiszka

author
#0 lore raw

PATCH 1/1 i386/vmmouse: Properly reset state

From: Jan Kiszka <[email protected]>

nb_queue was not zeroed so that we no longer delivered events if a previous guest left the device in an overflow state.

The state of absolute does not matter as the next vmmouse_update_handler call will align it again.

---
 hw/i386/vmmouse.c | 1 +
 1 file changed, 1 insertion(+)
hw/i386/vmmouse.c +1 -0
index 5d2d278be4..e335bd07da 100644
@@ -257,6 +257,7 @@ static void vmmouse_reset(DeviceState *d)
     VMMouseState *s = VMMOUSE(d);
 
     s->queue_size = VMMOUSE_QUEUE_SIZE;
+    s->nb_queue = 0;
 
     vmmouse_disable(s);
 }

--
2.16.4

author
#1 lore raw
Quoted 26 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

nb_queue was not zeroed so that we no longer delivered events if a previous guest left the device in an overflow state.

The state of absolute does not matter as the next vmmouse_update_handler call will align it again.

---
  hw/i386/vmmouse.c | 1 +
  1 file changed, 1 insertion(+)
hw/i386/vmmouse.c +1 -1
index 5d2d278be4..e335bd07da 100644
@@ -257,6 +257,7 @@ static void vmmouse_reset(DeviceState *d)
      VMMouseState *s = VMMOUSE(d);
 
      s->queue_size = VMMOUSE_QUEUE_SIZE;
+    s->nb_queue = 0;
 
      vmmouse_disable(s);
  }
--
Quoted 3 lines

2.16.4

Ping - or who is looking after this?

Jan

Reviewed-by
#2 lore raw
Quoted 24 lines · Jan Kiszka
Quoted 23 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

nb_queue was not zeroed so that we no longer delivered events if a previous guest left the device in an overflow state.

The state of absolute does not matter as the next vmmouse_update_handler call will align it again.

---
  hw/i386/vmmouse.c | 1 +
  1 file changed, 1 insertion(+)
hw/i386/vmmouse.c +1 -0
index 5d2d278be4..e335bd07da 100644
@@ -257,6 +257,7 @@ static void vmmouse_reset(DeviceState *d)
      VMMouseState *s = VMMOUSE(d);
 
      s->queue_size = VMMOUSE_QUEUE_SIZE;
+    s->nb_queue = 0;
 
Quoted 8 lines
Quoted 6 lines
hw/i386/vmmouse.c +0 -1
      vmmouse_disable(s);
  }
--

2.16.4

Ping - or who is looking after this?

Despite being in hw/i386, I think we can say vmmouse.c doesn't have a maintainer. Last time someone changed vmmouse.c in a meaningful way (not just adapting to API changes or removing duplicate code) was in 2012.

But the change makes sense to me, so:

I'll queue it.

Signature · 1 line
Eduardo
#3 lore raw

Hi Jan,

Quoted 22 lines · Eduardo Habkost
Quoted 21 lines · Jan Kiszka
Quoted 20 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

nb_queue was not zeroed so that we no longer delivered events if a previous guest left the device in an overflow state.

The state of absolute does not matter as the next vmmouse_update_handler call will align it again.

---
  hw/i386/vmmouse.c | 1 +
  1 file changed, 1 insertion(+)
hw/i386/vmmouse.c +0 -0
index 5d2d278be4..e335bd07da 100644
@@ -257,6 +257,7 @@ static void vmmouse_reset(DeviceState *d)
      VMMouseState *s = VMMOUSE(d);
 
Quoted 2 lines
Quoted 2 lines

hw/i386/vmmouse.c static void vmmouse_reset(DeviceState *d) · line 260

Quoted 2 lines
hw/i386/vmmouse.c +1 -0
      s->queue_size = VMMOUSE_QUEUE_SIZE;
+    s->nb_queue = 0;

Don't we also need to reset the status in case vmmouse_get_status() is called directly after reset?

         s->status = 0;

With it:

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
hw/i386/vmmouse.c +0 -1
      vmmouse_disable(s);
  }
--

2.16.4

Quoted 7 lines
Quoted 1 line

Ping - or who is looking after this?

Despite being in hw/i386, I think we can say vmmouse.c doesn't have a maintainer. Last time someone changed vmmouse.c in a meaningful way (not just adapting to API changes or removing duplicate code) was in 2012.

Well it does has a few:

$ ./scripts/get_maintainer.pl -f hw/i386/vmmouse.c
"Michael S. Tsirkin" <[email protected]> (supporter:PC)
Marcel Apfelbaum <[email protected]> (supporter:PC)
Paolo Bonzini <[email protected]> (maintainer:X86 TCG CPUs)
Richard Henderson <[email protected]> (maintainer:X86 TCG CPUs)
Eduardo Habkost <[email protected]> (maintainer:X86 TCG CPUs)

However the correct section should rather be "PC Chipset".

Quoted 6 lines

But the change makes sense to me, so:

I'll queue it.

author
#4 lore raw
Quoted 25 lines · Philippe Mathieu-Daudé

Hi Jan,

Quoted 22 lines · Eduardo Habkost
Quoted 21 lines · Jan Kiszka
Quoted 20 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

nb_queue was not zeroed so that we no longer delivered events if a previous guest left the device in an overflow state.

The state of absolute does not matter as the next vmmouse_update_handler call will align it again.

---
   hw/i386/vmmouse.c | 1 +
   1 file changed, 1 insertion(+)
hw/i386/vmmouse.c +0 -0
index 5d2d278be4..e335bd07da 100644
@@ -257,6 +257,7 @@ static void vmmouse_reset(DeviceState *d)
       VMMouseState *s = VMMOUSE(d);
 
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines

hw/i386/vmmouse.c static void vmmouse_reset(DeviceState *d) · line 260

Quoted 2 lines
hw/i386/vmmouse.c +1 -0
       s->queue_size = VMMOUSE_QUEUE_SIZE;
+    s->nb_queue = 0;

Don't we also need to reset the status in case vmmouse_get_status() is called directly after reset?

          s->status = 0;

Thanks for checking. We call vmmouse_disable() here, and that sets status to 0xffff anyway.

Jan

Quoted 36 lines

With it:

Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
hw/i386/vmmouse.c +0 -1
       vmmouse_disable(s);
   }
--

2.16.4

Quoted 7 lines
Quoted 1 line

Ping - or who is looking after this?

Despite being in hw/i386, I think we can say vmmouse.c doesn't have a maintainer. Last time someone changed vmmouse.c in a meaningful way (not just adapting to API changes or removing duplicate code) was in 2012.

Well it does has a few:

$ ./scripts/get_maintainer.pl -f hw/i386/vmmouse.c
"Michael S. Tsirkin" <[email protected]> (supporter:PC)
Marcel Apfelbaum <[email protected]> (supporter:PC)
Paolo Bonzini <[email protected]> (maintainer:X86 TCG CPUs)
Richard Henderson <[email protected]> (maintainer:X86 TCG CPUs)
Eduardo Habkost <[email protected]> (maintainer:X86 TCG CPUs)

However the correct section should rather be "PC Chipset".

Quoted 6 lines

But the change makes sense to me, so:

I'll queue it.

#5 lore raw
Quoted 33 lines · Jan Kiszka
Quoted 32 lines · Philippe Mathieu-Daudé

Hi Jan,

Quoted 23 lines · Eduardo Habkost
Quoted 22 lines · Jan Kiszka
Quoted 21 lines · Jan Kiszka

From: Jan Kiszka <[email protected]>

nb_queue was not zeroed so that we no longer delivered events if a previous guest left the device in an overflow state.

The state of absolute does not matter as the next
vmmouse_update_handler
call will align it again.

---
   hw/i386/vmmouse.c | 1 +

   1 file changed, 1 insertion(+)
hw/i386/vmmouse.c +0 -0
index 5d2d278be4..e335bd07da 100644
@@ -257,6 +257,7 @@ static void vmmouse_reset(DeviceState *d)
        VMMouseState *s = VMMOUSE(d);
 
Quoted 2 lines
Quoted 2 lines

hw/i386/vmmouse.c static void vmmouse_reset(DeviceState *d) · line 260

Quoted 2 lines
hw/i386/vmmouse.c +1 -0
        s->queue_size = VMMOUSE_QUEUE_SIZE;
+    s->nb_queue = 0;

Don't we also need to reset the status in case vmmouse_get_status() is called directly after reset?

Quoted 6 lines
Quoted 2 lines

          s->status = 0;

Thanks for checking. We call vmmouse_disable() here, and that sets status to
0xffff anyway.

I missed that, you are correct :)

So:

Quoted 33 lines
Quoted 33 lines
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
hw/i386/vmmouse.c +0 -0
        vmmouse_disable(s);
    }
Signature · 1 line
2.16.4
Quoted 7 lines
Quoted 1 line

Ping - or who is looking after this?

Despite being in hw/i386, I think we can say vmmouse.c doesn't have a maintainer.  Last time someone changed vmmouse.c in a meaningful way (not just adapting to API changes or removing duplicate code) was in 2012.

Well it does has a few:

$ ./scripts/get_maintainer.pl -f hw/i386/vmmouse.c
"Michael S. Tsirkin" <[email protected]> (supporter:PC)
Marcel Apfelbaum <[email protected]> (supporter:PC)
Paolo Bonzini <[email protected]> (maintainer:X86 TCG CPUs)
Richard Henderson <[email protected]> (maintainer:X86 TCG CPUs)
Eduardo Habkost <[email protected]> (maintainer:X86 TCG CPUs)

However the correct section should rather be "PC Chipset".

Quoted 6 lines

But the change makes sense to me, so:

I'll queue it.