lkml.org 
[lkml]   [2013]   [Nov]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 18/22] perf tools: Add udis86 disassembler feature check
    Date
    Adding udis86 disassembler feature check which support
    is needed for kvm:kvm_emulate_insn tracepoint.

    The diff of 'perf script' output generated by old and new code:
    (data was generated by 'perf record -e kvm:kvm_emulate_insn -a')

    --- script.kvm.old
    +++ script.kvm.new
    - qemu-system-x86 15519 [003] 5332.470049: kvm:kvm_emulate_insn: 0:ffffffff8103c596:89 b7 00 80 5f ff (prot64)
    + qemu-system-x86 15519 [003] 5332.470049: kvm:kvm_emulate_insn: 0:ffffffff8103c596: mov %esi, -0xa08000(%rdi)

    Signed-off-by: Jiri Olsa <jolsa@redhat.com>
    Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
    Cc: Frederic Weisbecker <fweisbec@gmail.com>
    Cc: Ingo Molnar <mingo@elte.hu>
    Cc: Namhyung Kim <namhyung@kernel.org>
    Cc: Paul Mackerras <paulus@samba.org>
    Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
    Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
    Cc: Steven Rostedt <rostedt@goodmis.org>
    Cc: David Ahern <dsahern@gmail.com>
    ---
    tools/perf/Makefile.perf | 2 +-
    tools/perf/config/Makefile | 8 ++++++++
    tools/perf/config/feature-checks/Makefile | 6 +++++-
    tools/perf/config/feature-checks/test-all.c | 5 +++++
    tools/perf/config/feature-checks/test-udis86.c | 11 +++++++++++
    5 files changed, 30 insertions(+), 2 deletions(-)
    create mode 100644 tools/perf/config/feature-checks/test-udis86.c

    diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
    index b4f8910..d465540 100644
    --- a/tools/perf/Makefile.perf
    +++ b/tools/perf/Makefile.perf
    @@ -710,7 +710,7 @@ $(LIB_FILE): $(LIB_OBJS)
    # libtraceevent.a
    TE_SOURCES = $(wildcard $(TRACE_EVENT_DIR)*.[ch])

    -LIBTRACEEVENT_FLAGS=$(QUIET_SUBDIR1) O=$(OUTPUT) CFLAGS="-g -Wall $(EXTRA_CFLAGS)" plugin_dir=$(plugindir_SQ)
    +LIBTRACEEVENT_FLAGS=$(QUIET_SUBDIR1) O=$(OUTPUT) CFLAGS="-g -Wall $(EXTRA_CFLAGS) $(LIBTRACEEVENT_CFLAGS)" plugin_dir=$(plugindir_SQ)

    $(LIBTRACEEVENT): $(TE_SOURCES) $(OUTPUT)PERF-CFLAGS
    $(QUIET_SUBDIR0)$(TRACE_EVENT_DIR) $(LIBTRACEEVENT_FLAGS) libtraceevent.a plugins
    diff --git a/tools/perf/config/Makefile b/tools/perf/config/Makefile
    index 8c8a205..3f9c6b4 100644
    --- a/tools/perf/config/Makefile
    +++ b/tools/perf/config/Makefile
    @@ -418,6 +418,14 @@ else
    msg := $(warning No timerfd support. Disables 'perf kvm stat live');
    endif

    +$(call feature_check,udis86)
    +ifeq ($(feature-udis86), 1)
    + LIBTRACEEVENT_CFLAGS += -DHAVE_UDIS86
    + EXTLIBS += -ludis86
    +else
    + msg := $(warning No udis86 support.);
    +endif
    +
    disable-python = $(eval $(disable-python_code))
    define disable-python_code
    CFLAGS += -DNO_LIBPYTHON
    diff --git a/tools/perf/config/feature-checks/Makefile b/tools/perf/config/feature-checks/Makefile
    index 87e7900..b0df0f2 100644
    --- a/tools/perf/config/feature-checks/Makefile
    +++ b/tools/perf/config/feature-checks/Makefile
    @@ -27,7 +27,8 @@ FILES= \
    test-on-exit \
    test-stackprotector-all \
    test-stackprotector \
    - test-timerfd
    + test-timerfd \
    + test-udis86

    CC := $(CC) -MD

    @@ -144,6 +145,9 @@ test-backtrace:
    test-timerfd:
    $(BUILD)

    +test-udis86:
    + $(BUILD) -DHAVE_UDIS86 -ludis86
    +
    -include *.d

    ###############################
    diff --git a/tools/perf/config/feature-checks/test-all.c b/tools/perf/config/feature-checks/test-all.c
    index 59e7a70..0896ae0 100644
    --- a/tools/perf/config/feature-checks/test-all.c
    +++ b/tools/perf/config/feature-checks/test-all.c
    @@ -85,6 +85,10 @@
    # include "test-timerfd.c"
    #undef main

    +#define main main_test_udis86
    +# include "test-udis86.c"
    +#undef main
    +
    int main(int argc, char *argv[])
    {
    main_test_libpython();
    @@ -106,6 +110,7 @@ int main(int argc, char *argv[])
    main_test_backtrace();
    main_test_libnuma();
    main_test_timerfd();
    + main_test_udis86();

    return 0;
    }
    diff --git a/tools/perf/config/feature-checks/test-udis86.c b/tools/perf/config/feature-checks/test-udis86.c
    new file mode 100644
    index 0000000..dbc2c26
    --- /dev/null
    +++ b/tools/perf/config/feature-checks/test-udis86.c
    @@ -0,0 +1,11 @@
    +
    +/*
    + * test for udis86 functions used by plugin_kvm.c
    + */
    +
    +#include <udis86.h>
    +
    +int main(void)
    +{
    + return puts("hi");
    +}
    --
    1.8.3.1


    \
     
     \ /
      Last update: 2013-11-21 12:21    [W:4.632 / U:0.088 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site