From: Luiz Capitulino <lcapitulino@redhat.com>
To: Anthony Liguori <anthony@codemonkey.ws>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] QMP: Introduce RTC_CHANGE event
Date: Tue, 9 Mar 2010 11:55:03 -0300 [thread overview]
Message-ID: <20100309115503.6a1e9335@redhat.com> (raw)
In-Reply-To: <4B965919.1050404@codemonkey.ws>
On Tue, 09 Mar 2010 08:20:09 -0600
Anthony Liguori <anthony@codemonkey.ws> wrote:
> On 02/25/2010 09:11 AM, Luiz Capitulino wrote:
> > Emitted whenever the RTC time changes.
> >
> > Signed-off-by: Luiz Capitulino<lcapitulino@redhat.com>
> >
>
> Not that this change isn't acceptable, but I think we need to improve
> how we handle these events in the future.
>
> > ---
> > QMP/qmp-events.txt | 15 +++++++++++++++
> > hw/mc146818rtc.c | 2 ++
> > monitor.c | 3 +++
> > monitor.h | 1 +
> > sysemu.h | 2 ++
> > vl.c | 9 +++++++++
> > 6 files changed, 32 insertions(+), 0 deletions(-)
> >
> > diff --git a/QMP/qmp-events.txt b/QMP/qmp-events.txt
> > index b0183f9..f64b42d 100644
> > --- a/QMP/qmp-events.txt
> > +++ b/QMP/qmp-events.txt
> > @@ -38,6 +38,21 @@ Example:
> > { "event": "RESET",
> > "timestamp": { "seconds": 1267041653, "microseconds": 9518 } }
> >
> > +RTC_CHANGE
> > +----------
> > +
> > +Emitted when the RTC time changes.
> > +
> > +Data:
> > +
> > +- "offset": delta against the host UTC in seconds (json-number)
> > +
> > +Example:
> > +
> > +{ "event": "RTC_CHANGE",
> > + "data": { "offset": 78 },
> > + "timestamp": { "seconds": 1267020223, "microseconds": 435656 } }
> > +
> > SHUTDOWN
> > --------
> >
> > diff --git a/hw/mc146818rtc.c b/hw/mc146818rtc.c
> > index 2616d0d..a537855 100644
> > --- a/hw/mc146818rtc.c
> > +++ b/hw/mc146818rtc.c
> > @@ -297,6 +297,8 @@ static void rtc_set_time(RTCState *s)
> > tm->tm_mday = rtc_from_bcd(s, s->cmos_data[RTC_DAY_OF_MONTH]);
> > tm->tm_mon = rtc_from_bcd(s, s->cmos_data[RTC_MONTH]) - 1;
> > tm->tm_year = rtc_from_bcd(s, s->cmos_data[RTC_YEAR]) + s->base_year - 1900;
> > +
> > + rtc_change_mon_event(tm);
> > }
> >
> > static void rtc_copy_date(RTCState *s)
> > diff --git a/monitor.c b/monitor.c
> > index b2f5842..20512da 100644
> > --- a/monitor.c
> > +++ b/monitor.c
> > @@ -423,6 +423,9 @@ void monitor_protocol_event(MonitorEvent event, QObject *data)
> > case QEVENT_BLOCK_IO_ERROR:
> > event_name = "BLOCK_IO_ERROR";
> > break;
> > + case QEVENT_RTC_CHANGE:
> > + event_name = "RTC_CHANGE";
> > + break;
> > default:
> > abort();
> > break;
> > diff --git a/monitor.h b/monitor.h
> > index 8cc21f5..aa51bd5 100644
> > --- a/monitor.h
> > +++ b/monitor.h
> > @@ -23,6 +23,7 @@ typedef enum MonitorEvent {
> > QEVENT_VNC_INITIALIZED,
> > QEVENT_VNC_DISCONNECTED,
> > QEVENT_BLOCK_IO_ERROR,
> > + QEVENT_RTC_CHANGE,
> > QEVENT_MAX,
> > } MonitorEvent;
> >
>
> This is going against the direction that we're trying to take with
> qdev. We're trying to modularize devices by having only the device
> themselves know their existence. That's the beauty of things like -device.
Okay, we need to integrate with qdev then, as you have already suggested.
> The fact that we're putting knowledge of the RTC into monitor.[ch] and
> vl.c is a step in the wrong direction. We really ought to be able to
> generate device specific events entirely within the device.
Perhaps qdev can export available events to the Monitor, but even then
the Monitor will have to at least know what put on the wire (eg. the
event's string name). This can't be on qdev, as it's protocol specific
info.
Also, just a small note, I've changed vl.c because RTC code is there
(it should be on its own module).
next prev parent reply other threads:[~2010-03-09 14:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-25 15:11 [Qemu-devel] [PATCH] QMP: Introduce RTC_CHANGE event Luiz Capitulino
2010-03-09 14:20 ` Anthony Liguori
2010-03-09 14:55 ` Luiz Capitulino [this message]
2010-03-09 14:25 ` Anthony Liguori
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=20100309115503.6a1e9335@redhat.com \
--to=lcapitulino@redhat.com \
--cc=anthony@codemonkey.ws \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).