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] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 23 Dec 2013 16:37:57 -0300
From:	Arnaldo Carvalho de Melo <acme@...stprotocols.net>
To:	David Ahern <dsahern@...il.com>
Cc:	Ingo Molnar <mingo@...nel.org>, linux-kernel@...r.kernel.org,
	Stephane Eranian <eranian@...gle.com>
Subject: Re: [PATCH] perf stat: Do not show stats if workload fails

Em Fri, Dec 20, 2013 at 08:57:59AM +0100, Ingo Molnar escreveu:
> * David Ahern <dsahern@...il.com> wrote:
> 
> > Currently perf-stat attempts to show counter stats even if the workload
> > is bogus:
> > 
> > $ perf stat -- foo
> > foo: No such file or directory
> > 
> >  Performance counter stats for 'foo':
> > 
> >      <not counted>      task-clock
> >      <not counted>      context-switches
> >      <not counted>      cpu-migrations
> >      <not counted>      page-faults
> >      <not counted>      cycles
> >      <not counted>      stalled-cycles-frontend
> >      <not counted>      stalled-cycles-backend
> >      <not counted>      instructions
> >      <not counted>      branches
> >      <not counted>      branch-misses
> > 
> >        0.009769943 seconds time elapsed
> > 
> > It is impossible to differentiate all the failure modes, but it seems
> > reasonable that if the workload handling fails, perf-stat should not try
> > to print stats.
> > 
> > With this change:
> > 
> > $ perf stat  -v -- foo
> > Failed to start workload
> > 
> > Signed-off-by: David Ahern <dsahern@...il.com>
> > Cc: Ingo Molnar <mingo@...nel.org>
> > Cc: Stephane Eranian <eranian@...gle.com>
> 
> Nice!
> 
> Acked-by: Ingo Molnar <mingo@...nel.org>

Good intent, but...

[acme@...andy linux]$ perf stat usleep 1
Failed to start workload
[acme@...andy linux]$

Your patch does:

if (perf_evlist__start_workload(evsel_list) != 0)

But:

int perf_evlist__start_workload(struct perf_evlist *evlist)
{
        if (evlist->workload.cork_fd > 0) {
                char bf = 0;
                int ret;
                /*
                 * Remove the cork, let it rip!
                 */
                ret = write(evlist->workload.cork_fd, &bf, 1);
                if (ret < 0)
                        perror("enable to write to pipe");

                close(evlist->workload.cork_fd);
                return ret;
        }

        return 0;
}

Ret there is 1, so we need to change it to:

		return ret != 1 ? -1 : 0;

Right?

- Arnaldo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ