OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 8:25 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 18 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: PIT timer on real hardware?
PostPosted: Sat Sep 25, 2021 10:34 am 
Offline
Member
Member

Joined: Tue Aug 31, 2021 7:25 am
Posts: 67
Yeah initialising the FPU fixed it. I'm guessing some machines already pre-initialise the FPU or something.

And what do you guys mean by overhead? I don't exactly understand what you guys mean by "entering and exiting", are you referring to multitasking? Are floats really this expensive?

Are you referring to the overhead associated with dumping float registers?


Top
 Profile  
 
 Post subject: Re: PIT timer on real hardware?
PostPosted: Sat Sep 25, 2021 11:27 am 
Offline
Member
Member

Joined: Tue Apr 03, 2018 2:44 am
Posts: 401
YDeeps1 wrote:
Yeah initialising the FPU fixed it. I'm guessing some machines already pre-initialise the FPU or something.

And what do you guys mean by overhead? I don't exactly understand what you guys mean by "entering and exiting", are you referring to multitasking? Are floats really this expensive?

Are you referring to the overhead associated with dumping float registers?


Other than saving state, there is no real need for a kernel to be manipulating floats.

Timers can be specified in microseconds, and manipulated using integer arithmetic. If microseconds doesn't provide the resolution you want, you can use nano-seconds, and use 64-bit integers to handle overflow. If nano-second resolution is not good enough for your timers, you may have your expectations set to high.

The FP state is rather large. WIth MMX, you need a 512 byte buffer, which you'll have to save and restore on each entry/exit from the kernel. Think for each timer interrupt, HDD interrupt, and ethernet controller interrupt. The could be thousands of these per second, so you'll shifting megabytes of FPU state each second in such a circumstance. It all adds up.

If you know you're not doing any FP in the kernel, you can skip all of this and save just the integer GPR.


Top
 Profile  
 
 Post subject: Re: PIT timer on real hardware?
PostPosted: Sat Sep 25, 2021 4:43 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5099
YDeeps1 wrote:
I don't exactly understand what you guys mean by "entering and exiting", are you referring to multitasking?

I'm referring to things like interrupts and system calls, which do not necessarily involve a task switch. If your kernel uses extended registers, every interrupt must save and restore the extended registers, even when returning to the same task.

YDeeps1 wrote:
Are floats really this expensive?

Based on these measurements I'd estimate at least 200 cycles of overhead on every interrupt and system call. Do you save more than 200 cycles per interrupt by using floating-point math instead of integer math?


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 18 posts ]  Go to page Previous  1, 2

All times are UTC - 6 hours


Who is online

Users browsing this forum: Bing [Bot], Google [Bot], SemrushBot [Bot] and 54 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group