yeahuh / 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

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