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

Fixed ticks per second detection for Linux. #41

Merged
merged 1 commit into from
Mar 9, 2013
Merged

Fixed ticks per second detection for Linux. #41

merged 1 commit into from
Mar 9, 2013

Conversation

sgalaburda
Copy link

The ticks per second value was hard-coded in tsc_time.pyx module. This caused the time in shrapnel-based program to notably diverge from the system time. I implemented detection of actual ticks per second based on CPU frequency from /proc/cpuinfo.

samrushing added a commit that referenced this pull request Mar 9, 2013
Fixed ticks per second detection for Linux.
@samrushing samrushing merged commit 7ee30ce into ironport:master Mar 9, 2013
@samrushing
Copy link
Member

I agree with Markiyan, I would have just had it grab the first one... Do systems exist that have different TSC freqs on different CPU's?

@ehuss
Copy link
Contributor

ehuss commented Mar 9, 2013

TSC is generally synchronized on modern systems, with a constant frequency. Some older CPUs did not make these guarantees (particularly when the CPU went into different states). It's also possible for BIOS bugs to cause problems, but I do not actually know of any. Intel has been particularly good about keeping it in sync, whereas some AMD CPUs have not.

You can look at this to see what the Linux kernel does to detect if TSC is stable:
http://lxr.linux.no/linux+v2.6.38/arch/x86/kernel/tsc.c#L859

@sgalaburda
Copy link
Author

The CPU detection makes the solution more general. It allows to run shrapnel on systems with unsynchronized TSC (provided the CPU affinity is set).

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

Successfully merging this pull request may close these issues.

3 participants