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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Mon, 24 Jul 2023 11:50:06 +0800
From:   Changbin Du <changbin.du@...wei.com>
To:     Ian Rogers <irogers@...gle.com>
CC:     Changbin Du <changbin.du@...wei.com>,
        Adrian Hunter <adrian.hunter@...el.com>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...hat.com>,
        Arnaldo Carvalho de Melo <acme@...nel.org>,
        Mark Rutland <mark.rutland@....com>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Jiri Olsa <jolsa@...nel.org>,
        Namhyung Kim <namhyung@...nel.org>,
        <linux-perf-users@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] perf: add new option '--workload-attr' to set workload
 sched_policy/priority/mask

On Wed, Jul 19, 2023 at 09:55:39AM -0700, Ian Rogers wrote:
> On Fri, Jul 14, 2023 at 12:19 AM Changbin Du <changbin.du@...wei.com> wrote:
> >
> > On Fri, Jul 14, 2023 at 10:06:31AM +0300, Adrian Hunter wrote:
> > > On 13/07/23 11:58, Changbin Du wrote:
> > > > To get consistent benchmarking results, sometimes we need to set the
> > > > sched_policy/priority/mask of the workload to reduce system noise.
> > > >
> > > > For example, CPU binding is required on big.little system.
> > > >
> > > >   $ perf stat -r 10 -- taskset -c 0 ls
> > > >
> > > > Nevertheless, the 'taskset' is also counted here.
> > > >
> > > > To get away of the middleman, this adds a new option '--workload-attr' to
> > > > do the same jobs for stat and record commands.
> > > >
> > > >   $ sudo perf stat --workload-attr fifo,40,0x1 -- ls
> > > >
> > > > Above will make 'ls' run on CPU #0 with fifo scheduler and realtime
> > > > priority is 40.
> > >
> > > Aren't there ways to set up a process then start perf using -p <pid>
> > > then let the process continue.
> > >
> > By that you need a mechanism to pause the new spawnned process and wait perf to
> > attach. Or setup the sched properties by the app itself. But sometimes we just
> > simply want to run the app through and measure some events. With
> > --workload-attr, we do not need extra setup works.
> 
> To my naive eyes this looks to be a broadly useful addition. Some thoughts:
>  - "cpu-mask" as the command line argument name, this is "-C" and
> "--cpu" elsewhere, so perhaps just "cpu" as the mask is perhaps
> confusing.
I changed the name of third field to cpu-list, and use perf_cpu_map_new() to
parse the list. This api doesn't accept a mask.

        --workload-attr <sched_policy[,priority][,cpu-list]>
                          setup target workload (the <command>) attributes:

                                sched_policy: other|fifo|rr|batch|idle
                                priority: scheduling priority for fifo|rr, nice value for other
                                cpu-list: CPU affinity. e.g. 1-2:4 is processors #1, #2, and #4

>  - could we get a test? Perhaps add a case to tools/perf/tests/shell/stat.sh:
> https://git.kernel.org/pub/scm/linux/kernel/git/perf/perf-tools-next.git/tree/tools/perf/tests/shell/stat.sh?h=perf-tools-next
> 
No problem, I will add a testcase there.

> Thanks,
> Ian
> 
> > --
> > Cheers,
> > Changbin Du

-- 
Cheers,
Changbin Du

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ