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, 08 Nov 2013 11:11:07 +0200
From:	Adrian Hunter <adrian.hunter@...el.com>
To:	David Ahern <dsahern@...il.com>
CC:	acme@...stprotocols.net, linux-kernel@...r.kernel.org,
	Ingo Molnar <mingo@...nel.org>, Jiri Olsa <jolsa@...hat.com>
Subject: Re: [PATCH] perf tool: Round mmap pages to power 2

On 08/11/13 06:36, David Ahern wrote:
> Currently perf requires the -m / --mmap_pages option to be a power of 2.
> To be more user friendly perf should automatically round this up to the
> next power of 2.
>
> Currently:
>   $ perf record -m 3 -a -- sleep 1
>   --mmap_pages/-m value must be a power of two.sleep: Terminated
>
> With patch:
>   $ perf record -m 3 -a -- sleep 1
>   rounding mmap pages size to 16384 (4 pages)
>   ...

This prevents:

    --out-pages=0

from working e.g.

    tools/perf/perf record -vv --out-pages=0 uname
    rounding mmap pages size to 4096 (1 pages)

Although without this patch:

    tools/perf/perf record -vv --out-pages=0 uname
    --mmap_pages/-m value must be a power of two.
     usage: perf record [<options>] [<command>]
        or: perf record [<options>] -- <command> [<options>]

            --out-pages <pages>
                          Number of pages or size with units to use for
output (default 64M)

Also there is:

    tools/perf/perf record -vv --no-out-pages uname
    Segmentation fault (core dumped)



> Signed-off-by: David Ahern <dsahern@...il.com>
> Suggested-by: Ingo Molnar <mingo@...nel.org>
> Cc: Ingo Molnar <mingo@...nel.org>
> Cc: Jiri Olsa <jolsa@...hat.com>
> ---
>  tools/perf/util/evlist.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
> index b939221efd8d..9ec3a5a45f22 100644
> --- a/tools/perf/util/evlist.c
> +++ b/tools/perf/util/evlist.c
> @@ -722,11 +722,6 @@ int perf_evlist__parse_mmap_pages(const struct option *opt, const char *str,
>  	if (val != (unsigned long) -1) {
>  		/* we got file size value */
>  		pages = PERF_ALIGN(val, page_size) / page_size;
> -		if (pages < (1UL << 31) && !is_power_of_2(pages)) {
> -			pages = next_pow2(pages);
> -			pr_info("rounding mmap pages size to %lu (%lu pages)\n",
> -				pages * page_size, pages);
> -		}
>  	} else {
>  		/* we got pages count value */
>  		char *eptr;
> @@ -737,6 +732,12 @@ int perf_evlist__parse_mmap_pages(const struct option *opt, const char *str,
>  		}
>  	}
>  
> +	if (pages < (1UL << 31) && !is_power_of_2(pages)) {
> +		pages = next_pow2(pages);
> +		pr_info("rounding mmap pages size to %lu (%lu pages)\n",
> +			pages * page_size, pages);
> +	}
> +
>  	if (pages > UINT_MAX || pages > SIZE_MAX / page_size) {
>  		pr_err("--mmap_pages/-m value too big\n");
>  		return -1;

--
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