Skip to contentSkip to conversation

public/xen.h: update the comment explaining 'Wallclock time'

PATCH In review Paul Durrant 3 participants 4 messages Sep 12, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 public/xen.h: update the comment explaining 'Wallclock time'

Since commit 0629adfd80e "Actually set a HVM domain's time offset when it sets the RTC", the comment in the public header has been misleading, since it claims that wallclock time is only updated by control software. Moreover, the comments stating that wc_sec and wc_nsec are seconds and nanoseconds (respectively) in UTC since the Unix epoch are bogus. Their values are adjusted by the domain's time_offset_seconds value, which is updated by a guest write to the emulated RTC and hence the wallclock timezone is under guest control.

This patch attempts to bring the comment in line with reality whilst keeping it reasonably short.

---
Cc: Andrew Cooper <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Ian Jackson <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Julien Grall <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: Tim Deegan <[email protected]>
Cc: Wei Liu <[email protected]>

---
 xen/include/public/xen.h | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)
xen/include/public/xen.h +9 -4
index cef65c38e7..2755c5ad54 100644
@@ -775,12 +775,17 @@ struct shared_info {
     xen_ulong_t evtchn_mask[sizeof(xen_ulong_t) * 8];
 
     /*
-     * Wallclock time: updated only by control software. Guests should base
-     * their gettimeofday() syscall on this wallclock-base value.
+     * Wallclock time: updated by control software or RTC emulation.
+     * Guests should base their gettimeofday() syscall on this
+     * wallclock-base value.
+     * The valus of wc_sec and wc_nsec are offsets from the Unix epoch
+     * adjusted by the domain's 'time offset' (in seconds) as set either
+     * by XEN_DOMCTL_settimeoffset, or adjusted via a guest write to the
+     * emulated RTC.
      */
     uint32_t wc_version;      /* Version counter: see vcpu_time_info_t. */
-    uint32_t wc_sec;          /* Secs  00:00:00 UTC, Jan 1, 1970.  */
-    uint32_t wc_nsec;         /* Nsecs 00:00:00 UTC, Jan 1, 1970.  */
+    uint32_t wc_sec;
+    uint32_t wc_nsec;
 #if !defined(__i386__)
     uint32_t wc_sec_hi;
 # define xen_wc_sec_hi wc_sec_hi
Signature · 7 lines
2.20.1.2.gb21ebb671


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw
Quoted 32 lines · Paul Durrant

Since commit 0629adfd80e "Actually set a HVM domain's time offset when it sets the RTC", the comment in the public header has been misleading, since it claims that wallclock time is only updated by control software. Moreover, the comments stating that wc_sec and wc_nsec are seconds and nanoseconds (respectively) in UTC since the Unix epoch are bogus. Their values are adjusted by the domain's time_offset_seconds value, which is updated by a guest write to the emulated RTC and hence the wallclock timezone is under guest control.

This patch attempts to bring the comment in line with reality whilst keeping it reasonably short.

---
Cc: Andrew Cooper <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Ian Jackson <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Julien Grall <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: Tim Deegan <[email protected]>
Cc: Wei Liu <[email protected]>

---
  xen/include/public/xen.h | 13 +++++++++----
  1 file changed, 9 insertions(+), 4 deletions(-)
xen/include/public/xen.h +0 -0
index cef65c38e7..2755c5ad54 100644

xen/include/public/xen.h struct shared_info { · line 781

Quoted 9 lines
xen/include/public/xen.h +4 -2
@@ -775,12 +775,17 @@ struct shared_info {
      xen_ulong_t evtchn_mask[sizeof(xen_ulong_t) * 8];
 
      /*
-     * Wallclock time: updated only by control software. Guests should base
-     * their gettimeofday() syscall on this wallclock-base value.
+     * Wallclock time: updated by control software or RTC emulation.
+     * Guests should base their gettimeofday() syscall on this
+     * wallclock-base value.
+     * The valus of wc_sec and wc_nsec are offsets from the Unix epoch

s/valus/values/

Juergen

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

Acked-by on v1 1/1
#2 lore raw
In reply to Paul Durrant
Quoted 9 lines · Paul Durrant

Since commit 0629adfd80e "Actually set a HVM domain's time offset when it sets the RTC", the comment in the public header has been misleading, since it claims that wallclock time is only updated by control software. Moreover, the comments stating that wc_sec and wc_nsec are seconds and nanoseconds (respectively) in UTC since the Unix epoch are bogus. Their values are adjusted by the domain's time_offset_seconds value, which is updated by a guest write to the emulated RTC and hence the wallclock timezone is under guest control.

Quoted 4 lines

This patch attempts to bring the comment in line with reality whilst keeping it reasonably short.

(preferably with the typo fixed that Jürgen pointed out; easily done while committing)

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

#3 lore raw
Quoted 20 lines

-----Original Message-----
From: Jan Beulich <[email protected]>
Sent: 12 September 2019 17:03
To: Paul Durrant <[email protected]>
Cc: [email protected]; Julien Grall <[email protected]>; Andrew Cooper <[email protected]>; George Dunlap <[email protected]>; Ian Jackson <[email protected]>; Stefano Stabellini <[email protected]>; Konrad Rzeszutek Wilk <[email protected]>; Tim (Xen.org) <[email protected]>; Wei Liu <[email protected]>
Subject: Re: [PATCH] public/xen.h: update the comment explaining 'Wallclock time'

Quoted 9 lines · Paul Durrant

Since commit 0629adfd80e "Actually set a HVM domain's time offset when it sets the RTC", the comment in the public header has been misleading, since it claims that wallclock time is only updated by control software. Moreover, the comments stating that wc_sec and wc_nsec are seconds and nanoseconds (respectively) in UTC since the Unix epoch are bogus. Their values are adjusted by the domain's time_offset_seconds value, which is updated by a guest write to the emulated RTC and hence the wallclock timezone is under guest control.

Quoted 8 lines
Quoted 4 lines

This patch attempts to bring the comment in line with reality whilst keeping it reasonably short.

(preferably with the typo fixed that Jürgen pointed out; easily done while committing)

OK. Thanks,

Paul

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