s390/tracing: Add s390-tod clock

In order to allow comparing trace timestamps between different
systems or virtual machines on s390, add a s390-tod trace clock.
This clock just uses the returned TOD clock value from stcke
directly.

Signed-off-by: Sven Schnelle <svens@linux.ibm.com>
Reviewed-by: Ilya Leoshkevich <iii@linux.ibm.com>
Reviewed-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
This commit is contained in:
Sven Schnelle 2026-05-21 12:41:44 +02:00 committed by Alexander Gordeev
parent 30cc5e2ad8
commit 29eb8a7b6e
4 changed files with 30 additions and 0 deletions

View File

@ -570,6 +570,10 @@ of ftrace. Here is a list of some of the key files:
to correlate events across hypervisor/guest if
tb_offset is known.
s390-tod:
This uses the s390 TOD clock value. This clock is usually in
sync across virtual machines and STP-enabled machines.
mono:
This uses the fast monotonic clock (CLOCK_MONOTONIC)
which is monotonic and is subject to NTP rate adjustments.

View File

@ -0,0 +1,13 @@
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _ASM_S390_TRACE_CLOCK_H
#define _ASM_S390_TRACE_CLOCK_H
#include <linux/compiler.h>
#include <linux/types.h>
u64 notrace trace_clock_s390_tod(void);
#define ARCH_TRACE_CLOCKS \
{ trace_clock_s390_tod, "s390-tod", .in_ns = 0 },
#endif /* _ASM_S390_TRACE_CLOCK_H */

View File

@ -62,6 +62,7 @@ obj-$(CONFIG_KPROBES) += mcount.o
obj-$(CONFIG_RETHOOK) += rethook.o
obj-$(CONFIG_FUNCTION_TRACER) += ftrace.o
obj-$(CONFIG_FUNCTION_TRACER) += mcount.o
obj-$(CONFIG_TRACING) += trace_clock.o
obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
obj-$(CONFIG_KEXEC_CORE) += machine_kexec.o relocate_kernel.o
obj-$(CONFIG_VMCORE_INFO) += vmcore_info.o

View File

@ -0,0 +1,12 @@
// SPDX-License-Identifier: GPL-2.0
#include <linux/trace_clock.h>
#include <linux/timex.h>
/*
* trace_clock_s390_tod(): trace clock based on the s390 TOD clock
*
* Unlike the other clocks, this is not in nanoseconds.
*/
u64 notrace trace_clock_s390_tod(void)
{
return get_tod_clock();
}