| From | Sent On | Attachments |
|---|---|---|
| Jing Huang | Mar 24, 2011 6:34 am | |
| Peter Jeremy | Mar 25, 2011 1:24 am | |
| John Baldwin | Mar 25, 2011 5:18 am | |
| Peter Jeremy | Mar 26, 2011 5:16 am | |
| Kostik Belousov | Mar 26, 2011 5:59 am | |
| John Baldwin | Mar 26, 2011 7:11 am | |
| Jing Huang | Mar 26, 2011 7:42 am | |
| Kostik Belousov | Mar 26, 2011 7:50 am | |
| Warner Losh | Mar 26, 2011 11:02 am | |
| Julian Elischer | Mar 26, 2011 6:22 pm | |
| Warner Losh | Mar 27, 2011 3:32 pm | |
| Mark Tinguely | Mar 27, 2011 7:22 pm | |
| Julian Elischer | Mar 27, 2011 9:29 pm | |
| Warner Losh | Mar 27, 2011 10:13 pm |
| Subject: | Re: [GSoc] Timeconter Performance Improvements | |
|---|---|---|
| From: | John Baldwin (jh...@freebsd.org) | |
| Date: | Mar 25, 2011 5:18:15 am | |
| List: | org.freebsd.freebsd-hackers | |
On Thursday, March 24, 2011 9:34:35 am Jing Huang wrote:
Hi,
Thanks for your replay. That is just my self-introduction:) I want to borrow the shared memory idea from KVM, I am not want to port a whole KVM:) But for this project, there are some basic problems.
As I know, tsc counter is CPU specific. If the process running on a multi-core platform, we must consider switching problem. The one way, we can let the kernel to take of this. When switching to another CPU, the kernel will reset the shared memory according to the new CPU. The second way, we can use CPUID instruction to get the info of current CPU, which can be executed in user mode ether. At the same time, the kernel maintains shared memory for each CPU. When invoke gettimeofday, the function will calculate precise time with current CPU's shared memory.
I don't know which is better? Could I need to deal other problems?
For modern Intel CPUs you can just assume that the TSCs are in sync across packages. They also have invariant TSC's meaning that the frequency doesn't change. You can easily export a copy of the current 'timehands' structure when the TSC is used as the timecounter and then just reimplement bintime() in userland. This assumes you use the TSC as the kernel's timecounter, but you really need to do that so that ntpd_adjtime() is taken into account, etc.
That will give a very fast and very cheap timecounter.
I believe we already have a shared page (it holds the signal trampoline now) for at least the x86 platform (probably some others as well).
-- John Baldwin
_______________________________________________ free...@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "free...@freebsd.org"





