Bug 456437

Summary: [RHEL5.2-Z][kernel-xen] powernow identifies the wrong number of processors.
Product: Red Hat Enterprise Linux 5 Reporter: Jeff Burke <jburke>
Component: kernel-xenAssignee: Miroslav Rezanina <mrezanin>
Status: CLOSED ERRATA QA Contact: Martin Jenner <mjenner>
Severity: low Docs Contact:
Priority: low    
Version: 5.2.zCC: bhavna.sarathy, bnagendr, duck, dzickus, jpirko, prarit, riel, syeghiay, xen-maint
Target Milestone: rcKeywords: Reopened
Target Release: ---   
Hardware: All   
OS: Linux   
URL: http://rhts.redhat.com/testlogs/25754/94808/798424/DMSGDIFF.yK3658
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-09-02 09:00:21 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: 492568    

Description Jeff Burke 2008-07-23 16:07:20 UTC
Description of problem:

===================================================================
diff -u /mnt/testarea/boot.kernel-2.6.18-92.el5
/mnt/testarea/boot.kernel-xen-2.6.18-92.1.10.el5
===================================================================
--- /mnt/testarea/boot.kernel-2.6.18-92.el5	2008-07-23 07:22:29.000000000 -0400
+++ /mnt/testarea/boot.kernel-xen-2.6.18-92.1.10.el5	2008-07-23
07:26:56.000000000 -0400
@@ -1,31 +1,14 @@
-Linux version 2.6.18-92.el5 (brewbuilder.redhat.com) (gcc
version 4.1.2 20071124 (Red Hat 4.1.2-41)) #1 SMP Tue Apr 29 13:16:12 EDT 2008
+Linux version 2.6.18-92.1.10.el5xen (brewbuilder.redhat.com)
(gcc version 4.1.2 20071124 (Red Hat 4.1.2-42)) #1 SMP Wed Jul 23 04:25:48 EDT 2008
...
...
...
-powernow-k8: Found 4 Dual-Core AMD Opteron(tm) Processor 8220 SE processors (8
cpu cores) (version 2.20.00)
+powernow-k8: Found 8 Dual-Core AMD Opteron(tm) Processor 8220 SE processors (8
cpu cores) (version 2.20.00)

Version-Release number of selected component (if applicable):
2.6.18-92.1.10.el5xen

How reproducible:
Always

Steps to Reproduce:
1. Boot 2.6.18-92.1.10.el5xen on hp-dl585g2-01.rhts.bos.redhat.com
  
Actual results:
powernow-k8: Found 8 Dual-Core AMD Opteron(tm) Processor 8220 SE processors (8
cpu cores) (version 2.20.00)

Expected results:
powernow-k8: Found 4 Dual-Core AMD Opteron(tm) Processor 8220 SE processors (8
cpu cores) (version 2.20.00)

Additional info:
I am not sure if this is new with the 5.2-Z stream kernels or if is a
regression. It may have been an issue with 5.2 GA xen kernel.

Comment 4 Prarit Bhargava 2008-11-06 16:09:15 UTC
Will re-assign to jdeguara when account is active on BZ.

P.

Comment 6 Rik van Riel 2009-01-12 17:25:31 UTC
RHEL 5.3 has some fixes in this area.  Jeff, does the bug happen with the 5.3 kernel-xen?

Comment 7 Jeff Burke 2009-01-19 14:53:27 UTC
Rik,
  It does happen with the 5.3 kernel-xen

http://rhts.redhat.com/testlogs/40043/136743/1147881/DMSGDIFF.Xr3631.gz

===================================================================
diff -u /mnt/testarea/boot.kernel-2.6.18-126.el5 /mnt/testarea/boot.kernel-xen-2.6.18-128.el5
===================================================================
--- /mnt/testarea/boot.kernel-2.6.18-126.el5	2008-12-17 18:12:32.000000000 -0500
+++ /mnt/testarea/boot.kernel-xen-2.6.18-128.el5	2008-12-17 18:17:46.000000000 -0500
@@ -1,31 +1,14 @@
-Linux version 2.6.18-126.el5 (mockbuild.redhat.com) (gcc version 4.1.2 20071124 (Red Hat 4.1.2-42)) #1 SMP Mon Dec 8 18:33:05 EST 2008
+Linux version 2.6.18-128.el5xen (mockbuild.redhat.com) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-44)) #1 SMP Wed Dec 17 12:22:24 EST 2008
-powernow-k8: Found 4 Dual-Core AMD Opteron(tm) Processor 8220 SE processors (8 cpu cores) (version 2.20.00)
+powernow-k8: Found 8 Dual-Core AMD Opteron(tm) Processor 8220 SE processors (8 cpu cores) (version 2.20.00)

Comment 8 Bill Burns 2009-02-24 18:45:25 UTC
Bhavna, any update on this? Are you working on it?

Comment 9 Bhavna Sarathy 2009-03-10 14:06:58 UTC
I recall fixing this issue in bare metal with the following snippet (sorry I couldn't find the exact patch on the maling list archive)

#ifdef CONFIG_SMP
        printk(KERN_INFO PFX "Found %d %s "
               "processors (%d cpu cores) (" VERSION ")\n",
               supported_cpus/cpu_data[0].booted_cores,
               boot_cpu_data.x86_model_id, supported_cpus);
#else
        printk(KERN_INFO PFX "Found 1 %s "
               "processors (%d cpu cores) (" VERSION ")\n",
               boot_cpu_data.x86_model_id, supported_cpus);
#endif

This identifies the number of processors and not the number of cores.  AFAICT, there is no Xen specific powernow-k8 driver, it uses the dom0 driver in arch/i386/kernel/cpu/cpufreq/powernow-k8.c, and the fix that went in RHEL5.1 should apply.

Am I missing something?

Bhavna

Comment 10 Bill Burns 2009-03-10 16:53:33 UTC
Well from the problem description the cpu_data[0].booted_cores would seem to be wrong on the Xen kernel. If it's 2 then the output would be "4 dual core..." and "8 cpu cores". We are getting 8 and 8 on Xen.

Comment 11 Bhavna Sarathy 2009-03-27 15:48:28 UTC
I have looked through the Xen core enumeration code and noted right away that the code base was taken from Linux i386 and not x86_64.   Majority of the code is identical, with no major missing pieces, except for this snippet that is 
mostly commented.  Bill, can you CC comeone who can comment on this?

       /*
         * We need to hold call_lock, so there is no inconsistency
         * between the time smp_call_function() determines number of
         * IPI receipients, and the time when the determination is made
         * for which cpus receive the IPI. Holding this
         * lock helps us to not include this cpu in a currently in progress
         * smp_call_function().
         */
        /*lock_ipi_call_lock();*/
        cpu_set(smp_processor_id(), cpu_online_map);
        /*unlock_ipi_call_lock();*/
        /*per_cpu(cpu_state, smp_processor_id()) = CPU_ONLINE;*/

Comment 13 Miroslav Rezanina 2009-04-09 10:11:00 UTC
This behavior is caused by Xen functionality. Xen takes true topology and provides to each dom (including dom0) only one-cored proccesors. So dom0 gets in this case 8 processors with 1 core each. However, this processors have original name.

Should be behavior of xen smp driver modified to see original number of cores when running in dom0??

Comment 14 Jeff Burke 2009-05-04 12:29:20 UTC
Yes it should be fixed because it is incorrect. It is also inconsistent with a standard kernel. Note: Comment #7

Comment 16 Don Zickus 2009-05-14 19:34:16 UTC
in kernel-2.6.18-148.el5
You can download this test kernel from http://people.redhat.com/dzickus/el5

Please do NOT transition this bugzilla state to VERIFIED until our QE team
has sent specific instructions indicating when to do so.  However feel free
to provide a comment indicating that this fix has been verified.

Comment 19 errata-xmlrpc 2009-09-02 09:00:21 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-1243.html