mirror of
https://github.com/zephyrproject-rtos/zephyr
synced 2025-09-06 05:41:57 +00:00
The CONFIG_IPI_OPTIMIZE configuration option allows for the flagging and subsequent signaling of IPIs to be optimized. It does this by making each bit in the kernel's pending_ipi field a flag that indicates whether the corresponding CPU might need an IPI to trigger the scheduling of a new thread on that CPU. When a new thread is made ready, we compare that thread against each of the threads currently executing on the other CPUs. If there is a chance that that thread should preempt the thread on the other CPU then we flag that an IPI is needed for that CPU. That is, a clear bit indicates that the CPU absolutely will not need to reschedule, while a set bit indicates that the target CPU must make that determination for itself. Signed-off-by: Peter Mitsis <peter.mitsis@intel.com>
32 lines
761 B
C
32 lines
761 B
C
/*
|
|
* Copyright (c) 2024 Intel Corporation
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
|
|
#ifndef ZEPHYR_KERNEL_INCLUDE_IPI_H_
|
|
#define ZEPHYR_KERNEL_INCLUDE_IPI_H_
|
|
|
|
#include <zephyr/kernel.h>
|
|
#include <stdint.h>
|
|
#include <zephyr/sys/atomic.h>
|
|
|
|
#define IPI_ALL_CPUS_MASK ((1 << CONFIG_MP_MAX_NUM_CPUS) - 1)
|
|
|
|
#define IPI_CPU_MASK(cpu_id) \
|
|
(IS_ENABLED(CONFIG_IPI_OPTIMIZE) ? BIT(cpu_id) : IPI_ALL_CPUS_MASK)
|
|
|
|
|
|
/* defined in ipi.c when CONFIG_SMP=y */
|
|
#ifdef CONFIG_SMP
|
|
void flag_ipi(uint32_t ipi_mask);
|
|
void signal_pending_ipi(void);
|
|
atomic_val_t ipi_mask_create(struct k_thread *thread);
|
|
#else
|
|
#define flag_ipi(ipi_mask) do { } while (false)
|
|
#define signal_pending_ipi() do { } while (false)
|
|
#endif /* CONFIG_SMP */
|
|
|
|
|
|
#endif /* ZEPHYR_KERNEL_INCLUDE_IPI_H_ */
|