Bug 491154

Summary: divider option does not work with TSC clocksource
Product: Red Hat Enterprise Linux 4 Reporter: david ahern <daahern>
Component: kernelAssignee: Chris Lalancette <clalance>
Status: CLOSED ERRATA QA Contact: Red Hat Kernel QE team <kernel-qe>
Severity: medium Docs Contact:
Priority: low    
Version: 4.7CC: jtluka, tao
Target Milestone: rc   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-05-18 19:35:57 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Patch to fix TSC timesource with the tick divider none

Description david ahern 2009-03-19 15:57:56 UTC
Description of problem:
I am attempting to use the TSC as a clocksource for a RHEL4.7 based KVM guest, and the TSC is declared unstable:

...
kernel: checking TSC synchronization across 4 CPUs: passed.
...

kernel: Losing too many ticks!
kernel: TSC cannot be used as a timesource.
kernel: Possible reasons for this are:
kernel:   You're running with Speedstep,
kernel:   You don't have DMA enabled for your hard disk (see hdparm),
kernel:   Incorrect TSC synchronization on an SMP system (see dmesg).
kernel: Falling back to a sane timesource now.


How reproducible:
easy, just add the options and reboot.

Steps to Reproduce:
1. Add 'divider=4 clock=tsc' to kernel parameters
2. reboot
3. on reboot, run dmesg | egrep -i 'clock|time|tsc|pit|lost'

Actual results:
TSC clocksource declared unstable.

Expected results:
TSC clocksource works.

Additional info:
I instrumented the 4.7 kernel -- timer_tsc.c, mark_offset_tsc():

       if (lost >= 2) {
printk("delta %ld, lost %ld, delay_at_last_interrupt %d\n", delta, lost,
delay_at_last_interrupt);

On boot the messages right before it drops the TSC as a clocksource are:

delta 4000, lost 4, delay_at_last_interrupt 1
delta 4000, lost 4, delay_at_last_interrupt 1
delta 3999, lost 3, delay_at_last_interrupt 1
delta 4002, lost 4, delay_at_last_interrupt 1

At Marcelo's suggestion I changed HZ to REAL_HZ and the TSC clocksource works fine with the divider option. If you look at mark_offset_pmtmr, it uses REAL_HZ instead of HZ, so it appears to be an oversight on the TSC clocksource.

Comment 3 Chris Lalancette 2009-03-20 15:14:01 UTC
Created attachment 336058 [details]
Patch to fix TSC timesource with the tick divider

Comment 4 RHEL Program Management 2009-03-20 15:18:01 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.

Comment 7 Vivek Goyal 2009-03-25 13:30:00 UTC
Committed in 85.EL . RPMS are available at http://people.redhat.com/vgoyal/rhel4/

Comment 15 errata-xmlrpc 2009-05-18 19:35:57 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2009-1024.html