<html dir="ltr"><head></head><body style="text-align:left; direction:ltr;"><div><br></div><div><br></div><div>-----Original Message-----</div><div><b>From</b>: Athira Rajeev <<a href="mailto:Athira%20Rajeev%20%3catrajeev@linux.vnet.ibm.com%3e">atrajeev@linux.vnet.ibm.com</a>></div><div><b>To</b>: <a href="mailto:acme@kernel.org">acme@kernel.org</a>, <a href="mailto:jolsa@kernel.org">jolsa@kernel.org</a>, <a href="mailto:disgoel@linux.vnet.ibm.com">disgoel@linux.vnet.ibm.com</a></div><div><b>Cc</b>: <a href="mailto:mpe@ellerman.id.au">mpe@ellerman.id.au</a>, <a href="mailto:linux-perf-users@vger.kernel.org">linux-perf-users@vger.kernel.org</a>, <a href="mailto:linuxppc-dev@lists.ozlabs.org">linuxppc-dev@lists.ozlabs.org</a>, <a href="mailto:maddy@linux.vnet.ibm.com">maddy@linux.vnet.ibm.com</a>, <a href="mailto:rnsastry@linux.ibm.com">rnsastry@linux.ibm.com</a>, <a href="mailto:kjain@linux.ibm.com">kjain@linux.ibm.com</a></div><div><b>Subject</b>: [PATCH 0/4] tools/perf: Fix perf bench numa, futex and epoll to work with machines having #CPUs > 1K</div><div><b>Date</b>: Sat,  2 Apr 2022 00:28:49 +0530</div><div><br></div><pre>The perf benchmark for collections: numa, futex and epoll</pre><pre>hits failure in system configuration with CPU's more than 1024.</pre><pre>These benchmarks uses "sched_getaffinity" and "sched_setaffinity"</pre><pre>in the code to work with affinity.</pre><pre><br></pre><pre>Example snippet from numa benchmark:</pre><pre><<>></pre><pre>perf: bench/numa.c:302: bind_to_node: Assertion `!(ret)' failed.</pre><pre>Aborted (core dumped)</pre><pre><<>></pre><pre><br></pre><pre>bind_to_node function uses "sched_getaffinity" to save the cpumask.</pre><pre>This fails with EINVAL because the default mask size in glibc is 1024.</pre><pre><br></pre><pre>Similarly in futex and epoll benchmark, uses sched_setaffinity during</pre><pre>pthread_create with affinity. And since it returns EINVAL in such system</pre><pre>configuration, benchmark doesn't run.</pre><pre><br></pre><pre>To overcome this 1024 CPUs mask size limitation of cpu_set_t,</pre><pre>change the mask size using the CPU_*_S macros ie, use CPU_ALLOC to</pre><pre>allocate cpumask, CPU_ALLOC_SIZE for size, CPU_SET_S to set mask bit.</pre><pre><br></pre><pre>Fix all the relevant places in the code to use mask size which is large</pre><pre>enough to represent number of possible CPU's in the system.</pre><pre><br></pre><pre>Fix parse_setup_cpu_list function in numa bench to check if input CPU</pre><pre>is online before binding task to that CPU. This is to fix failures where,</pre><pre>though CPU number is within max CPU, it could happen that CPU is offline.</pre><pre>Here, sched_setaffinity will result in failure when using cpumask having</pre><pre>that cpu bit set in the mask.</pre><pre><br></pre><pre>Patch 1 and Patch 2 address fix for perf bench futex and perf bench</pre><pre>epoll benchmark. Patch 3 and Patch 4 address fix in perf bench numa</pre><pre>benchmark</pre><pre><br></pre><pre>Athira Rajeev (4):</pre><pre>  tools/perf: Fix perf bench futex to correct usage of affinity for</pre><pre>    machines with #CPUs > 1K</pre><pre>  tools/perf: Fix perf bench epoll to correct usage of affinity for</pre><pre>    machines with #CPUs > 1K</pre><pre>  tools/perf: Fix perf numa bench to fix usage of affinity for machines</pre><pre>    with #CPUs > 1K</pre><pre>  tools/perf: Fix perf bench numa testcase to check if CPU used to bind</pre><pre>    task is online</pre><pre><br></pre><pre>Tesed the patches on powerpc with CPU > 1K and other configurations as well, verified the perf benchmark numa, futex and epoll for whole series with the patch set.</pre><pre>Tested-by: Disha Goel <<a href="mailto:disgoel@linux.vnet.ibm.com">disgoel@linux.vnet.ibm.com</a>></pre><pre><span class="c-message__edited_label" dir="ltr" delay="300" data-sk="tooltip_parent" aria-describedby="sk-tooltip-7876" style="box-sizing: inherit; cursor: default; font-size: 13px; white-space: nowrap; color: rgba(var(--sk_foreground_high_solid,134,134,134),1); font-family: Slack-Lato, Slack-Fractions, appleLogo, sans-serif; font-variant-ligatures: common-ligatures; orphans: 2; widows: 2; background-color: rgb(248, 248, 248); text-decoration-thickness: initial;"><br></span></pre><pre> tools/perf/bench/epoll-ctl.c           |  25 ++++--</pre><pre> tools/perf/bench/epoll-wait.c          |  25 ++++--</pre><pre> tools/perf/bench/futex-hash.c          |  26 ++++--</pre><pre> tools/perf/bench/futex-lock-pi.c       |  21 +++--</pre><pre> tools/perf/bench/futex-requeue.c       |  21 +++--</pre><pre> tools/perf/bench/futex-wake-parallel.c |  21 +++--</pre><pre> tools/perf/bench/futex-wake.c          |  22 +++--</pre><pre> tools/perf/bench/numa.c                | 117 ++++++++++++++++++-------</pre><pre> tools/perf/util/header.c               |  43 +++++++++</pre><pre> tools/perf/util/header.h               |   1 +</pre><pre> 10 files changed, 252 insertions(+), 70 deletions(-)</pre><pre><br></pre></body></html>