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:	Fri, 29 Jan 2016 18:37:43 -0200
From:	Arnaldo Carvalho de Melo <acme@...hat.com>
To:	Wang Nan <wangnan0@...wei.com>
Cc:	Alexei Starovoitov <ast@...nel.org>,
	Brendan Gregg <brendan.d.gregg@...il.com>,
	Daniel Borkmann <daniel@...earbox.net>,
	"David S. Miller" <davem@...emloft.net>,
	He Kuang <hekuang@...wei.com>, Jiri Olsa <jolsa@...nel.org>,
	Li Zefan <lizefan@...wei.com>,
	Masami Hiramatsu <masami.hiramatsu.pt@...achi.com>,
	Namhyung Kim <namhyung@...nel.org>,
	Peter Zijlstra <peterz@...radead.org>, pi3orama@....com,
	Will Deacon <will.deacon@....com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 28/54] perf record: Extract synthesize code to
 record__synthesize()

Em Mon, Jan 25, 2016 at 09:56:15AM +0000, Wang Nan escreveu:
> diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
>  
> +static int record__synthesize(struct record *rec)
> +{
> +	struct perf_session *session = rec->session;
> +	struct machine *machine = &session->machines.host;
> +	struct perf_data_file *file = &rec->file;
> +	struct record_opts *opts = &rec->opts;
> +	struct perf_tool *tool = &rec->tool;
> +	int fd = perf_data_file__fd(file);
> +	int err = 0;
> +	static bool warned_kmaps = false, warned_modules = false;

snip

> +	err = perf_event__synthesize_kernel_mmap(tool, process_synthesized_event,
> +						 machine);
> +	if (err < 0 && !warned_kmaps) {

Please use WARN_ONCE, there are lots of examples in tools/perf and in
the kernel proper, from where this idiom was adopted, this way these
static variables will be auto-created.

- Arnaldo

> +		warned_kmaps = true;
> +		pr_err("Couldn't record kernel reference relocation symbol\n"
> +		       "Symbol resolution may be skewed if relocation was used (e.g. kexec).\n"
> +		       "Check /proc/kallsyms permission or run as root.\n");
> +	}
> +
> +	err = perf_event__synthesize_modules(tool, process_synthesized_event,
> +					     machine);
> +	if (err < 0 && !warned_modules) {
> +		warned_modules = true;
> +		pr_err("Couldn't record kernel module information.\n"
> +		       "Symbol resolution may be skewed if relocation was used (e.g. kexec).\n"
> +		       "Check /proc/modules permission or run as root.\n");

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ