cryptospore / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-trace-use-unique-Red-Hat-version-number-in-simpletra.patch

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