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

axfer: break transmission of audio data frame when transmission backend queues no PCM event within timeout #31

Closed
wants to merge 6 commits into from

Conversation

takaswie
Copy link
Member

Axfer internally has the waiter abstraction for polling system call. This is used without explicit timeout for IRQ-based scheduling model. As a result, axfer process is corrupted to be blocked due to a call of polling system call when transmission backend has a bug to queue PCM event in I/O thread or hardware IRQ context.

This patchset implements error reporting for such buggy backend. When call of polling system call returns with timeout, axfer reports it as a bug. The timeout is equivalent to the size of buffer. Precisely it should be the size of period, however the larger size is used to stabilize runtime for existent PCM plugins.

Takashi Sakamoto (6):
  axfer: return the number of file descriptors for I/O events from select(2) waiter
  axfer: fix to return error code when a call of select(2) fails
  axfer: return ETIMEDOUT when no event occurs after waiter expiration
  axfer: handle -ETIMEDOUT before handle mmap I/O operation
  axfer: code refactoring for a helper function to wait for avail buffer space
  axfer: handle -ETIMEDOUT before non-block I/O operation

 axfer/waiter-select.c           |  4 +--
 axfer/xfer-libasound-irq-mmap.c | 19 +++++++++-
 axfer/xfer-libasound-irq-rw.c   | 62 +++++++++++++++++++--------------
 axfer/xfer-libasound.c          | 21 +++++++----
 4 files changed, 70 insertions(+), 36 deletions(-)

…ct(2) waiter

A call of select(2) returns error code at failure, the number of file
descriptors available I/O at success. Current implementation of
waiter abstraction for select(2) returns 0 at success and callers
can't get the number.

This commit fixes it.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
A call of select(2) returns negative code and report errors via errno
local variable, howver current waiter implementation for select(2)
returns the negative code instead of errno.

This commit fixes it.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Although the waiter abstraction handles timeout as success, it should
report for callers to know timeout.

This commit takes the waiter to return -ETIMEDOUT when timeout expires.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
When running for IRQ-based scheduling model, transmission backend is
expected to queue PCM event in different context from the main thread.
When queueing no events during time equivalent to one period of PCM
buffer, the backend has problems.

This commit outputs report it for mmap operation for IRQ-based
scheduling model. The timeout is equivalent to all frames in buffer,
instead of period for safe.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
…r space

This commit applies code refactoring for waiting PCM event queued
per period of PCM buffer in copying operation for IRQ-based scheduling
model.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
When running for IRQ-based scheduling model, transmission backend is
expected to queue PCM event in different context from the main thread.
When queueing no events during time equivalent to one period of PCM
buffer, the backend has problems.

This commit outputs report it for non-blocking operation for IRQ-based
scheduling model. The timeout is equivalent to all frames in buffer,
instead of period for safe.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
@perexg
Copy link
Member

perexg commented Oct 30, 2019

Applied. Thanks.

@perexg perexg closed this Oct 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants