Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 159610 Details for
Bug 248491
Kernel command-line option to turn off lost-tick compensation
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Add a command-line option to disable lost tick compensation
ignore_lost_ticks.patch (text/plain), 3.94 KB, created by
Tim Mann
on 2007-07-19 21:19:57 UTC
(
hide
)
Description:
Add a command-line option to disable lost tick compensation
Filename:
MIME Type:
Creator:
Tim Mann
Created:
2007-07-19 21:19:57 UTC
Size:
3.94 KB
patch
obsolete
>Subject: [PATCH 2.6.9-55.0.2.EL] add ignore_lost_ticks option > >As discussed in http://bugzilla.kernel.org/show_bug.cgi?id=5127, Linux >kernels prior to the clocksource patches (i.e., 2.6.17 and earlier) >have buggy code for detecting and compensating for lost timer >interrupts (ticks). The bug results in spurious detection of lost >ticks and thus makes the clock run faster than real time. > >This problem is observable on real hardware, but is much more severe >in a virtual machine. > >In 32-bit kernels, the command line option clock=pit effectively >disables lost-tick compensation. (That's not the primary intent of >the option; it's just that basing timekeeping only on the PIT, as >clock=pit does, gives the kernel no way to detect lost ticks, so it >doesn't try.) On 64-bit kernels, however, there has been no way to >disable lost-tick compensation from the command line. > >This patch adds a kernel command-line option "ignore_lost_ticks" that >turns off lost-tick compensation in 64-bit kernels. The patch is kept >very simple to make it obvious that it has no effect if the command >line option is not given. > >Signed-off-by: Tim Mann <mann@vmware.com> > >diff -u -r linux-2.6.9/arch/x86_64/kernel/pmtimer.c linux-2.6.9-mann/arch/x86_64/kernel/pmtimer.c >--- linux-2.6.9/arch/x86_64/kernel/pmtimer.c 2007-07-17 18:20:01.000000000 -0700 >+++ linux-2.6.9-mann/arch/x86_64/kernel/pmtimer.c 2007-07-17 18:59:24.000000000 -0700 >@@ -53,6 +53,7 @@ > static int first_run = 1; > unsigned long tsc; > u32 lost; >+ extern int ignore_lost_ticks; /* from time.c */ > > u32 tick = inl(pmtmr_ioport); > u32 delta; >@@ -62,10 +63,15 @@ > last_pmtmr_tick = tick; > monotonic_base += delta * NSEC_PER_USEC; > >- delta += offset_delay; >- >- lost = delta / (USEC_PER_SEC / HZ); >- offset_delay = delta % (USEC_PER_SEC / HZ); >+ if (ignore_lost_ticks) { >+ lost = 1; >+ offset_delay = 0; >+ } else { >+ delta += offset_delay; >+ >+ lost = delta / (USEC_PER_SEC / HZ); >+ offset_delay = delta % (USEC_PER_SEC / HZ); >+ } > > rdtscll(tsc); > vxtime.last_tsc = tsc - offset_delay * cpu_khz; >diff -u -r linux-2.6.9/arch/x86_64/kernel/time.c linux-2.6.9-mann/arch/x86_64/kernel/time.c >--- linux-2.6.9/arch/x86_64/kernel/time.c 2007-07-17 18:20:01.000000000 -0700 >+++ linux-2.6.9-mann/arch/x86_64/kernel/time.c 2007-07-17 19:12:14.000000000 -0700 >@@ -67,6 +67,7 @@ > static int hpet_use_timer; > unsigned long vxtime_hz = PIT_TICK_RATE; > int report_lost_ticks; /* command line option */ >+int ignore_lost_ticks; > unsigned long long monotonic_base; > > struct vxtime_data __vxtime __section_vxtime; /* for vsyscalls */ >@@ -139,8 +140,16 @@ > in arch/x86_64/kernel/vsyscall.c and export all needed > variables in vmlinux.lds. -AK */ > >- t = (jiffies - wall_jiffies) * (1000000L / HZ) + >- do_gettimeoffset(); >+ /* >+ * If lost tick compensation is turned off, we must >+ * cap the offset at one tick. Otherwise when we do >+ * lose a tick, gettimeofday may go backward when the >+ * next tick arrives. >+ */ >+ t = (jiffies - wall_jiffies) * (1000000L / HZ) + >+ ignore_lost_ticks ? >+ min(USEC_PER_SEC / HZ, do_gettimeoffset()) : >+ do_gettimeoffset(); > usec += t; > > } while (read_seqretry(&xtime_lock, seq)); >@@ -436,7 +445,7 @@ > (((long) offset << 32) / vxtime.tsc_quot) - 1; > } > >- if (lost > 0) { >+ if (lost > 0 && !ignore_lost_ticks) { > handle_lost_ticks(lost, regs); > jiffies += lost; > } >@@ -823,6 +832,12 @@ > return 1; > } > >+int __init ignore_lost_ticks_setup(char *str) >+{ >+ ignore_lost_ticks = 1; >+ return 1; >+} >+ > static struct irqaction irq0 = { > timer_interrupt, SA_INTERRUPT, CPU_MASK_NONE, "timer", NULL, NULL > }; >@@ -971,6 +986,7 @@ > } > > __setup("report_lost_ticks", time_setup); >+__setup("ignore_lost_ticks", ignore_lost_ticks_setup); > > static long clock_cmos_diff; >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 248491
: 159610