Bug 692182

Summary: sysconf(_SC_*CACHE) returns 0 for all caches on some CPUs.
Product: Red Hat Enterprise Linux 5 Reporter: john.haxby <john.haxby>
Component: glibcAssignee: Jeff Law <law>
Status: CLOSED ERRATA QA Contact: Jeff Law <law>
Severity: low Docs Contact:
Priority: medium    
Version: 5.6CC: bugzilla-redhat, fweimer, law, mfranc, pfrankli, pmuller
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
The glibc sysconf() function provides a way for the application to determine values for system limits or options at runtime. The mechanism that sysconf(3) uses to get the various CACHE parameters was incorrectly returning all zeroes on the Xeon X5670. sysconf() was modified to handle this CPU type correctly and return the information requested.
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-01-08 03:45:10 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
Variation of the patch posted upstream to use cpuid 4 rather than cpuid 2 when possible none

Description john.haxby@oracle.com 2011-03-30 16:06:07 UTC
Created attachment 488814 [details]
Variation of the patch posted upstream to use cpuid 4 rather than cpuid 2 when possible

Description of problem:
  The mechanism that sysconf(3) uses to get the various CACHE parameters
  fails on the Xen 5670

Version-Release number of selected component (if applicable): 2.12-1.7.el6_0.4

How reproducible:
  Every time

Steps to Reproduce:
1.  Find a machine whose /proc/cpuinfo starts something like this:

  vendor_id       : GenuineIntel
  cpu family      : 6
  model           : 44
  model name      : Intel(R) Xeon(R) CPU           X5670  @ 2.93GHz
  stepping        : 2

2. run "getconf -a | grep CACHE"
3. Observe values printed

Actual results:
  All the cache parameter values are zero.

Expected results:
  Non-zero values for all but the level 4 cache

Additional info:
  Recent CPUs no longer have useful cpuid leaf 2 cache descriptors.  For this
  particular machine, cpuid 2 returns 0x55035a01 0xf0b2ff 0x0 0xca0000 in eax,
  ebx, ecx and edx respectively.  The 0xff in the least significant byte of
  ebx indicates that you need to use cpuid leaf 4.  Actually, for all but
  somewhat old CPUs you're better off using cpuid leaf 4 anyway (the only
  machines I have access to that have a cpuid level less than four are a
  "Intel(R) Pentium(R) 4 CPU 1.70GHz" and "Intel(R) Pentium(R) 4 CPU 2.40GHz"
  both of which are long past their use-by date).

Comment 1 john.haxby@oracle.com 2011-03-30 16:08:53 UTC
Sorry, of course the glibc version should be 2.5-58

Comment 6 RHEL Program Management 2012-04-02 13:10:10 UTC
This request was evaluated by Red Hat Product Management for inclusion
in a Red Hat Enterprise Linux release.  Product Management has
requested further review of this request by Red Hat Engineering, for
potential inclusion in a Red Hat Enterprise Linux release for currently
deployed products.  This request is not yet committed for inclusion in
a release.

Comment 7 Jeff Law 2012-04-02 19:01:08 UTC
Note for QE, this was fixed for RHEL 6 (692177).  There is a testcase, but it's not attached to be BZ.  The testcase ID is 87285.

Comment 10 Patsy Griffin 2012-06-18 15:54:51 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
The glibc sysconf() function provides a way for the application to determine values for system limits or options at runtime.
The mechanism that sysconf(3) uses to get the various CACHE parameters was incorrectly returning all zeroes on the Xeon X5670. sysconf() was modified to handle this CPU type correctly and return the information requested.

Comment 12 errata-xmlrpc 2013-01-08 03:45:10 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/RHBA-2013-0022.html