Linux-perf-users Archive mirror
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: He Zhe <zhe.he@windriver.com>
Cc: namhyung@kernel.org, mark.rutland@arm.com,
	alexander.shishkin@linux.intel.com, jolsa@kernel.org,
	irogers@google.com, adrian.hunter@intel.com,
	linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] perf bench: Fix trap divide error of perf bench internals inject-build-id
Date: Tue, 7 May 2024 12:41:12 -0300	[thread overview]
Message-ID: <ZjpLmBvW0LqZET3U@x1> (raw)
In-Reply-To: <20240507065026.2652929-1-zhe.he@windriver.com>

On Tue, May 07, 2024 at 02:50:26PM +0800, He Zhe wrote:
> perf bench internals inject-build-id suffers from the following error when
> only one DSO is collected.
> 
> perf bench internals inject-build-id -v
>   Collected 1 DSOs
> traps: internals-injec[2305] trap divide error
> ip:557566ba6394 sp:7ffd4de97fe0 error:0 in perf[557566b2a000+23d000]
>   Build-id injection benchmark
>   Iteration #1
> Floating point exception
> 
> This patch removes the unnecessary minus one from the divisor which also
> corrects the randomization range.

Thanks, applied to perf-tools-next, and added:

Fixes: 0bf02a0d80427f26 ("perf bench: Add build-id injection benchmark")

To make sure this ends up being picked by the stable guys and
backporters.

- Arnaldo
 
> Signed-off-by: He Zhe <zhe.he@windriver.com>
> ---
>  tools/perf/bench/inject-buildid.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/perf/bench/inject-buildid.c b/tools/perf/bench/inject-buildid.c
> index 49331743c743..a759eb2328be 100644
> --- a/tools/perf/bench/inject-buildid.c
> +++ b/tools/perf/bench/inject-buildid.c
> @@ -362,7 +362,7 @@ static int inject_build_id(struct bench_data *data, u64 *max_rss)
>  		return -1;
>  
>  	for (i = 0; i < nr_mmaps; i++) {
> -		int idx = rand() % (nr_dsos - 1);
> +		int idx = rand() % nr_dsos;
>  		struct bench_dso *dso = &dsos[idx];
>  		u64 timestamp = rand() % 1000000;
>  
> -- 
> 2.25.1
> 

      reply	other threads:[~2024-05-07 15:41 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-07  6:50 [PATCH] perf bench: Fix trap divide error of perf bench internals inject-build-id He Zhe
2024-05-07 15:41 ` Arnaldo Carvalho de Melo [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZjpLmBvW0LqZET3U@x1 \
    --to=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=irogers@google.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=namhyung@kernel.org \
    --cc=zhe.he@windriver.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).