Resume device output after user program restart#23
Open
thwuedwin wants to merge 1 commit intosysprog21:mainfrom
Open
Resume device output after user program restart#23thwuedwin wants to merge 1 commit intosysprog21:mainfrom
thwuedwin wants to merge 1 commit intosysprog21:mainfrom
Conversation
kxo has a critical issue: if the userspace program xo-user exits while the game is paused, restarting the program will cause it to hang. The userspace program communicates the game state to the kernel module via the 'kxo_state' attribute exposed through sysfs. This attribute reflects the current game state (e.g., paused, quitting) and controls whether the kernel module continues to produce output. However, if the userspace program exits while the game is paused, the 'display' flag is not cleared. As a result, the kernel module does not resume producing output when the program is relaunched, even though it is still functioning correctly. This patch resolves the issue by resetting the 'display' flag when the userspace program exits.
Contributor
|
If this change is applied, when running xo-user in multiple user space programs, pausing and exiting in one program will cause the others to resume from pause. I’m not sure if that’s the intended behavior. My suggestion is to move attr_obj.display = 49; inside the if statement. if (atomic_dec_and_test(&open_cnt)) {
del_timer_sync(&timer);
flush_workqueue(kxo_workqueue);
fast_buf_clear();
+ attr_obj.display = 49;
}This would keep the current behavior, where other programs fail to properly resume after being paused, but since your commit message only mentions ensuring that restart works correctly, I think it’s better to minimize unintended side effects. As for the multiple–user space program issue, I think it can be discussed separately. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If the userspace program exits while the game is paused, the
displayflag is not cleared, causing the kernel module to stop producing output. As a result, restarting the program in this state causes it to hang on waiting for device data.This patch resets the
displayflag on program exit, ensuring the kernel module resumes output normally when the program is restarted.