Bug 740299

Summary: [RTC] - The ioctl RTC_IRPQ_READ doesn't return the correct value
Product: Red Hat Enterprise Linux 5 Reporter: Olivier BONHOMME <obonhomme>
Component: kernelAssignee: Prarit Bhargava <prarit>
Status: CLOSED ERRATA QA Contact: Dong Zhu <dZhu>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 5.6CC: amyagi, ccui, jarod, qcai
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: kernel-2.6.18-300.el5 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-02-21 03:56:47 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:
Bug Depends On:    
Bug Blocks: 758797    
Attachments:
Description Flags
Fix RTC Freq Read with hpet emulate enabled
none
RHEL5 fix for this issue none

Description Olivier BONHOMME 2011-09-21 15:07:50 UTC
Created attachment 524222 [details]
Fix RTC Freq Read with hpet emulate enabled

Description of problem:

After setting the frequency value for the RTC clock using the ioctl RTC_IRQP_SET, the value is correctly applied to the rtc clock but when reading it using the RTC_IRQP_READ ioctl, the returned value is incorrect and stays set to 1024 even with root rights.

This behaviour applies only when the HPET timer is enabled and when the RTC clock is compiled in the kernel and not in module. In that case, the HPET_EMULATE_RTC option is enabled and ONLY in that case, the returned value is incorrect.

This bug is due to the fact, that in the rtc.c file driver, when HPET_EMULATE_RTC is defined the rtc_freq is not set.

This issue has already been corrected in the upstream kernel but not backported in the RHEL kernel as described here : http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=61ca9daa2ca3022dc9cb22bd98e69c1b61e412ad. [^]

As an attachement, I created a patch in order to build the RPM considering the current SPEC file and sources provided by the SRPM.
Version-Release number of selected component (if applicable):
2.6.18-238.19.1.el5

How reproducible:
Try to change the clock frequency using the RTC_IRQP_SET ioctl and try to read it with the RTC_IRQP_READ ioctl.


Steps to Reproduce:
1.Set the clock frequency with RTC_IRQP_SET
2.Check that the clock is correctly set
3.Read the clock frequency with RTC_IRQP_READ
  
Actual results:
The RTC_IRQP_READ returns the default value.


Expected results:
The RTC_IRQP_READ returns the set value.


Additional info: This bug has been open also in CentOS http://bugs.centos.org/view.php?id=5064

Comment 1 Prarit Bhargava 2011-11-30 15:49:00 UTC
Created attachment 538614 [details]
RHEL5 fix for this issue

Comment 2 RHEL Program Management 2011-11-30 16:00:34 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 5 Jarod Wilson 2011-12-05 14:48:30 UTC
Patch(es) available in kernel-2.6.18-300.el5
You can download this test kernel (or newer) from http://people.redhat.com/jwilson/el5/
Detailed testing feedback is always welcomed.
If you require guidance regarding testing, please ask the bug assignee.

Comment 8 Olivier BONHOMME 2012-02-17 08:25:21 UTC
Hello,

Sorry for the delay but I was missing time for testing your kernel. So I just installed it on my system and here are the result of my test program : 

$ sudo ./rtc_test 
RTC Value is 64
SET return code = 0
RTC Value is 64

So the fix is okay for me.

Comment 9 errata-xmlrpc 2012-02-21 03:56:47 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHSA-2012-0150.html