qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] ed8650: trace: ensure .stp files are rebuilt


From: GitHub
Subject: [Qemu-commits] [qemu/qemu] ed8650: trace: ensure .stp files are rebuilt if trace tool...
Date: Tue, 01 Aug 2017 07:31:03 -0700

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: ed8650586fed350e46a39d39eacec02a7f7ecc08
      
https://github.com/qemu/qemu/commit/ed8650586fed350e46a39d39eacec02a7f7ecc08
  Author: Daniel P. Berrange <address@hidden>
  Date:   2017-08-01 (Tue, 01 Aug 2017)

  Changed paths:
    M Makefile.target

  Log Message:
  -----------
  trace: ensure .stp files are rebuilt if trace tool source changes

The make rules for generating the .stp files forgot to add a dep
on $(tracetool-y) to trigger a rebuild if the trace tool source
changes.

Signed-off-by: Daniel P. Berrange <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>


  Commit: ea1ff54f7d2d7ac32be3c54bd171481bc2354721
      
https://github.com/qemu/qemu/commit/ea1ff54f7d2d7ac32be3c54bd171481bc2354721
  Author: Daniel P. Berrange <address@hidden>
  Date:   2017-08-01 (Tue, 01 Aug 2017)

  Changed paths:
    M scripts/tracetool/format/simpletrace_stap.py

  Log Message:
  -----------
  trace: ensure unique function / variable names per .stp file

The simpletrace compatibility code for systemtap creates a
function and some global variables for mapping to event ID
numbers. We generate multiple -simpletrace.stp files though,
one per target and systemtap considers functions & variables
to be globally scoped, not per file. So if trying to use the
simpletrace compat probes, systemtap will complain:

 # stap -e 'probe qemu.system.arm.simpletrace.visit_type_str { print( "hello")}'
 semantic error: conflicting global variables: identifier 
'event_name_to_id_map' at 
/usr/share/systemtap/tapset/qemu-aarch64-simpletrace.stp:3:8
  source: global event_name_to_id_map
                 ^
 identifier 'event_name_to_id_map' at 
/usr/share/systemtap/tapset/qemu-system-arm-simpletrace.stp:3:8
  source: global event_name_to_id_map
                 ^

 WARNING: cross-file global variable reference to identifier 
'event_name_to_id_map' at 
/usr/share/systemtap/tapset/qemu-system-arm-simpletrace.stp:3:8 from: 
identifier 'event_name_to_id_map' at 
/usr/share/systemtap/tapset/qemu-aarch64-simpletrace.stp:8:21
 source:     if (!([name] in event_name_to_id_map)) {
                       ^
 WARNING: cross-file global variable reference to identifier 'event_next_id' at 
/usr/share/systemtap/tapset/qemu-system-arm-simpletrace.stp:4:8 from: 
identifier 'event_next_id' at :9:38
 source:         event_name_to_id_map[name] = event_next_id
                                        ^

We already have a string used to prefix probe names, so just
replace '.' with '_' to get a function / variable name prefix

Signed-off-by: Daniel P. Berrange <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>


  Commit: 3932ef3ffb54baf22ab05767e827bda1834d20df
      
https://github.com/qemu/qemu/commit/3932ef3ffb54baf22ab05767e827bda1834d20df
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2017-08-01 (Tue, 01 Aug 2017)

  Changed paths:
    M scripts/tracetool/__init__.py
    M scripts/tracetool/backend/__init__.py
    M scripts/tracetool/backend/dtrace.py
    M scripts/tracetool/backend/ftrace.py
    M scripts/tracetool/backend/log.py
    M scripts/tracetool/backend/simple.py
    M scripts/tracetool/backend/syslog.py
    M scripts/tracetool/backend/ust.py
    M scripts/tracetool/format/h.py

  Log Message:
  -----------
  trace: add TRACE_<event>_BACKEND_DSTATE()

QEMU keeps track of trace event enabled/disabled state and provides
monitor commands to inspect and modify the "dstate".  SystemTap and
LTTng UST maintain independent enabled/disabled states for each trace
event, the other backends rely on QEMU dstate.

Introduce a new per-event macro that combines backend-specific dstate
like this:

  #define TRACE_MY_EVENT_BACKEND_DSTATE() ( \
      QEMU_MY_EVENT_ENABLED() || /* SystemTap */ \
      tracepoint_enabled(qemu, my_event) /* LTTng UST */ || \
      false)

This will be used to extend trace_event_get_state() in the next patch.

[Daniel Berrange pointed out that QEMU_MY_EVENT_ENABLED() must be true
by default, not false.  This way events will fire even if the DTrace
implementation does not implement the SystemTap semaphores feature.

Ubuntu Precise uses lttng-ust-dev 2.0.2 which does not have
tracepoint_enabled(), so we need a compatibility wrapper to keep Travis
builds passing.
--Stefan]

Signed-off-by: Stefan Hajnoczi <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>

fixup! trace: add TRACE_<event>_BACKEND_DSTATE()


  Commit: d87aa138039a4be6d705793fd3e397c69c52405a
      
https://github.com/qemu/qemu/commit/d87aa138039a4be6d705793fd3e397c69c52405a
  Author: Stefan Hajnoczi <address@hidden>
  Date:   2017-08-01 (Tue, 01 Aug 2017)

  Changed paths:
    M docs/devel/tracing.txt
    M hw/usb/hcd-ohci.c
    M net/colo-compare.c
    M net/filter-rewriter.c
    M trace/control.h

  Log Message:
  -----------
  trace: add trace_event_get_state_backends()

Code that checks dstate is unaware of SystemTap and LTTng UST dstate, so
the following trace event will not fire when solely enabled by SystemTap
or LTTng UST:

  if (trace_event_get_state(TRACE_MY_EVENT)) {
      str = g_strdup_printf("Expensive string to generate ...",
                      ...);
      trace_my_event(str);
      g_free(str);
  }

Add trace_event_get_state_backends() to fetch backend dstate.  Those
backends that use QEMU dstate fetch it as part of
generate_h_backend_dstate().

Update existing trace_event_get_state() callers to use
trace_event_get_state_backends() instead.

Signed-off-by: Stefan Hajnoczi <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>


  Commit: 44c6d6387b6a80ee1645b1b5cd5e2749f5596ca7
      
https://github.com/qemu/qemu/commit/44c6d6387b6a80ee1645b1b5cd5e2749f5596ca7
  Author: Vladimir Sementsov-Ogievskiy <address@hidden>
  Date:   2017-08-01 (Tue, 01 Aug 2017)

  Changed paths:
    M CODING_STYLE

  Log Message:
  -----------
  coding_style: add point about 0x in trace-events

Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>


  Commit: db73ee4bc8861f9f6772e0d24f978d79e50e8dee
      
https://github.com/qemu/qemu/commit/db73ee4bc8861f9f6772e0d24f978d79e50e8dee
  Author: Vladimir Sementsov-Ogievskiy <address@hidden>
  Date:   2017-08-01 (Tue, 01 Aug 2017)

  Changed paths:
    M audio/trace-events
    M block/trace-events
    M hw/display/trace-events
    M hw/i386/xen/trace-events
    M hw/input/trace-events
    M hw/intc/trace-events
    M hw/net/trace-events
    M hw/pci/trace-events
    M hw/scsi/trace-events
    M hw/xen/trace-events
    M trace-events

  Log Message:
  -----------
  trace-events: fix code style: %# -> 0x%

In trace format '#' flag of printf is forbidden. Fix it to '0x%'.

This patch is created by the following:

check that we have a problem
> find . -name trace-events | xargs grep '%#' | wc -l
56

check that there are no cases with additional printf flags before '#'
> find . -name trace-events | xargs grep "%[-+ 0'I]+#" | wc -l
0

check that there are no wrong usage of '#' and '0x' together
> find . -name trace-events | xargs grep '0x%#' | wc -l
0

fix the problem
> find . -name trace-events | xargs sed -i 's/%#/0x%/g'

[Eric Blake noted that xargs grep '%[-+ 0'I]+#' should be xargs grep
"%[-+ 0'I]+#" instead so the shell quoting is correct.
--Stefan]

Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>


  Commit: c3e5875afc0f93315470dfa5f31251fb9546c267
      
https://github.com/qemu/qemu/commit/c3e5875afc0f93315470dfa5f31251fb9546c267
  Author: Vladimir Sementsov-Ogievskiy <address@hidden>
  Date:   2017-08-01 (Tue, 01 Aug 2017)

  Changed paths:
    M scripts/checkpatch.pl

  Log Message:
  -----------
  checkpatch: check trace-events code style

According to CODING_STYLE, check that in trace-events:
1. hex numbers are prefixed with '0x'
2. '#' flag of printf is not used
3. The exclusion from 1. are period-separated groups of numbers

Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>


  Commit: 8908eb1a4aaf6b6573de3c44dfdaac6049061c02
      
https://github.com/qemu/qemu/commit/8908eb1a4aaf6b6573de3c44dfdaac6049061c02
  Author: Vladimir Sementsov-Ogievskiy <address@hidden>
  Date:   2017-08-01 (Tue, 01 Aug 2017)

  Changed paths:
    M accel/tcg/trace-events
    M block/trace-events
    M hw/audio/trace-events
    M hw/char/trace-events
    M hw/display/trace-events
    M hw/dma/trace-events
    M hw/i386/xen/trace-events
    M hw/input/trace-events
    M hw/intc/trace-events
    M hw/isa/trace-events
    M hw/misc/trace-events
    M hw/net/trace-events
    M hw/nvram/trace-events
    M hw/ppc/trace-events
    M hw/s390x/trace-events
    M hw/scsi/trace-events
    M hw/sd/trace-events
    M hw/timer/trace-events
    M hw/usb/trace-events
    M hw/vfio/trace-events
    M hw/virtio/trace-events
    M linux-user/trace-events
    M migration/trace-events
    M nbd/trace-events
    M net/trace-events
    M target/arm/trace-events
    M target/s390x/trace-events
    M target/sparc/trace-events

  Log Message:
  -----------
  trace-events: fix code style: print 0x before hex numbers

The only exception are groups of numers separated by symbols
'.', ' ', ':', '/', like 'ab.09.7d'.

This patch is made by the following:

> find . -name trace-events | xargs python script.py

where script.py is the following python script:
=========================
 #!/usr/bin/env python

import sys
import re
import fileinput

rhex = '%[-+ *.0-9]*(?:[hljztL]|ll|hh)?(?:x|X|"\s*PRI[xX][^"]*"?)'
rgroup = re.compile('((?:' + rhex + '[.:/ ])+' + rhex + ')')
rbad = re.compile('(?<!0x)' + rhex)

files = sys.argv[1:]

for fname in files:
    for line in fileinput.input(fname, inplace=True):
  arr = re.split(rgroup, line)
  for i in range(0, len(arr), 2):
      arr[i] = re.sub(rbad, '0x\g<0>', arr[i])
   sys.stdout.write(''.join(arr))
=========================

Signed-off-by: Vladimir Sementsov-Ogievskiy <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Acked-by: Cornelia Huck <address@hidden>
Message-id: address@hidden
Signed-off-by: Stefan Hajnoczi <address@hidden>


  Commit: bd6952a391b6f2083d6597386f457f30044e32a3
      
https://github.com/qemu/qemu/commit/bd6952a391b6f2083d6597386f457f30044e32a3
  Author: Denis V. Lunev <address@hidden>
  Date:   2017-08-01 (Tue, 01 Aug 2017)

  Changed paths:
    M monitor.c

  Log Message:
  -----------
  monitor: Reduce handle_qmp_command() tracing overhead

We are malloc'ing a QString and spending CPU cycles on converting a
QObject to string, just for the sake of sticking the string in the trace
message.  Wasted when we aren't tracing.  Avoid that.

[Commit message and description suggested by Markus Armbruster to
provide more detail about the rationale for this patch.

Use trace_event_get_state_backends() instead of trace_event_get_state()
to honor DTrace/UST backend dstates.
--Stefan]

Signed-off-by: Denis V. Lunev <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Message-id: address@hidden
CC: Stefan Hajnoczi <address@hidden>
CC: LluĂ­s Vilanova <address@hidden>
CC: Dr. David Alan Gilbert <address@hidden>
CC: Markus Armbruster <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>


  Commit: 7d48cf8102a10e4a54333811bafb5eb566509268
      
https://github.com/qemu/qemu/commit/7d48cf8102a10e4a54333811bafb5eb566509268
  Author: Peter Maydell <address@hidden>
  Date:   2017-08-01 (Tue, 01 Aug 2017)

  Changed paths:
    M CODING_STYLE
    M Makefile.target
    M accel/tcg/trace-events
    M audio/trace-events
    M block/trace-events
    M docs/devel/tracing.txt
    M hw/audio/trace-events
    M hw/char/trace-events
    M hw/display/trace-events
    M hw/dma/trace-events
    M hw/i386/xen/trace-events
    M hw/input/trace-events
    M hw/intc/trace-events
    M hw/isa/trace-events
    M hw/misc/trace-events
    M hw/net/trace-events
    M hw/nvram/trace-events
    M hw/pci/trace-events
    M hw/ppc/trace-events
    M hw/s390x/trace-events
    M hw/scsi/trace-events
    M hw/sd/trace-events
    M hw/timer/trace-events
    M hw/usb/hcd-ohci.c
    M hw/usb/trace-events
    M hw/vfio/trace-events
    M hw/virtio/trace-events
    M hw/xen/trace-events
    M linux-user/trace-events
    M migration/trace-events
    M monitor.c
    M nbd/trace-events
    M net/colo-compare.c
    M net/filter-rewriter.c
    M net/trace-events
    M scripts/checkpatch.pl
    M scripts/tracetool/__init__.py
    M scripts/tracetool/backend/__init__.py
    M scripts/tracetool/backend/dtrace.py
    M scripts/tracetool/backend/ftrace.py
    M scripts/tracetool/backend/log.py
    M scripts/tracetool/backend/simple.py
    M scripts/tracetool/backend/syslog.py
    M scripts/tracetool/backend/ust.py
    M scripts/tracetool/format/h.py
    M scripts/tracetool/format/simpletrace_stap.py
    M target/arm/trace-events
    M target/s390x/trace-events
    M target/sparc/trace-events
    M trace-events
    M trace/control.h

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/stefanha/tags/tracing-pull-request' 
into staging

Pull request

Fixes for inconsistencies in the trace event format strings, broken
trace_event_get_state() usage, and handle_qmp_command() fix.

# gpg: Signature made Tue 01 Aug 2017 14:16:05 BST
# gpg:                using RSA key 0x9CA4ABB381AB73C8
# gpg: Good signature from "Stefan Hajnoczi <address@hidden>"
# gpg:                 aka "Stefan Hajnoczi <address@hidden>"
# Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35  775A 9CA4 ABB3 81AB 73C8

* remotes/stefanha/tags/tracing-pull-request:
  monitor: Reduce handle_qmp_command() tracing overhead
  trace-events: fix code style: print 0x before hex numbers
  checkpatch: check trace-events code style
  trace-events: fix code style: %# -> 0x%
  coding_style: add point about 0x in trace-events
  trace: add trace_event_get_state_backends()
  trace: add TRACE_<event>_BACKEND_DSTATE()
  trace: ensure unique function / variable names per .stp file
  trace: ensure .stp files are rebuilt if trace tool source changes

Signed-off-by: Peter Maydell <address@hidden>


Compare: https://github.com/qemu/qemu/compare/5619c179057e...7d48cf8102a1

reply via email to

[Prev in Thread] Current Thread [Next in Thread]