Skip to contentSkip to conversation

xen: Emit RTC_CHANGE upon TIMEOFFSET ioreq

PATCH In review Ross Lagerwall 3 participants 4 messages Aug 23, 2017 – Sep 20, 2017

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 xen: Emit RTC_CHANGE upon TIMEOFFSET ioreq

When the guest writes to the RTC, Xen emulates it and broadcasts a TIMEOFFSET ioreq. Emit an RTC_CHANGE QMP event to all QMP monitors when this happens rather than ignoring it so that something useful can be done with the information. This is the same event that QEMU generates when it emulates the RTC.

This patch by itself doesn't affect any of the toolstacks that I checked; the libxl toolstack doesn't currently handle this event nor does the XAPI toolstack. If nothing handles the event, it is simply ignored. We plan on modifying XAPI to handle it.

---

Changed in v2:
* Expanded commit message.

 hw/i386/xen/xen-hvm.c | 2 ++
 1 file changed, 2 insertions(+)
hw/i386/xen/xen-hvm.c +2 -0
index d9ccd5d..ffd20dc 100644
@@ -16,6 +16,7 @@
 #include "hw/i386/apic-msidef.h"
 #include "hw/xen/xen_common.h"
 #include "hw/xen/xen_backend.h"
+#include "qapi-event.h"
 #include "qmp-commands.h"
 
 #include "qemu/error-report.h"
@@ -967,6 +968,7 @@ static void handle_ioreq(XenIOState *state, ioreq_t *req)
             handle_vmport_ioreq(state, req);
             break;
         case IOREQ_TYPE_TIMEOFFSET:
+            qapi_event_send_rtc_change((int64_t)req->data, &error_abort);
             break;
         case IOREQ_TYPE_INVALIDATE:
             xen_invalidate_map_cache();
Signature · 7 lines
2.9.5


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Reviewed-by on v2 1/1
#1 lore raw
Quoted 6 lines · Ross Lagerwall

When the guest writes to the RTC, Xen emulates it and broadcasts a TIMEOFFSET ioreq. Emit an RTC_CHANGE QMP event to all QMP monitors when this happens rather than ignoring it so that something useful can be done with the information. This is the same event that QEMU generates when it emulates the RTC.

Quoted 6 lines

This patch by itself doesn't affect any of the toolstacks that I checked; the libxl toolstack doesn't currently handle this event nor does the XAPI toolstack. If nothing handles the event, it is simply ignored. We plan on modifying XAPI to handle it.

I queued it up.

Quoted 31 lines

---

Changed in v2:
* Expanded commit message.

 hw/i386/xen/xen-hvm.c | 2 ++
 1 file changed, 2 insertions(+)
hw/i386/xen/xen-hvm.c +2 -0
index d9ccd5d..ffd20dc 100644
@@ -16,6 +16,7 @@
 #include "hw/i386/apic-msidef.h"
 #include "hw/xen/xen_common.h"
 #include "hw/xen/xen_backend.h"
+#include "qapi-event.h"
 #include "qmp-commands.h"
 
 #include "qemu/error-report.h"
@@ -967,6 +968,7 @@ static void handle_ioreq(XenIOState *state, ioreq_t *req)
             handle_vmport_ioreq(state, req);
             break;
         case IOREQ_TYPE_TIMEOFFSET:
+            qapi_event_send_rtc_change((int64_t)req->data, &error_abort);
             break;
         case IOREQ_TYPE_INVALIDATE:
             xen_invalidate_map_cache();
Signature · 1 line
2.9.5

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel

#2 lore raw
In reply to Ross Lagerwall
Quoted 33 lines · Ross Lagerwall

When the guest writes to the RTC, Xen emulates it and broadcasts a TIMEOFFSET ioreq. Emit an RTC_CHANGE QMP event to all QMP monitors when this happens rather than ignoring it so that something useful can be done with the information. This is the same event that QEMU generates when it emulates the RTC.

This patch by itself doesn't affect any of the toolstacks that I checked; the libxl toolstack doesn't currently handle this event nor does the XAPI toolstack. If nothing handles the event, it is simply ignored. We plan on modifying XAPI to handle it.

---

Changed in v2:
* Expanded commit message.

 hw/i386/xen/xen-hvm.c | 2 ++
 1 file changed, 2 insertions(+)
hw/i386/xen/xen-hvm.c +1 -0
index d9ccd5d..ffd20dc 100644
@@ -16,6 +16,7 @@
 #include "hw/i386/apic-msidef.h"
 #include "hw/xen/xen_common.h"
 #include "hw/xen/xen_backend.h"
+#include "qapi-event.h"
 #include "qmp-commands.h"
 
 #include "qemu/error-report.h"

hw/i386/xen/xen-hvm.c static void handle_ioreq(XenIOState *state, ioreq_t *req) · line 971

Quoted 4 lines
hw/i386/xen/xen-hvm.c +1 -0
@@ -967,6 +968,7 @@ static void handle_ioreq(XenIOState *state, ioreq_t *req)
             handle_vmport_ioreq(state, req);
             break;
         case IOREQ_TYPE_TIMEOFFSET:
+            qapi_event_send_rtc_change((int64_t)req->data, &error_abort);

Is this the right value?

From qapi-schema.json: "offset between base RTC clock (as specified by -rtc base), and new RTC clock value". But with this patch, the offset sent via QMP seems to be between the previous value of the guest rtc and the new one. Other calls to qapi_event_send_rtc_change send the offset between the new guest RTC and qemu_time().

Signature · 6 lines
Anthony PERARD

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
#3 lore raw

Ping?

Quoted 41 lines · Anthony PERARD
Quoted 33 lines · Ross Lagerwall

When the guest writes to the RTC, Xen emulates it and broadcasts a TIMEOFFSET ioreq. Emit an RTC_CHANGE QMP event to all QMP monitors when this happens rather than ignoring it so that something useful can be done with the information. This is the same event that QEMU generates when it emulates the RTC.

This patch by itself doesn't affect any of the toolstacks that I checked; the libxl toolstack doesn't currently handle this event nor does the XAPI toolstack. If nothing handles the event, it is simply ignored. We plan on modifying XAPI to handle it.

---

Changed in v2:
* Expanded commit message.

 hw/i386/xen/xen-hvm.c | 2 ++
 1 file changed, 2 insertions(+)
hw/i386/xen/xen-hvm.c +1 -0
index d9ccd5d..ffd20dc 100644
@@ -16,6 +16,7 @@
 #include "hw/i386/apic-msidef.h"
 #include "hw/xen/xen_common.h"
 #include "hw/xen/xen_backend.h"
+#include "qapi-event.h"
 #include "qmp-commands.h"
 
 #include "qemu/error-report.h"

hw/i386/xen/xen-hvm.c static void handle_ioreq(XenIOState *state, ioreq_t *req) · line 971

Quoted 4 lines
hw/i386/xen/xen-hvm.c +1 -0
@@ -967,6 +968,7 @@ static void handle_ioreq(XenIOState *state, ioreq_t *req)
             handle_vmport_ioreq(state, req);
             break;
         case IOREQ_TYPE_TIMEOFFSET:
+            qapi_event_send_rtc_change((int64_t)req->data, &error_abort);

Is this the right value?

Quoted 5 lines
Quoted 1 line

From qapi-schema.json: "offset between base RTC clock (as specified by

-rtc base), and new RTC clock value". But with this patch, the offset sent via QMP seems to be between the previous value of the guest rtc and the new one. Other calls to qapi_event_send_rtc_change send the offset between the new guest RTC and qemu_time().

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel