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

Replace periodic timer interrupt with one-shot timer #12

Open
penberg opened this issue May 11, 2019 · 3 comments
Open

Replace periodic timer interrupt with one-shot timer #12

penberg opened this issue May 11, 2019 · 3 comments

Comments

@penberg
Copy link
Collaborator

penberg commented May 11, 2019

Currently, the APIC timer is configured to run in periodic mode. This will needlessly wake up the CPU, so let's replace the periodic timer with a variable one-shot timer instead.

@tapaswenipathak
Copy link
Contributor

Hi @penberg: Can I work on the ticket?

@penberg
Copy link
Collaborator Author

penberg commented Jul 22, 2019

@tapaswenipathak Of course.

This was referenced Jul 25, 2019
@penberg
Copy link
Collaborator Author

penberg commented Jul 25, 2019

Let me give some more background on what is needed here. We currently configure the APIC timer to run periodically. The timer interrupt wakes up any CPU that's blocked in the arch_halt_cpu. For example, the echo server in usr/echod calls epoll_wait in liblinux, which eventually ends up in the sys_wait system call in kernel/syscall.c. The period timer interrupt wakes it up.

However, even if the sys_wait system call was not called, the periodic timer interrupt will happen. The purpose of this improvement is to make the timer interrupt happen only when needed (sometimes referred to as tickless kernel).

You could, for example, implement an arch_timer_setup() function, which programs the APIC to deliver an one-shot interrupt, and call that arch_timer_setup() function from idle() function in kernel/init.c before halting the CPU.

If you then use the echod server as a test case for this.

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