diff mbox

[2/2] spice-char: notify the server when chardev is writable

Message ID 1414141254-31960-2-git-send-email-marcandre.lureau@gmail.com
State New
Headers show

Commit Message

Marc-André Lureau Oct. 24, 2014, 9 a.m. UTC
The spice server is polling on write, unless
SPICE_CHAR_DEVICE_NOTIFY_WRITABLE flag is set. In this case, qemu must
call spice_server_char_device_wakeup() when the frontend is writable.

Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
---
 spice-qemu-char.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Gerd Hoffmann Oct. 27, 2014, 8:08 a.m. UTC | #1
On Fr, 2014-10-24 at 11:00 +0200, Marc-André Lureau wrote:
> The spice server is polling on write, unless
> SPICE_CHAR_DEVICE_NOTIFY_WRITABLE flag is set. In this case, qemu must
> call spice_server_char_device_wakeup() when the frontend is writable.
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
> ---
>  spice-qemu-char.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/spice-qemu-char.c b/spice-qemu-char.c
> index 8106e06..3de01d1 100644
> --- a/spice-qemu-char.c
> +++ b/spice-qemu-char.c
> @@ -111,6 +111,9 @@ static SpiceCharDeviceInterface vmc_interface = {
>  #if SPICE_SERVER_VERSION >= 0x000c02
>      .event              = vmc_event,
>  #endif
> +#if SPICE_SERVER_VERSION >= 0x000c06
> +    .flags              = SPICE_CHAR_DEVICE_NOTIFY_WRITABLE,
> +#endif
>  };
>  
> 
> @@ -261,6 +264,13 @@ static void print_allowed_subtypes(void)
>      fprintf(stderr, "\n");
>  }
>  
> +static void spice_chr_accept_input(struct CharDriverState *chr)
> +{
> +    SpiceCharDriver *s = chr->opaque;
> +
> +    spice_server_char_device_wakeup(&s->sin);

Does this build on older spice versions?  I'd suspect this needs #if
SPICE_SERVER_VERSION too ...

cheers,
  Gerd
Marc-André Lureau Oct. 27, 2014, 11:45 a.m. UTC | #2
Hi

On Mon, Oct 27, 2014 at 9:08 AM, Gerd Hoffmann <kraxel@redhat.com> wrote:

> > +static void spice_chr_accept_input(struct CharDriverState *chr)
> > +{
> > +    SpiceCharDriver *s = chr->opaque;
> > +
> > +    spice_server_char_device_wakeup(&s->sin);
>
> Does this build on older spice versions?  I'd suspect this needs #if
> SPICE_SERVER_VERSION too ...



There is already a spice_server_char_device_wakeup() call there. On older
servers, this additional call will trigger just a read try. With the
proposed patch in Spice server, it will do read & write try (I didn't see
the need to create a new function to do only read or write, both should be
fine)
Gerd Hoffmann Oct. 27, 2014, 11:57 a.m. UTC | #3
On Mo, 2014-10-27 at 12:45 +0100, Marc-André Lureau wrote:
> Hi
> 
> 
> On Mon, Oct 27, 2014 at 9:08 AM, Gerd Hoffmann <kraxel@redhat.com>
> wrote:
>         > +static void spice_chr_accept_input(struct CharDriverState
>         *chr)
>         > +{
>         > +    SpiceCharDriver *s = chr->opaque;
>         > +
>         > +    spice_server_char_device_wakeup(&s->sin);
>         
>         
>         Does this build on older spice versions?  I'd suspect this
>         needs #if
>         SPICE_SERVER_VERSION too ...
> 
> 
> There is already a spice_server_char_device_wakeup() call there. On
> older servers, this additional call will trigger just a read try. With
> the proposed patch in Spice server, it will do read & write try (I
> didn't see the need to create a new function to do only read or write,
> both should be fine)

Ok then.  Added to spice queue.  Fails to build, but that looks like
just being the dependency on amits patch and should go away once that
one is upstream.

cheers,
  Gerd
Amit Shah Oct. 27, 2014, 12:43 p.m. UTC | #4
Hi,

On (Fri) 24 Oct 2014 [11:00:54], Marc-André Lureau wrote:
> The spice server is polling on write, unless
> SPICE_CHAR_DEVICE_NOTIFY_WRITABLE flag is set. In this case, qemu must
> call spice_server_char_device_wakeup() when the frontend is writable.

Great, so there's no other change required to actually use the
functionality in my patch?  Does my patch fit your need fine, or do
you need to tweak the notification somehow?

It would be great to get your reviewed-by to my patch in case
everything's fine.

Peter has asked me to update the comments on my patch; I'll fix that
up right away since this showed up.

Thanks!

		Amit
Marc-André Lureau Oct. 27, 2014, 4:32 p.m. UTC | #5
On Mon, Oct 27, 2014 at 1:43 PM, Amit Shah <amit.shah@redhat.com> wrote:

> Great, so there's no other change required to actually use the
> functionality in my patch?  Does my patch fit your need fine, or do
> you need to tweak the notification somehow?
>
>
It seems to be working nicely.


> It would be great to get your reviewed-by to my patch in case
> everything's fine.
>
> Peter has asked me to update the comments on my patch; I'll fix that
> up right away since this showed up.
>

Sure, I'll wait for next updated patch then.
Amit Shah Oct. 28, 2014, 2:51 p.m. UTC | #6
On (Mon) 27 Oct 2014 [17:32:31], Marc-André Lureau wrote:
> On Mon, Oct 27, 2014 at 1:43 PM, Amit Shah <amit.shah@redhat.com> wrote:
> 
> > Great, so there's no other change required to actually use the
> > functionality in my patch?  Does my patch fit your need fine, or do
> > you need to tweak the notification somehow?
> >
> >
> It seems to be working nicely.
> 
> 
> > It would be great to get your reviewed-by to my patch in case
> > everything's fine.
> >
> > Peter has asked me to update the comments on my patch; I'll fix that
> > up right away since this showed up.
> >
> 
> Sure, I'll wait for next updated patch then.

Thanks, just sent a v3 out.


		Amit
Amit Shah May 4, 2015, 9:31 a.m. UTC | #7
Hi Gerd,

On (Mon) 27 Oct 2014 [12:57:57], Gerd Hoffmann wrote:
> On Mo, 2014-10-27 at 12:45 +0100, Marc-André Lureau wrote:
> > Hi
> > 
> > 
> > On Mon, Oct 27, 2014 at 9:08 AM, Gerd Hoffmann <kraxel@redhat.com>
> > wrote:
> >         > +static void spice_chr_accept_input(struct CharDriverState
> >         *chr)
> >         > +{
> >         > +    SpiceCharDriver *s = chr->opaque;
> >         > +
> >         > +    spice_server_char_device_wakeup(&s->sin);
> >         
> >         
> >         Does this build on older spice versions?  I'd suspect this
> >         needs #if
> >         SPICE_SERVER_VERSION too ...
> > 
> > 
> > There is already a spice_server_char_device_wakeup() call there. On
> > older servers, this additional call will trigger just a read try. With
> > the proposed patch in Spice server, it will do read & write try (I
> > didn't see the need to create a new function to do only read or write,
> > both should be fine)
> 
> Ok then.  Added to spice queue.  Fails to build, but that looks like
> just being the dependency on amits patch and should go away once that
> one is upstream.

The dependency patch is now in tree, please pick this series up.

Thanks,


		Amit
Gerd Hoffmann May 5, 2015, 9:45 a.m. UTC | #8
Hi,

> > Ok then.  Added to spice queue.  Fails to build, but that looks like
> > just being the dependency on amits patch and should go away once that
> > one is upstream.
> 
> The dependency patch is now in tree, please pick this series up.

Hmm, not in my queue any more, probably dropped at some point due
to the build failure.

Can you resend please?

thanks,
  Gerd
diff mbox

Patch

diff --git a/spice-qemu-char.c b/spice-qemu-char.c
index 8106e06..3de01d1 100644
--- a/spice-qemu-char.c
+++ b/spice-qemu-char.c
@@ -111,6 +111,9 @@  static SpiceCharDeviceInterface vmc_interface = {
 #if SPICE_SERVER_VERSION >= 0x000c02
     .event              = vmc_event,
 #endif
+#if SPICE_SERVER_VERSION >= 0x000c06
+    .flags              = SPICE_CHAR_DEVICE_NOTIFY_WRITABLE,
+#endif
 };
 
 
@@ -261,6 +264,13 @@  static void print_allowed_subtypes(void)
     fprintf(stderr, "\n");
 }
 
+static void spice_chr_accept_input(struct CharDriverState *chr)
+{
+    SpiceCharDriver *s = chr->opaque;
+
+    spice_server_char_device_wakeup(&s->sin);
+}
+
 static CharDriverState *chr_open(const char *subtype,
     void (*set_fe_open)(struct CharDriverState *, int))
 
@@ -280,6 +290,7 @@  static CharDriverState *chr_open(const char *subtype,
     chr->chr_set_fe_open = set_fe_open;
     chr->explicit_be_open = true;
     chr->chr_fe_event = spice_chr_fe_event;
+    chr->chr_accept_input = spice_chr_accept_input;
 
     QLIST_INSERT_HEAD(&spice_chars, s, next);