All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kbuffer: Handle 64 bit timestamp event
@ 2022-04-27 22:23 Steven Rostedt
  0 siblings, 0 replies; only message in thread
From: Steven Rostedt @ 2022-04-27 22:23 UTC (permalink / raw)
  To: Linux Trace Devel; +Cc: Thomas Gleixner, Kurt Kanzenbach

From: "Steven Rostedt (Google)" <rostedt@goodmis.org>

With the new TAI clock, the clock source can use all 64 bits for the time
stamp. The TIME_STAMP event only saves 59 bits of the clock, it is
expected that the 5 MSBs will be extracted from the buffer page 64 bit
timestamp.

Link: https://lore.kernel.org/all/20220427153339.16c33f75@gandalf.local.home/

Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
---
 src/kbuffer-parse.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/kbuffer-parse.c b/src/kbuffer-parse.c
index 74999501f5bf..d174e7276df2 100644
--- a/src/kbuffer-parse.c
+++ b/src/kbuffer-parse.c
@@ -14,6 +14,9 @@
 
 #define COMMIT_MASK ((1 << 27) - 1)
 
+/* Absolute time stamps do not have the 5 MSB, take from the real time stamp */
+#define TS_MSB		(0xf8ULL << 56)
+
 enum {
 	KBUFFER_FL_HOST_BIG_ENDIAN	= (1<<0),
 	KBUFFER_FL_BIG_ENDIAN		= (1<<1),
@@ -347,7 +350,7 @@ static unsigned int
 translate_data(struct kbuffer *kbuf, void *data, void **rptr,
 	       unsigned long long *delta, int *length)
 {
-	unsigned long long extend;
+	unsigned long long extend, msb = 0;
 	unsigned int type_len_ts;
 	unsigned int type_len;
 
@@ -362,13 +365,15 @@ translate_data(struct kbuffer *kbuf, void *data, void **rptr,
 		*length = read_4(kbuf, data);
 		break;
 
-	case KBUFFER_TYPE_TIME_EXTEND:
 	case KBUFFER_TYPE_TIME_STAMP:
+		msb = kbuf->timestamp & TS_MSB;
+		/* fall through */
+	case KBUFFER_TYPE_TIME_EXTEND:
 		extend = read_4(kbuf, data);
 		data += 4;
 		extend <<= TS_SHIFT;
 		extend += *delta;
-		*delta = extend;
+		*delta = extend | msb;
 		*length = 0;
 		break;
 
-- 
2.35.1


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-04-27 22:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-27 22:23 [PATCH] kbuffer: Handle 64 bit timestamp event Steven Rostedt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.