From: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
To: Ian Rogers <irogers@google.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
Jiri Olsa <jolsa@kernel.org>,
Adrian Hunter <adrian.hunter@intel.com>,
Namhyung Kim <namhyung@kernel.org>,
LKML <linux-kernel@vger.kernel.org>,
linux-perf-users@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
akanksha@linux.ibm.com, maddy@linux.ibm.com, kjain@linux.ibm.com,
disgoel@linux.vnet.ibm.com
Subject: Re: [PATCH 1/3] tools/perf: Fix the nrcpus in perf bench futex to enable the run when all CPU's are not online
Date: Sat, 8 Jun 2024 12:36:04 +0530 [thread overview]
Message-ID: <8232BA2A-C7C5-4413-B174-6088EBF863C0@linux.vnet.ibm.com> (raw)
In-Reply-To: <CAP-5=fVCXW1FEBra5aFLJm48f0-b4a+oTugTZt+VYEv1EySBKg@mail.gmail.com>
> On 7 Jun 2024, at 10:53 PM, Ian Rogers <irogers@google.com> wrote:
>
> On Thu, Jun 6, 2024 at 9:44 PM Athira Rajeev
> <atrajeev@linux.vnet.ibm.com> wrote:
>>
>> Perf bench futex fails as below when attempted to run on
>> on a powerpc system:
>>
>> ./perf bench futex all
>> Running futex/hash benchmark...
>> Run summary [PID 626307]: 80 threads, each operating on 1024 [private] futexes for 10 secs.
>>
>> perf: pthread_create: No such file or directory
>>
>> In the setup where this perf bench was ran, difference was that
>> partition had 640 CPU's, but not all CPUs were online. 80 CPUs
>> were online. While blocking the threads with futex_wait, code
>> sets the affinity using cpumask. The cpumask size used is 80
>> which is picked from "nrcpus = perf_cpu_map__nr(cpu)". Here the
>> benchmark reports fail while setting affinity for cpu number which
>> is greater than 80 or higher, because it attempts to set a bit
>> position which is not allocated on the cpumask. Fix this by changing
>> the size of cpumask to number of possible cpus and not the number
>> of online cpus.
>>
>> Signed-off-by: Athira Rajeev <atrajeev@linux.vnet.ibm.com>
>
> For the series:
> Reviewed-by: Ian Rogers <irogers@google.com>
Hi Ian
Thanks for the review
Athira
>
> Thanks,
> Ian
>
>> ---
>> tools/perf/bench/futex-hash.c | 2 +-
>> tools/perf/bench/futex-lock-pi.c | 2 +-
>> tools/perf/bench/futex-requeue.c | 2 +-
>> tools/perf/bench/futex-wake-parallel.c | 2 +-
>> tools/perf/bench/futex-wake.c | 2 +-
>> 5 files changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/tools/perf/bench/futex-hash.c b/tools/perf/bench/futex-hash.c
>> index 0c69d20efa32..b472eded521b 100644
>> --- a/tools/perf/bench/futex-hash.c
>> +++ b/tools/perf/bench/futex-hash.c
>> @@ -174,7 +174,7 @@ int bench_futex_hash(int argc, const char **argv)
>> pthread_attr_init(&thread_attr);
>> gettimeofday(&bench__start, NULL);
>>
>> - nrcpus = perf_cpu_map__nr(cpu);
>> + nrcpus = cpu__max_cpu().cpu;
>> cpuset = CPU_ALLOC(nrcpus);
>> BUG_ON(!cpuset);
>> size = CPU_ALLOC_SIZE(nrcpus);
>> diff --git a/tools/perf/bench/futex-lock-pi.c b/tools/perf/bench/futex-lock-pi.c
>> index 7a4973346180..0416120c091b 100644
>> --- a/tools/perf/bench/futex-lock-pi.c
>> +++ b/tools/perf/bench/futex-lock-pi.c
>> @@ -122,7 +122,7 @@ static void create_threads(struct worker *w, struct perf_cpu_map *cpu)
>> {
>> cpu_set_t *cpuset;
>> unsigned int i;
>> - int nrcpus = perf_cpu_map__nr(cpu);
>> + int nrcpus = cpu__max_cpu().cpu;
>> size_t size;
>>
>> threads_starting = params.nthreads;
>> diff --git a/tools/perf/bench/futex-requeue.c b/tools/perf/bench/futex-requeue.c
>> index d9ad736c1a3e..aad5bfc4fe18 100644
>> --- a/tools/perf/bench/futex-requeue.c
>> +++ b/tools/perf/bench/futex-requeue.c
>> @@ -125,7 +125,7 @@ static void block_threads(pthread_t *w, struct perf_cpu_map *cpu)
>> {
>> cpu_set_t *cpuset;
>> unsigned int i;
>> - int nrcpus = perf_cpu_map__nr(cpu);
>> + int nrcpus = cpu__max_cpu().cpu;
>> size_t size;
>>
>> threads_starting = params.nthreads;
>> diff --git a/tools/perf/bench/futex-wake-parallel.c b/tools/perf/bench/futex-wake-parallel.c
>> index b66df553e561..90a5b91bf139 100644
>> --- a/tools/perf/bench/futex-wake-parallel.c
>> +++ b/tools/perf/bench/futex-wake-parallel.c
>> @@ -149,7 +149,7 @@ static void block_threads(pthread_t *w, struct perf_cpu_map *cpu)
>> {
>> cpu_set_t *cpuset;
>> unsigned int i;
>> - int nrcpus = perf_cpu_map__nr(cpu);
>> + int nrcpus = cpu__max_cpu().cpu;
>> size_t size;
>>
>> threads_starting = params.nthreads;
>> diff --git a/tools/perf/bench/futex-wake.c b/tools/perf/bench/futex-wake.c
>> index 690fd6d3da13..49b3c89b0b35 100644
>> --- a/tools/perf/bench/futex-wake.c
>> +++ b/tools/perf/bench/futex-wake.c
>> @@ -100,7 +100,7 @@ static void block_threads(pthread_t *w, struct perf_cpu_map *cpu)
>> cpu_set_t *cpuset;
>> unsigned int i;
>> size_t size;
>> - int nrcpus = perf_cpu_map__nr(cpu);
>> + int nrcpus = cpu__max_cpu().cpu;
>> threads_starting = params.nthreads;
>>
>> cpuset = CPU_ALLOC(nrcpus);
>> --
>> 2.43.0
next prev parent reply other threads:[~2024-06-08 7:06 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-07 4:43 [PATCH 1/3] tools/perf: Fix the nrcpus in perf bench futex to enable the run when all CPU's are not online Athira Rajeev
2024-06-07 4:43 ` [PATCH 2/3] " Athira Rajeev
2024-06-07 4:43 ` [PATCH 3/3] tools/perf: Fix timing issue with parallel threads in perf bench wake-up-parallel Athira Rajeev
2024-06-07 17:23 ` [PATCH 1/3] tools/perf: Fix the nrcpus in perf bench futex to enable the run when all CPU's are not online Ian Rogers
2024-06-08 7:06 ` Athira Rajeev [this message]
2024-06-10 14:22 ` Disha Goel
2024-06-12 12:11 ` Athira Rajeev
2024-06-14 13:45 ` Namhyung Kim
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=8232BA2A-C7C5-4413-B174-6088EBF863C0@linux.vnet.ibm.com \
--to=atrajeev@linux.vnet.ibm.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=akanksha@linux.ibm.com \
--cc=disgoel@linux.vnet.ibm.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=kjain@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=namhyung@kernel.org \
/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 NNTP newsgroup(s).