zephyr/kernel
Andy Ross b4e9ef0691 kernel/sched: Defer IPI sending to schedule points
The original design intent with arch_sched_ipi() was that
interprocessor interrupts were fast and easily sent, so to reduce
latency the scheduler should notify other CPUs synchronously when
scheduler state changes.

This tends to result in "storms" of IPIs in some use cases, though.
For example, SOF will enumerate over all cores doing a k_sem_give() to
notify a worker thread pinned to each, each call causing a separate
IPI.  Add to that the fact that unlike x86's IO-APIC, the intel_adsp
architecture has targeted/non-broadcast IPIs that need to be repeated
for each core, and suddenly we have an O(N^2) scaling problem in the
number of CPUs.

Instead, batch the "pending" IPIs and send them only at known
scheduling points (end-of-interrupt and swap).  This semantically
matches the locations where application code will "expect" to see
other threads run, so arguably is a better choice anyway.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2022-05-02 10:23:13 -05:00
..
include pm: Only resize power domains 2022-04-18 17:25:01 -07:00
paging kernel: mmu: z_backing_store* to k_mem_paging_backing_store* 2021-05-28 11:33:22 -04:00
atomic_c.c kernel: atomic: consistently use named type for atomic pointer values 2021-04-19 15:22:13 +02:00
banner.c kernel: init: move banner handling 2020-11-27 20:08:14 -05:00
cache_handlers.c cache: Rename sys_{dcache,icache}_* to sys_{data,instr}_cache_* 2021-05-08 07:00:33 +02:00
CMakeLists.txt kernel: move thread usage routines to own file 2022-01-10 10:38:06 -05:00
compiler_stack_protect.c tests: coverage: exclude the CODE UNREACHABLE of code coverage 2021-01-15 12:42:00 -05:00
condvar.c Tracing: Conditional variable tracing 2021-05-07 22:10:21 -04:00
device.c kernel/device: Remove unknown external pointer 2022-04-08 09:59:00 -04:00
errno.c kernel: support using thread local storage for errno 2020-10-24 10:52:00 -07:00
events.c kernel: add support for event objects 2021-10-16 06:27:10 -04:00
fatal.c kernel: fatal: Avoid thread api access when no multithreading 2021-04-29 14:50:35 +02:00
futex.c futex: Avoid unnecessary lock 2021-07-30 20:21:04 -04:00
idle.c pm: Do not suspend during kernel initialization 2022-01-19 14:14:28 -05:00
init.c kernel: Remove idle thread cpu index on single-core devices 2022-03-30 10:08:48 -04:00
Kconfig pm: device: Dynamically add a device to a power domain 2022-04-18 17:25:01 -07:00
Kconfig.vm everywhere: fix typos 2022-03-18 13:24:08 -04:00
kheap.c kernel: kheap: make init work with demand paging 2021-08-26 21:16:22 -04:00
mailbox.c kernel: remove @return doc for void functions 2022-01-12 16:02:16 -05:00
main_weak.c kernel: extract __weak main() into independent file 2021-08-28 08:48:03 -04:00
mem_domain.c kernel: mem_domain: k_mem_domain_add_thread to return errors 2021-11-22 12:45:22 -05:00
mem_slab.c kernel: remove @return doc for void functions 2022-01-12 16:02:16 -05:00
mempool.c Tracing: k_free tracing hook heap reference added 2021-11-16 09:45:01 -05:00
mmu.c kernel: mmu: add a log line for z_phys_unmap 2022-02-24 08:38:38 -06:00
msg_q.c kernel: remove object tracing 2021-05-07 22:10:21 -04:00
mutex.c kernel: mutex: remove unnecessary schedule locking 2022-04-20 21:03:59 -04:00
pipes.c kernel: pipes: add pipe flush routines 2022-01-10 12:17:14 -05:00
poll.c everywhere: fix typos 2022-03-14 20:22:24 -04:00
queue.c kernel: remove object tracing 2021-05-07 22:10:21 -04:00
sched.c kernel/sched: Defer IPI sending to schedule points 2022-05-02 10:23:13 -05:00
sem.c kernel: remove object tracing 2021-05-07 22:10:21 -04:00
smp.c kernel: Refactor SMP cpu initialization a bit 2022-03-01 09:59:15 -05:00
stack.c kernel: remove object tracing 2021-05-07 22:10:21 -04:00
system_work_q.c kernel: remove old work queue implementation 2021-03-03 20:06:00 -05:00
thread.c kernel: update k_thread_state_str() API 2022-04-20 20:20:13 -04:00
timeout.c kernel/timeout: Cleanup/speedup parallel announce logic 2022-04-13 13:26:14 -07:00
timer.c kernel: remove @return doc for void functions 2022-01-12 16:02:16 -05:00
usage.c kernel: Update CPU runtime stats of non-idle time 2022-01-20 08:22:01 -05:00
userspace.c userspace: plug thread index leak in k_object_alloc() 2022-03-14 19:18:34 -04:00
userspace_handler.c userspace: update k_object API to support immutable objects 2020-09-02 13:48:13 +02:00
version.c zephyr: replace zephyr integer types with C99 types 2020-06-08 08:23:57 -05:00
work.c kernel/workq: Cleanup bespoke reschedule point 2022-05-02 10:23:13 -05:00
xip.c kernel/init.c: allow for memset/memcpy alternatives during early boot 2022-02-21 21:00:12 -05:00