Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x86: testcase failure demo #84167

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion lib/utils/ring_buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,29 @@ uint32_t ring_buf_put_claim(struct ring_buf *buf, uint8_t **data, uint32_t size)

base = buf->put_base;
wrap_size = buf->put_head - base;

/*
* Same line as the one after the "if" below, however here this causes
* "west build -p -b qemu_x86/atom tests/subsys/tracing/tracing_api
* -T tracing.transport.uart.async.test"
* to fail when used here.
*/
free_space = buf->size - (buf->put_head - buf->get_tail);

if (unlikely(wrap_size >= buf->size)) {
/* put_base is not yet adjusted */
wrap_size -= buf->size;
base += buf->size;
}

/*
* Duplicate of the line above. However when this line is used here
* instead and the other one commented out then the test passes.
*/
/*free_space = buf->size - (buf->put_head - buf->get_tail);*/

wrap_size = buf->size - wrap_size;

free_space = ring_buf_space_get(buf);
size = MIN(size, free_space);
size = MIN(size, wrap_size);

Expand Down
Loading