kernel/poll: Mark incompatibility with KERNEL_COHERENCE

The k_poll implementation places a struct _poller on the stack and
shares it with other threads, which is incompatible with the
KERNEL_COHERENCE model of cached stacks.

Make this a hard build failure instead of a kconfig dependency for
clarity.  The failures if a user actually enables both are subtle and
difficult to debug.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This commit is contained in:
Andy Ross 2020-06-05 08:39:45 -07:00 committed by Anas Nashif
commit 4a8b3d194c
9 changed files with 17 additions and 1 deletions

View file

@ -243,11 +243,19 @@ static int k_poll_poller_cb(struct k_poll_event *event, uint32_t state)
return 0;
}
#ifdef CONFIG_KERNEL_COHERENCE
#error CONFIG_POLL and CONFIG_KERNEL_COHERENCE are not compatible
#endif
int z_impl_k_poll(struct k_poll_event *events, int num_events,
k_timeout_t timeout)
{
int events_registered;
k_spinlock_key_t key;
/* FIXME: this shared data is stack-allocated and needs
* proper treatment to be compatible with KERNEL_COHERENCE.
*/
struct _poller poller = { .is_polling = true,
.thread = _current,
.cb = k_poll_poller_cb };

View file

@ -3,10 +3,11 @@ tests:
tags: kernel userspace
build_on_all: true
min_flash: 33
filter: not CONFIG_KERNEL_COHERENCE
kernel.common.misra:
tags: kernel userspace
min_flash: 33
# Some configurations are known-incompliant and won't build
filter: not ((CONFIG_I2C or CONFIG_SPI) and CONFIG_USERSPACE)
filter: not ((CONFIG_I2C or CONFIG_SPI) and CONFIG_USERSPACE or CONFIG_KERNEL_COHERENCE)
extra_configs:
- CONFIG_MISRA_SANE=y

View file

@ -4,3 +4,4 @@ tests:
kernel.fifo.poll:
extra_args: CONF_FILE="prj_poll.conf"
tags: kernel
filter: not CONFIG_KERNEL_COHERENCE

View file

@ -4,3 +4,4 @@ tests:
kernel.fifo.timeout.poll:
extra_args: CONF_FILE="prj_poll.conf"
tags: kernel
filter: not CONFIG_KERNEL_COHERENCE

View file

@ -4,3 +4,4 @@ tests:
kernel.fifo.usage.poll:
extra_args: CONF_FILE="prj_poll.conf"
tags: kernel
filter: not CONFIG_KERNEL_COHERENCE

View file

@ -2,3 +2,4 @@ tests:
kernel.poll:
tags: kernel userspace
platform_exclude: nrf52dk_nrf52810
filter: not CONFIG_KERNEL_COHERENCE

View file

@ -4,3 +4,4 @@ tests:
kernel.queue.poll:
extra_args: CONF_FILE="prj_poll.conf"
tags: kernel userspace
filter: not CONFIG_KERNEL_COHERENCE

View file

@ -2,3 +2,4 @@ tests:
kernel.workqueue:
min_flash: 34
tags: kernel
filter: not CONFIG_KERNEL_COHERENCE

View file

@ -2,3 +2,4 @@ tests:
kernel.workqueue.api:
min_flash: 34
tags: kernel userspace
filter: not CONFIG_KERNEL_COHERENCE