From 002f410771e49dbfe738a2c31a231b5e0ca97b38 Mon Sep 17 00:00:00 2001
From: Stefan Hajnoczi <stefanha@redhat.com>
Date: Tue, 7 Oct 2014 14:06:50 +0200
Subject: [PATCH 32/43] trace: use unique Red Hat version number in simpletrace
Message-id: <1412690820-31016-2-git-send-email-stefanha@redhat.com>
Patchwork-id: 61606
O-Subject: [RHEL7.1 qemu-kvm PATCH 01/11] trace: use unique Red Hat version number in simpletrace
Bugzilla: 1088112
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
The simpletrace format has changed upstream several times. RHEL7
qemu-kvm is currently at version 2 level, but now we need to add the pid
field. This means we need to bump the version number.
Upstream version 3 changed the way that trace event IDs are calculated.
Those tracetool changes are not downstream.
Avoid colliding with upstream version numbers - just in case binary
trace files from upstream and RHEL are exchanged. Use a unique part of
the 64-bit version number namespace (based on Red Hat's PCI vendor ID).
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
scripts/simpletrace.py | 11 ++++++-----
trace/simple.c | 2 +-
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/scripts/simpletrace.py b/scripts/simpletrace.py
index 8bbcb42..3cb2cf0 100755
--- a/scripts/simpletrace.py
+++ b/scripts/simpletrace.py
@@ -18,6 +18,7 @@ from tracetool.backend.simple import is_string
header_event_id = 0xffffffffffffffff
header_magic = 0xf2b177cb0aa429b4
dropped_event_id = 0xfffffffffffffffe
+red_hat_version = 0x00001af400000000
log_header_fmt = '=QQQ'
rec_header_fmt = '=QQII'
@@ -65,13 +66,13 @@ def read_trace_file(edict, fobj):
header[0] != header_event_id or \
header[1] != header_magic:
raise ValueError('Not a valid trace file!')
- if header[2] != 0 and \
- header[2] != 2:
- raise ValueError('Unknown version of tracelog format!')
log_version = header[2]
- if log_version == 0:
- raise ValueError('Older log format, not supported with this QEMU release!')
+ if log_version not in [0, 2, 3, red_hat_version]:
+ raise ValueError('Unknown version of tracelog format!')
+ if log_version != red_hat_version:
+ raise ValueError('Log format %d not supported with this QEMU release!'
+ % log_version)
while True:
rec = read_record(edict, fobj)
diff --git a/trace/simple.c b/trace/simple.c
index 1e3f691..64e196a 100644
--- a/trace/simple.c
+++ b/trace/simple.c
@@ -27,7 +27,7 @@
#define HEADER_MAGIC 0xf2b177cb0aa429b4ULL
/** Trace file version number, bump if format changes */
-#define HEADER_VERSION 2
+#define HEADER_VERSION 0x00001af400000000ULL
/** Records were dropped event ID */
#define DROPPED_EVENT_ID (~(uint64_t)0 - 1)
--
1.8.3.1