lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAP-5=fWd8Mns84=XF+Osy24PKL71-E2Gy1RP4_d+V=0A4CfROw@mail.gmail.com>
Date:   Tue, 19 Jul 2022 17:44:38 -0700
From:   Ian Rogers <irogers@...gle.com>
To:     Adrian Hunter <adrian.hunter@...el.com>
Cc:     Arnaldo Carvalho de Melo <acme@...nel.org>,
        Jiri Olsa <jolsa@...hat.com>,
        Namhyung Kim <namhyung@...nel.org>,
        Andi Kleen <ak@...ux.intel.com>, linux-kernel@...r.kernel.org,
        kvm@...r.kernel.org
Subject: Re: [PATCH 19/35] perf script python: intel-pt-events: Add
 machine_pid and vcpu

On Mon, Jul 11, 2022 at 2:33 AM Adrian Hunter <adrian.hunter@...el.com> wrote:
>
> Add machine_pid and vcpu to the intel-pt-events.py script.
>
> Signed-off-by: Adrian Hunter <adrian.hunter@...el.com>

Acked-by: Ian Rogers <irogers@...gle.com>

Thanks,
Ian

> ---
>  tools/perf/scripts/python/intel-pt-events.py | 32 +++++++++++++++++---
>  1 file changed, 27 insertions(+), 5 deletions(-)
>
> diff --git a/tools/perf/scripts/python/intel-pt-events.py b/tools/perf/scripts/python/intel-pt-events.py
> index 9b7746b89381..6be7fd8fd615 100644
> --- a/tools/perf/scripts/python/intel-pt-events.py
> +++ b/tools/perf/scripts/python/intel-pt-events.py
> @@ -197,7 +197,12 @@ def common_start_str(comm, sample):
>         cpu = sample["cpu"]
>         pid = sample["pid"]
>         tid = sample["tid"]
> -       return "%16s %5u/%-5u [%03u] %9u.%09u  " % (comm, pid, tid, cpu, ts / 1000000000, ts %1000000000)
> +       if "machine_pid" in sample:
> +               machine_pid = sample["machine_pid"]
> +               vcpu = sample["vcpu"]
> +               return "VM:%5d VCPU:%03d %16s %5u/%-5u [%03u] %9u.%09u  " % (machine_pid, vcpu, comm, pid, tid, cpu, ts / 1000000000, ts %1000000000)
> +       else:
> +               return "%16s %5u/%-5u [%03u] %9u.%09u  " % (comm, pid, tid, cpu, ts / 1000000000, ts %1000000000)
>
>  def print_common_start(comm, sample, name):
>         flags_disp = get_optional_null(sample, "flags_disp")
> @@ -379,9 +384,19 @@ def process_event(param_dict):
>                 sys.exit(1)
>
>  def auxtrace_error(typ, code, cpu, pid, tid, ip, ts, msg, cpumode, *x):
> +       if len(x) >= 2 and x[0]:
> +               machine_pid = x[0]
> +               vcpu = x[1]
> +       else:
> +               machine_pid = 0
> +               vcpu = -1
>         try:
> -               print("%16s %5u/%-5u [%03u] %9u.%09u  error type %u code %u: %s ip 0x%16x" %
> -                       ("Trace error", pid, tid, cpu, ts / 1000000000, ts %1000000000, typ, code, msg, ip))
> +               if machine_pid:
> +                       print("VM:%5d VCPU:%03d %16s %5u/%-5u [%03u] %9u.%09u  error type %u code %u: %s ip 0x%16x" %
> +                               (machine_pid, vcpu, "Trace error", pid, tid, cpu, ts / 1000000000, ts %1000000000, typ, code, msg, ip))
> +               else:
> +                       print("%16s %5u/%-5u [%03u] %9u.%09u  error type %u code %u: %s ip 0x%16x" %
> +                               ("Trace error", pid, tid, cpu, ts / 1000000000, ts %1000000000, typ, code, msg, ip))
>         except broken_pipe_exception:
>                 # Stop python printing broken pipe errors and traceback
>                 sys.stdout = open(os.devnull, 'w')
> @@ -396,14 +411,21 @@ def context_switch(ts, cpu, pid, tid, np_pid, np_tid, machine_pid, out, out_pree
>                 preempt_str = "preempt"
>         else:
>                 preempt_str = ""
> +       if len(x) >= 2 and x[0]:
> +               machine_pid = x[0]
> +               vcpu = x[1]
> +       else:
> +               vcpu = None;
>         if machine_pid == -1:
>                 machine_str = ""
> -       else:
> +       elif vcpu is None:
>                 machine_str = "machine PID %d" % machine_pid
> +       else:
> +               machine_str = "machine PID %d VCPU %d" % (machine_pid, vcpu)
>         switch_str = "%16s %5d/%-5d [%03u] %9u.%09u %5d/%-5d %s %s" % \
>                 (out_str, pid, tid, cpu, ts / 1000000000, ts %1000000000, np_pid, np_tid, machine_str, preempt_str)
>         if glb_args.all_switch_events:
> -               print(switch_str);
> +               print(switch_str)
>         else:
>                 global glb_switch_str
>                 glb_switch_str[cpu] = switch_str
> --
> 2.25.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ