lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1469785812-16790-1-git-send-email-Bogdan-Stefan_mirea@mentor.com>
Date:	Fri, 29 Jul 2016 12:50:12 +0300
From:	Bogdan Mirea <Bogdan-Stefan_mirea@...tor.com>
To:	<linux-kernel@...r.kernel.org>
CC:	<john.stultz@...aro.org>, <tglx@...utronix.de>,
	Bogdan Mirea <Bogdan-Stefan_mirea@...tor.com>
Subject: [PATCH] Added "Preserve Boot Time Support"

This option enables Boot Time Preservation between Bootloader and
Linux Kernel. It is based on the idea that the Bootloader (or any
other early firmware) will start the HW Timer and Linux Kernel will
count the time starting with the cycles elapsed since timer start.

Signed-off-by: Bogdan Mirea <Bogdan-Stefan_mirea@...tor.com>
---
 kernel/time/Kconfig       | 8 ++++++++
 kernel/time/sched_clock.c | 6 ++++++
 2 files changed, 14 insertions(+)

diff --git a/kernel/time/Kconfig b/kernel/time/Kconfig
index 4008d9f..d001839 100644
--- a/kernel/time/Kconfig
+++ b/kernel/time/Kconfig
@@ -193,5 +193,13 @@ config HIGH_RES_TIMERS
 	  hardware is not capable then this option only increases
 	  the size of the kernel image.
 
+config BOOT_TIME_PRESERVE
+	bool "Preserve Boot Time Support"
+	help
+	  This option enables Boot Time Preservation between Bootloader and
+	  Linux Kernel. It is based on the idea that the Bootloader (or any 
+	  other early firmware) will start the HW Timer and Linux Kernel will 
+	  count the time starting with the cycles elapsed since timer start.
+
 endmenu
 endif
diff --git a/kernel/time/sched_clock.c b/kernel/time/sched_clock.c
index a26036d..1d6e35a 100644
--- a/kernel/time/sched_clock.c
+++ b/kernel/time/sched_clock.c
@@ -193,7 +193,13 @@ sched_clock_register(u64 (*read)(void), int bits, unsigned long rate)
 	/* Update epoch for new counter and update 'epoch_ns' from old counter*/
 	new_epoch = read();
 	cyc = cd.actual_read_sched_clock();
+
+#ifdef CONFIG_BOOT_TIME_PRESERVE
+	ns = rd.epoch_ns + cyc_to_ns((new_epoch - rd.epoch_cyc) & new_mask, new_mult, new_shift);
+#else
 	ns = rd.epoch_ns + cyc_to_ns((cyc - rd.epoch_cyc) & rd.sched_clock_mask, rd.mult, rd.shift);
+#endif /* CONFIG_BOOT_TIME_PRESERVE */
+
 	cd.actual_read_sched_clock = read;
 
 	rd.read_sched_clock	= read;
-- 
1.9.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ