Commit 5c36567c authored by Peter Mitsis's avatar Peter Mitsis Committed by Benjamin Cabé
Browse files

tests: Add benchmark for IPI performance

Adds tests to better gauge IPI performance on SMP. In each case, one
CPU is used as the source of IPIs while the remaining CPUs are busy
doing "work". Every 30 seconds the benchmark reports on the amount
of "work" done by the busy CPUs and the amount of work done by the
CPU generating the IPIs.

This can be used to ...
 1. Show how enabling IPI optimization affects system performance
 2. Show the cost of spinlock contention as the number of CPUs increase
 3. Measure the relative performance of scheduler changes on SMP.

Signed-off-by: default avatarPeter Mitsis <peter.mitsis@intel.com>
parent 59b62243
Loading
Loading
Loading
Loading
+26 −0
Changes for tests/benchmarks/ipi_metric/CMakeLists.txt: 26 added lines, 0 removed lines.
Original line number Diff line number Diff line
# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.20.0)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(ipi_metric)

#FILE(GLOB app_sources src/*.c)
#target_sources(app PRIVATE ${app_sources})
target_sources_ifdef(
  CONFIG_IPI_METRIC_PREEMPTIVE
  app
  PRIVATE
  src/ipi_metric_preemptive.c
  )
target_sources_ifdef(
  CONFIG_IPI_METRIC_PRIMITIVE_BROADCAST
  app
  PRIVATE
  src/ipi_metric_primitive.c
  )
target_sources_ifdef(
  CONFIG_IPI_METRIC_PRIMITIVE_DIRECTED
  app
  PRIVATE
  src/ipi_metric_primitive.c
  )
+37 −0
Changes for tests/benchmarks/ipi_metric/Kconfig: 37 added lines, 0 removed lines.
Original line number Diff line number Diff line
# Copyright (c) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

mainmenu "IPI-Metric RTOS Test Suite"

choice IPI_METRIC_TEST
	prompt "Select an IPI-Metric test to execute"
	default IPI_METRIC_PREEMPTIVE
	help
	  The IPI-Metric benchmark suite has a single CPU in an SMP system
	  dedicated to generating IPIs under varying conditions while the
	  remaining CPUs perform their "work" and process IPIs. These tests
	  track the amount of "work" and the number of IPIs processed
	  during 30 second time intervals.

config IPI_METRIC_PREEMPTIVE
	bool "IPIs are generated due threads preempting one another"
	help
	  The CPU generating the IPIs does so as a byproduct of resuming and
	  suspending a series of preemptible threads.

config IPI_METRIC_PRIMITIVE_BROADCAST
	bool "IPIs are generated using primitive arch_sched_broadcast_ipi()"
	help
	  The CPU generating the IPIs does so by directly calling
	  arch_sched_broadcast_ipi() to broadcast them to all CPUs.

config IPI_METRIC_PRIMITIVE_DIRECTED
	bool "IPIs are generated using primitive arch_sched_directed_ipi()"
	depends on ARCH_HAS_DIRECTED_IPIS
	help
	  The CPU generating the IPIs does so by directly calling
	  arch_sched_directed_ipi() to direct them to a single CPU.

endchoice

source "Kconfig.zephyr"
+4 −0
Changes for tests/benchmarks/ipi_metric/boards/qemu_cortex_a53_qemu_cortex_a53_smp.conf: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
# Copyright (c) 2022 Carlo Caione <ccaione@baylibre.com>
# SPDX-License-Identifier: Apache-2.0

CONFIG_MP_MAX_NUM_CPUS=4
+19 −0
Changes for tests/benchmarks/ipi_metric/boards/qemu_cortex_a53_qemu_cortex_a53_smp.overlay: 19 added lines, 0 removed lines.
Original line number Diff line number Diff line
/* Copyright 2022 Carlo Caione <ccaione@baylibre.com>
 * SPDX-License-Identifier: Apache-2.0
 */

/ {
	cpus {
		cpu@2 {
			device_type = "cpu";
			compatible = "arm,cortex-a53";
			reg = <2>;
		};

		cpu@3 {
			device_type = "cpu";
			compatible = "arm,cortex-a53";
			reg = <3>;
		};
	};
};
+1 −0
Changes for tests/benchmarks/ipi_metric/boards/qemu_x86_64.conf: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
CONFIG_MP_MAX_NUM_CPUS=4
Loading