Skip to content

Conversation

@weiso131
Copy link
Contributor

Using ftrace, I observed that during the select system call, the kernel invokes do_select → select_poll_one → vfs_poll → file->f_op->poll. However, the kxo device did not implement the poll file operation.

In this case, vfs_poll returns a default mask that causes select to assume the file is always ready for I/O, even if a subsequent read would block.

This behavior led to user-facing issues in xo-user. For example, attempting to pause (Ctrl+P) or
stop (Ctrl+Q) could be delayed or ignored due to
the blocking nature of kxo's read when no data is available.

I implemented poll support using a wait queue to resolve this problem.

References:

  • github.com/torvalds/linux/blob/master/fs/select.c
  • github.com/torvalds/linux/blob/master/include/linux/poll.h

Copy link
Contributor

@jserv jserv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the following in git commit messages:

References:
- github.com/torvalds/linux/blob/master/fs/select.c
- github.com/torvalds/linux/blob/master/include/linux/poll.h

The above is less informative since developer can look up by themself.

Using ftrace, I observed that during the select system call,
the kernel invokes do_select → select_poll_one → vfs_poll
→ file->f_op->poll. However, the kxo device did not
implement the poll file operation.

In this case, vfs_poll returns a default mask that causes
select to assume the file is always ready for I/O,
even if a subsequent read would block.

This behavior led to user-facing issues in xo-user.
For example, attempting to pause (Ctrl+P) or
stop (Ctrl+Q) could be delayed or ignored due to
the blocking nature of kxo's read when no data is available.

I implemented poll support using a wait queue to resolve
this problem.
@weiso131
Copy link
Contributor Author

I've removed the References section from the commit message as suggested.

@jserv jserv merged commit 7b4a96b into sysprog21:main Jul 18, 2025
@jserv
Copy link
Contributor

jserv commented Jul 18, 2025

Thank @weiso131 for contributing!

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.

2 participants