ring-buffer: Check if absolute timestamp goes backwards
authorSteven Rostedt (Google) <rostedt@goodmis.org>
Tue, 19 Dec 2023 12:47:32 +0000 (07:47 -0500)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Tue, 19 Dec 2023 12:49:47 +0000 (07:49 -0500)
commitf50345b49b16f7fe6dbebbec065b9248c38556ff
tree17d59efd8249762ba45aebca7dc77c8c71ae6012
parentd40dbb617ae9a8fe57343b26b4ad2bd7bb05c130
ring-buffer: Check if absolute timestamp goes backwards

The check_buffer() which checks the timestamps of the ring buffer
sub-buffer page, when enabled, only checks if the adding of deltas of the
events from the last absolute timestamp or the timestamp of the sub-buffer
page adds up to the current event.

What it does not check is if the absolute timestamp causes the time of the
events to go backwards, as that can cause issues elsewhere.

Test for the timestamp going backwards too.

This also fixes a slight issue where if the warning triggers at boot up
(because of the resetting of the tsc), it will disable all further checks,
even those that are after boot Have it continue checking if the warning
was ignored during boot up.

Link: https://lore.kernel.org/linux-trace-kernel/20231219074732.18b092d4@gandalf.local.home
Cc: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
kernel/trace/ring_buffer.c