]> err.no Git - linux-2.6/blobdiff - virt/kvm/kvm_trace.c
hwmon-vid: Fix AMD K8 VID decoding
[linux-2.6] / virt / kvm / kvm_trace.c
index 5425440c54bffb9d8fff30cae8ac5d276dd9279e..58141f31ea8fb218f8091b16f192857615ad66b6 100644 (file)
@@ -72,11 +72,7 @@ static void kvm_add_trace(void *probe_private, void *call_data,
        rec.cycle_in    = p->cycle_in;
 
        if (rec.cycle_in) {
-               u64 cycle = 0;
-
-               cycle = get_cycles();
-               rec.u.cycle.cycle_lo = (u32)cycle;
-               rec.u.cycle.cycle_hi = (u32)(cycle >> 32);
+               rec.u.cycle.cycle_u64 = get_cycles();
 
                for (i = 0; i < rec.extra_u32; i++)
                        rec.u.cycle.extra_u32[i] = va_arg(*args, u32);
@@ -114,8 +110,18 @@ static int kvm_subbuf_start_callback(struct rchan_buf *buf, void *subbuf,
 {
        struct kvm_trace *kt;
 
-       if (!relay_buf_full(buf))
+       if (!relay_buf_full(buf)) {
+               if (!prev_subbuf) {
+                       /*
+                        * executed only once when the channel is opened
+                        * save metadata as first record
+                        */
+                       subbuf_start_reserve(buf, sizeof(u32));
+                       *(u32 *)subbuf = 0x12345678;
+               }
+
                return 1;
+       }
 
        kt = buf->chan->private_data;
        atomic_inc(&kt->lost_records);
@@ -159,12 +165,12 @@ static int do_kvm_trace_enable(struct kvm_user_trace_setup *kuts)
 
        r = -EIO;
        atomic_set(&kt->lost_records, 0);
-       kt->lost_file = debugfs_create_file("lost_records", 0444, debugfs_dir,
+       kt->lost_file = debugfs_create_file("lost_records", 0444, kvm_debugfs_dir,
                                            kt, &kvm_trace_lost_ops);
        if (!kt->lost_file)
                goto err;
 
-       kt->rchan = relay_open("trace", debugfs_dir, kuts->buf_size,
+       kt->rchan = relay_open("trace", kvm_debugfs_dir, kuts->buf_size,
                                kuts->buf_nr, &kvm_relay_callbacks, kt);
        if (!kt->rchan)
                goto err;