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

timer: reduce interference between timer sessions #5138

Open
nfeske opened this issue Mar 7, 2024 · 6 comments
Open

timer: reduce interference between timer sessions #5138

nfeske opened this issue Mar 7, 2024 · 6 comments
Labels

Comments

@nfeske
Copy link
Member

nfeske commented Mar 7, 2024

The work on the time-driven new audio infrastructure (#5097) uncovered an unexpected degree of interference between timer clients. This observation prompted me to reconsider the current timer implementation(s). I'd like to achieve the following:

  • Each timer should have a top-level Main object that ties all platform-specific ingredients together. This will each driver much easier to understand and to modify.

  • The timer drivers should only use real clocks, no interpolated time. This will remove a source of uncertainty from the operation of the timer.

  • The deliberate limiting of the time resolution should be applied only to the programming of timeouts by the timer driver. It should not be applied to the querying of time. This will improve the precision of calculations based on these values at the client side (e.g., the mixer's observation of client periods).

  • The timer driver should try batching the wake-up of clients that have timeouts closely clustered together.

  • On NOVA, the number of kernel interactions could probably be reduced.

I will turn my immediate attention to the NOVA timer driver.

@nfeske nfeske added the cleanup label Mar 7, 2024
nfeske added a commit to nfeske/genode that referenced this issue Mar 7, 2024
This data structure uses an AVL tree to maintain a time-sorted set of
alarm objects. It supports the use of circular clocks of an bit width.

Issue genodelabs#5138
nfeske added a commit to nfeske/genode that referenced this issue Mar 8, 2024
@nfeske
Copy link
Member Author

nfeske commented Mar 8, 2024

My timer branch (https://github.com/nfeske/genode/commits/timer/) contains my first take of the new implementation, tested via pkg/test-timer as well as sculpt.run (on Qemu). I haven't tested it with the audio scenario yet.

On Sculpt on Qemu, once the system has settled, top shows a similar load as the original version. Upon closer inspection, most of the load seems to be induced by the ahci-1.fs server, which calls trigger_once about 200 times per second.

nfeske added a commit to nfeske/genode that referenced this issue Mar 11, 2024
This data structure uses an AVL tree to maintain a time-sorted set of
alarm objects. It supports the use of circular clocks of an bit width.

Issue genodelabs#5138
nfeske added a commit to nfeske/genode that referenced this issue Mar 11, 2024
@nfeske
Copy link
Member Author

nfeske commented Mar 11, 2024

Version nfeske@c8a05b2 replaces the RPC-based synchronization by a simple locking scheme, which is a little bit faster and alleviates the need for the component-internal RPC interface. To quantify the performance change, I tested the idle load with Sculpt on an x250, which is pretty much influenced by the timer.

  • Original timer 98.81%
  • New timer (RPC-based synchronization scheme) 98.92%
  • New timer (mutex-based synchronization scheme) 99.01%

@nfeske
Copy link
Member Author

nfeske commented Mar 11, 2024

After testing the waveform_player.run script on my x250, I'm happy to report that the new timer indeed solves the cross-session interference problem.

nfeske added a commit that referenced this issue Mar 11, 2024
This data structure uses an AVL tree to maintain a time-sorted set of
alarm objects. It supports the use of circular clocks of an bit width.

Issue #5138
nfeske added a commit that referenced this issue Mar 11, 2024
nfeske added a commit to nfeske/genode that referenced this issue Mar 11, 2024
nfeske added a commit that referenced this issue Mar 13, 2024
nfeske added a commit that referenced this issue Mar 13, 2024
@nfeske
Copy link
Member Author

nfeske commented Mar 13, 2024

Commit 6a36ab5 contains the new version of the base-hw timer.

nfeske added a commit that referenced this issue Mar 15, 2024
In the context of #5138, the timer drivers for NOVA and base-hw had been
changed to support timeouts at a precision of 250 us (from formerly 1 ms).
Adjust the test to the new expected lower bound.
nfeske added a commit to nfeske/genode that referenced this issue Apr 8, 2024
nfeske added a commit to nfeske/genode that referenced this issue Apr 8, 2024
chelmuth pushed a commit that referenced this issue Apr 12, 2024
This data structure uses an AVL tree to maintain a time-sorted set of
alarm objects. It supports the use of circular clocks of an bit width.

Issue #5138
chelmuth pushed a commit that referenced this issue Apr 12, 2024
chelmuth pushed a commit that referenced this issue Apr 12, 2024
chelmuth pushed a commit that referenced this issue Apr 12, 2024
In the context of #5138, the timer drivers for NOVA and base-hw had been
changed to support timeouts at a precision of 250 us (from formerly 1 ms).
Adjust the test to the new expected lower bound.
alex-ab added a commit to alex-ab/genode that referenced this issue May 15, 2024
@alex-ab
Copy link
Member

alex-ab commented May 15, 2024

I finished the adjusted pit timer implementation. run/timeout on Qemu succeed for me on Qemu for sel4, okl4 and pistachio.

alex-ab added a commit to alex-ab/genode that referenced this issue May 15, 2024
alex-ab added a commit to alex-ab/genode that referenced this issue May 15, 2024
nfeske pushed a commit that referenced this issue May 15, 2024
@nfeske
Copy link
Member Author

nfeske commented May 15, 2024

Nice! Thanks @alex-ab for the new implementation, which I merged to staging just now. Curious to see how it fares for the other scenarios.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants