All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: "Philippe Mathieu-Daudé" <f4bug@amsat.org>, qemu-devel@nongnu.org
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>,
	"Joaquin de Andres" <me@xcancerberox.com.ar>,
	"Michael Roth" <mdroth@linux.vnet.ibm.com>,
	"Markus Armbruster" <armbru@redhat.com>,
	qemu-arm@nongnu.org, "Cédric Le Goater" <clg@kaod.org>,
	"Joel Stanley" <joel@jms.id.au>
Subject: Re: [RFC PATCH 2/5] hw/misc/led: Add LED_STATUS_CHANGED QAPI event
Date: Tue, 9 Jun 2020 09:29:24 -0500	[thread overview]
Message-ID: <8e5154ba-0d80-d6f3-0da0-c20072173d9a@redhat.com> (raw)
In-Reply-To: <20200609123425.6921-3-f4bug@amsat.org>

On 6/9/20 7:34 AM, Philippe Mathieu-Daudé wrote:
> Allow LED devices to emit STATUS_CHANGED events on a QMP chardev.
> 
> QMP event examples:
> 
> {
>      "timestamp": {
>          "seconds": 1591704274,
>          "microseconds": 520850
>      },
>      "event": "LED_STATUS_CHANGED",
>      "data": {
>          "name": "Green LED #0",
>          "status": "on"
>      }
> }
> {
>      "timestamp": {
>          "seconds": 1591704275,
>          "microseconds": 530912
>      },
>      "event": "LED_STATUS_CHANGED",
>      "data": {
>          "name": "Green LED #0",
>          "status": "off"
>      }
> }
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---

The QAPI addition looks reasonable, however,

> +++ b/hw/misc/led.c
> @@ -7,6 +7,7 @@
>    */
>   #include "qemu/osdep.h"
>   #include "qapi/error.h"
> +#include "qapi/qapi-events-led.h"
>   #include "hw/qdev-properties.h"
>   #include "hw/misc/led.h"
>   #include "hw/irq.h"
> @@ -19,6 +20,9 @@ static void led_set(void *opaque, int line, int new_state)
>   
>       trace_led_set(s->name, s->current_state, new_state);
>   
> +    /* FIXME QMP rate limite? */

s/limite/limit/

Yes, this is under guest control, so you MUST rate limit to avoid the 
guest being able to DoS qemu by changing the LED so frequently as to 
overwhelm the QMP connection with events.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3226
Virtualization:  qemu.org | libvirt.org



  reply	other threads:[~2020-06-09 14:33 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-09 12:34 [RFC PATCH 0/5] hw/misc: Add LED device Philippe Mathieu-Daudé
2020-06-09 12:34 ` [RFC PATCH 1/5] hw/misc: Add a " Philippe Mathieu-Daudé
2020-06-09 12:34 ` [RFC PATCH 2/5] hw/misc/led: Add LED_STATUS_CHANGED QAPI event Philippe Mathieu-Daudé
2020-06-09 14:29   ` Eric Blake [this message]
2020-06-12 15:51     ` Philippe Mathieu-Daudé
2020-06-15  5:59       ` Markus Armbruster
2020-08-06  8:17         ` Markus Armbruster
2020-06-09 12:34 ` [RFC PATCH 3/5] hw/misc/led: Add create_led_by_gpio_id() helper Philippe Mathieu-Daudé
2020-06-09 12:34 ` [RFC PATCH 4/5] hw/arm/microbit: Add a fake LED to use as proof-of-concept with Zephyr Philippe Mathieu-Daudé
2020-06-09 12:34 ` [RFC PATCH 5/5] hw/arm/tosa: Use LED device for the Bluetooth led Philippe Mathieu-Daudé

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8e5154ba-0d80-d6f3-0da0-c20072173d9a@redhat.com \
    --to=eblake@redhat.com \
    --cc=armbru@redhat.com \
    --cc=clg@kaod.org \
    --cc=f4bug@amsat.org \
    --cc=joel@jms.id.au \
    --cc=mdroth@linux.vnet.ibm.com \
    --cc=me@xcancerberox.com.ar \
    --cc=peter.maydell@linaro.org \
    --cc=philmd@redhat.com \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.