zephyr/samples
Andy Ross 851d14afc8 kernel/sched: Remove "cooperative scheduling only" special cases
The scheduler has historically had an API where an application can
inform the kernel that it will never create a thread that can be
preempted, and the kernel and architecture layer would use that as an
optimization hint to eliminate some code paths.

Those optimizations have dwindled to almost nothing at this point, and
they're now objectively a smaller impact than the special casing that
was required to handle the idle thread (which, obviously, must always
be preemptible).

Fix this by eliminating the idea of "cooperative only" and ensuring
that there will always be at least one preemptible priority with value
>=0.  CONFIG_NUM_PREEMPT_PRIORITIES now specifies the number of
user-accessible priorities other than the idle thread.

The only remaining workaround is that some older architectures (and
also SPARC) use the CONFIG_PREEMPT_ENABLED=n state as a hint to skip
thread switching on interrupt exit.  So detect exactly those platforms
and implement a minimal workaround in the idle loop (basically "just
call swap()") instead, with a big explanation.

Note that this also fixes a bug in one of the philosophers samples,
where it would ask for 6 cooperative priorities but then use values -7
through -2.  It was assuming the kernel would magically create a
cooperative priority for its idle thread, which wasn't correct even
before.

Fixes #34584

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
2021-05-24 23:38:16 -04:00
..
application_development samples: out_of_tree_driver: remove usage of device_pm_control_nop 2021-04-28 20:40:00 -04:00
arch
basic samples: button: devicetree cleanups 2021-05-05 20:46:43 +02:00
bluetooth samples: bluetooth: Convert peripheral_hr sample.yaml to use depends_on 2021-05-18 12:35:39 +03:00
boards samples/boards: stm32 pm blinky: Run with twister device testing 2021-05-18 11:18:40 -05:00
drivers samples: drivers: watchdog: Pause during debugging 2021-05-21 05:00:07 -05:00
hello_world
kernel
modules samples: tensorflow: remove requirements.txt from magic wand sample 2021-05-24 14:18:08 -04:00
net samples: net: gsm_modem: Add GSM mux compile test 2021-05-17 10:57:53 -04:00
philosophers kernel/sched: Remove "cooperative scheduling only" special cases 2021-05-24 23:38:16 -04:00
posix
sensor boards: arm: lpcxpresso55s16: rename board definition 2021-05-19 08:02:54 -05:00
shields boards: arm: lpcxpresso55s16: rename board definition 2021-05-19 08:02:54 -05:00
subsys samples: usb-audio: add app.overlay and remove board specific overlays 2021-05-21 18:16:25 -04:00
synchronization
tfm_integration modules: tf-m: do not expose TF-M NS interface include directories publicly 2021-05-09 09:59:22 -05:00
userspace doc: fix typos 2021-04-30 16:03:08 -04:00
classic.rst
index.rst doc: samples: restore :maxdepth: 2 2021-05-05 18:32:15 -04:00