kernel/pipe: disable direct-to-readers copy with CONFIG_KERNEL_COHERENCE
Systems that enabled this option don't have their stacks in coherent memory. Given our pipe_buf_spec is stored on the stack, and readers may also have their destination buffer on their stack too, it is not worth going to the trouble of supporting direct-to-readers copy with them. Signed-off-by: Nicolas Pitre <npitre@baylibre.com>
This commit is contained in:
parent
3da90f9d49
commit
0c0644bd68
1 changed files with 12 additions and 1 deletions
|
|
@ -162,7 +162,18 @@ int z_impl_k_pipe_write(struct k_pipe *pipe, const uint8_t *data, size_t len, k_
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pipe_empty(pipe)) {
|
if (pipe_empty(pipe)) {
|
||||||
if (pipe->waiting != 0) {
|
if (IS_ENABLED(CONFIG_KERNEL_COHERENCE)) {
|
||||||
|
/*
|
||||||
|
* Systems that enabled this option don't have
|
||||||
|
* their stacks in coherent memory. Given our
|
||||||
|
* pipe_buf_spec is stored on the stack, and
|
||||||
|
* readers may also have their destination
|
||||||
|
* buffer on their stack too, it is not worth
|
||||||
|
* supporting direct-to-readers copy with them.
|
||||||
|
* Simply wake up all pending readers instead.
|
||||||
|
*/
|
||||||
|
need_resched = z_sched_wake_all(&pipe->data, 0, NULL);
|
||||||
|
} else if (pipe->waiting != 0) {
|
||||||
written += copy_to_pending_readers(pipe, &need_resched,
|
written += copy_to_pending_readers(pipe, &need_resched,
|
||||||
&data[written],
|
&data[written],
|
||||||
len - written);
|
len - written);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue