linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 0/2] Introduce a way to adjust CLOCK_BOOTTIME from userspace for VM guests
@ 2021-02-10 10:39 Hikaru Nishida
  2021-02-10 10:39 ` [RFC PATCH 1/2] timekeeping: Add timekeeping_adjust_boottime Hikaru Nishida
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Hikaru Nishida @ 2021-02-10 10:39 UTC (permalink / raw)
  To: linux-kernel
  Cc: suleiman, Hikaru Nishida, Alexander Graf, Andra Paraschiv,
	Arnd Bergmann, Geert Uytterhoeven, Greg Kroah-Hartman,
	Ingo Molnar, John Stultz, Kurt Kanzenbach, Linus Walleij,
	Masahiro Yamada, Stephen Boyd, Thomas Gleixner

From: Hikaru Nishida <hikalium@chromium.org>


Hi folks,

We'd like to add a sysfs interface that enable us to advance
CLOCK_BOOTTIME from userspace. The use case of this change is that
adjusting guest's CLOCK_BOOTTIME as host suspends to ensure that the
guest can notice the device has been suspended.
We have an application that rely on the difference between
CLOCK_BOOTTIME and CLOCK_MONOTONIC to detect whether the device went
suspend or not. However, the logic did not work well on VM environment
since most VMs are pausing the VM guests instead of actually suspending
them on the host's suspension.
With following patches, we can adjust CLOCK_BOOTTIME without actually
suspending guest and make the app working as intended.
I think this feature is also useful for other VM solutions since there
was no way to do this from userspace.

As far as I checked, it is working as expected but is there any concern
about this change? If so, please let me know.

Thanks,
Hikaru Nishida


Hikaru Nishida (2):
  timekeeping: Add timekeeping_adjust_boottime
  drivers/virt: introduce CLOCK_BOOTTIME adjustment sysfs interface
    driver

 drivers/virt/Kconfig        |  9 ++++++
 drivers/virt/Makefile       |  1 +
 drivers/virt/boottime_adj.c | 57 +++++++++++++++++++++++++++++++++++++
 include/linux/timekeeping.h |  2 ++
 kernel/time/timekeeping.c   | 26 +++++++++++++++++
 5 files changed, 95 insertions(+)
 create mode 100644 drivers/virt/boottime_adj.c

-- 
2.30.0.478.g8a0d178c01-goog


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-02-10 13:33 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-10 10:39 [RFC PATCH 0/2] Introduce a way to adjust CLOCK_BOOTTIME from userspace for VM guests Hikaru Nishida
2021-02-10 10:39 ` [RFC PATCH 1/2] timekeeping: Add timekeeping_adjust_boottime Hikaru Nishida
2021-02-10 13:12   ` Thomas Gleixner
2021-02-10 10:39 ` [RFC PATCH 2/2] drivers/virt: introduce CLOCK_BOOTTIME adjustment sysfs interface driver Hikaru Nishida
2021-02-10 10:48   ` Greg Kroah-Hartman
2021-02-10 10:51   ` Greg Kroah-Hartman
2021-02-10 13:10   ` Thomas Gleixner
2021-02-10 10:49 ` [RFC PATCH 0/2] Introduce a way to adjust CLOCK_BOOTTIME from userspace for VM guests Greg Kroah-Hartman
2021-02-10 11:17 ` Alexander Graf
2021-02-10 13:32 ` Arnd Bergmann

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).