[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aIr2ZdxmuBoCmDhw@google.com>
Date: Wed, 30 Jul 2025 21:51:49 -0700
From: Namhyung Kim <namhyung@...nel.org>
To: Yuzhuo Jing <yuzhuo@...gle.com>
Cc: Peter Zijlstra <peterz@...radead.org>, Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...nel.org>, Ian Rogers <irogers@...gle.com>,
Adrian Hunter <adrian.hunter@...el.com>,
Liang Kan <kan.liang@...ux.intel.com>, Yuzhuo Jing <yzj@...ch.edu>,
Andrea Parri <parri.andrea@...il.com>,
Palmer Dabbelt <palmer@...osinc.com>,
Charlie Jenkins <charlie@...osinc.com>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
Kumar Kartikeya Dwivedi <memxor@...il.com>,
Alexei Starovoitov <ast@...nel.org>,
Barret Rhoden <brho@...gle.com>,
Alexandre Ghiti <alexghiti@...osinc.com>,
Guo Ren <guoren@...nel.org>, linux-kernel@...r.kernel.org,
linux-perf-users@...r.kernel.org
Subject: Re: [PATCH v1 0/7] perf bench: Add qspinlock benchmark
Hello,
On Mon, Jul 28, 2025 at 07:26:33PM -0700, Yuzhuo Jing wrote:
> As an effort to improve the perf bench subcommand, this patch series
> adds benchmark for the kernel's queued spinlock implementation.
>
> This series imports necessary kernel definitions such as atomics,
> introduces userspace per-cpu adapter, and imports the qspinlock
> implementation from the kernel tree to tools tree, with minimum
> adaptions.
But I'm curious how you handled difference in kernel vs. user space.
For example, normally kernel spinlocks imply no preemption but we cannot
guarantee that in userspace.
>
> This subcommand enables convenient commands to investigate the
> performance of kernel lock implementations, such as using sampling:
>
> perf record -- ./perf bench sync qspinlock -t5
> perf report
It'd be nice if you can share an example output of the change.
Thanks,
Namhyung
>
> Yuzhuo Jing (7):
> tools: Import cmpxchg and xchg functions
> tools: Import smp_cond_load and atomic_cond_read
> tools: Partial import of prefetch.h
> tools: Implement userspace per-cpu
> perf bench: Import qspinlock from kernel
> perf bench: Add 'bench sync qspinlock' subcommand
> perf bench sync: Add latency histogram functionality
>
> tools/arch/x86/include/asm/atomic.h | 14 +
> tools/arch/x86/include/asm/cmpxchg.h | 113 +++++
> tools/include/asm-generic/atomic-gcc.h | 47 ++
> tools/include/asm/barrier.h | 58 +++
> tools/include/linux/atomic.h | 27 ++
> tools/include/linux/compiler_types.h | 30 ++
> tools/include/linux/percpu-simulate.h | 128 ++++++
> tools/include/linux/prefetch.h | 41 ++
> tools/perf/bench/Build | 2 +
> tools/perf/bench/bench.h | 1 +
> .../perf/bench/include/mcs_spinlock-private.h | 115 +++++
> tools/perf/bench/include/mcs_spinlock.h | 19 +
> tools/perf/bench/include/qspinlock-private.h | 204 +++++++++
> tools/perf/bench/include/qspinlock.h | 153 +++++++
> tools/perf/bench/include/qspinlock_types.h | 98 +++++
> tools/perf/bench/qspinlock.c | 411 ++++++++++++++++++
> tools/perf/bench/sync.c | 329 ++++++++++++++
> tools/perf/builtin-bench.c | 7 +
> tools/perf/check-headers.sh | 32 ++
> 19 files changed, 1829 insertions(+)
> create mode 100644 tools/include/linux/percpu-simulate.h
> create mode 100644 tools/include/linux/prefetch.h
> create mode 100644 tools/perf/bench/include/mcs_spinlock-private.h
> create mode 100644 tools/perf/bench/include/mcs_spinlock.h
> create mode 100644 tools/perf/bench/include/qspinlock-private.h
> create mode 100644 tools/perf/bench/include/qspinlock.h
> create mode 100644 tools/perf/bench/include/qspinlock_types.h
> create mode 100644 tools/perf/bench/qspinlock.c
> create mode 100644 tools/perf/bench/sync.c
>
> --
> 2.50.1.487.gc89ff58d15-goog
>
Powered by blists - more mailing lists