x86: cpu_debug patches
The following changes since commit 88dc4c8e38d64db32907e0bd605f8c1ec4c4d1bd:
Ingo Molnar (1):
Merge branch 'tracing/ftrace'
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/jaswinder/linux-2.6-tip.git master
Jaswinder Singh Rajput (5):
x86: cpu_debug add support for Intel Xeon MP 7400 series
x86: cpu_debug add support for Intel Nehalem microarchitecture
x86: cpu_debug avoid storing cpu_descriptors locally where possible
x86: cpu_debug.c prepare report if files are inappropriate or CPU is not supported
x86: cpu_debug.c remove unwanted header files
arch/x86/include/asm/cpu_debug.h | 32 ++++++- arch/x86/kernel/cpu/cpu_debug.c | 183 ++++++++++++++++++++++++-------------- 2 files changed, 146 insertions(+), 69 deletions(-)
Complete diff:
arch/x86/include/asm/cpu_debug.h +28 -4
@@ -35,7 +35,7 @@ enum cpu_debug_bit {CPU_BASE_BIT ,/* BASE Address */ CPU_VER_BIT ,/* Version ID */ CPU_CONF_BIT ,/* Configuration */ -CPU_SMM_BIT ,/* System mgmt mode */ +CPU_SM_BIT ,/* System Management */ CPU_SVM_BIT ,/*Secure Virtual Machine*/ CPU_OSVM_BIT, /* OS-Visible Workaround*//* Standard Registers */
@@ -73,7 +73,7 @@ enum cpu_debug_bit {#define CPU_BASE (1 << CPU_BASE_BIT)#define CPU_VER (1 << CPU_VER_BIT)#define CPU_CONF (1 << CPU_CONF_BIT) -#define CPU_SMM (1 << CPU_SMM_BIT) +#define CPU_SM (1 << CPU_SM_BIT)#define CPU_SVM (1 << CPU_SVM_BIT)#define CPU_OSVM (1 << CPU_OSVM_BIT)#define CPU_TSS (1 << CPU_TSS_BIT)
@@ -89,6 +89,7 @@ enum cpu_file_bit {#define CPU_FILE_VALUE (1 << CPU_VALUE_BIT)/* +* Intel CPU support * DisplayFamily_DisplayModel Processor Families/Processor Number Series * -------------------------- ------------------------------------------ * 05_01, 05_02, 05_04 Pentium, Pentium with MMX
@@ -106,8 +107,12 @@ enum cpu_file_bit {* Pentium dual-core * 06_17 Xeon 5200, 5400 series, Core 2 Quad Q9650 * +* 06_1A Core i7, Xeon Processor 5500 series (Nehalem) +* * 06_1C Atom * +* 06_1D Xeon MP 7400 series +* * 0F_00, 0F_01, 0F_02 Xeon, Xeon MP, Pentium 4 * 0F_03, 0F_04 Xeon, Xeon MP, Pentium 4, Pentium D *
@@ -124,6 +129,8 @@ enum cpu_processor_bit {CPU_INTEL_PENTIUM_M_BIT ,CPU_INTEL_CORE_BIT ,CPU_INTEL_CORE2_BIT , +CPU_INTEL_XEON_7400_BIT , +CPU_INTEL_NEHALEM_BIT ,CPU_INTEL_ATOM_BIT ,CPU_INTEL_XEON_P4_BIT , CPU_INTEL_XEON_MP_BIT,
@@ -141,29 +148,46 @@ enum cpu_processor_bit {#define CPU_INTEL_PENTIUM_M (1 << CPU_INTEL_PENTIUM_M_BIT)#define CPU_INTEL_CORE (1 << CPU_INTEL_CORE_BIT)#define CPU_INTEL_CORE2 (1 << CPU_INTEL_CORE2_BIT) +#define CPU_INTEL_XEON_7400 (1 << CPU_INTEL_XEON_7400_BIT) +#define CPU_INTEL_NEHALEM (1 << CPU_INTEL_NEHALEM_BIT)#define CPU_INTEL_ATOM (1 << CPU_INTEL_ATOM_BIT)#define CPU_INTEL_XEON_P4 (1 << CPU_INTEL_XEON_P4_BIT)#define CPU_INTEL_XEON_MP (1 << CPU_INTEL_XEON_MP_BIT)#define CPU_INTEL_PX (CPU_INTEL_P6 | CPU_INTEL_PENTIUM_M) -#define CPU_INTEL_COREX (CPU_INTEL_CORE | CPU_INTEL_CORE2) +#define CPU_INTEL_CORE2X (CPU_INTEL_CORE2 | CPU_INTEL_XEON_7400) +#define CPU_INTEL_COREX (CPU_INTEL_CORE | CPU_INTEL_CORE2X)#define CPU_INTEL_XEON (CPU_INTEL_XEON_P4 | CPU_INTEL_XEON_MP) +#define CPU_XEON_MPX (CPU_INTEL_XEON_MP | CPU_INTEL_XEON_7400) +#define CPU_XEON_NE (CPU_INTEL_XEON | CPU_INTEL_NEHALEM)#define CPU_CO_AT (CPU_INTEL_CORE | CPU_INTEL_ATOM) -#define CPU_C2_AT (CPU_INTEL_CORE2 | CPU_INTEL_ATOM) +#define CPU_C2_AT (CPU_INTEL_CORE2X | CPU_INTEL_ATOM)#define CPU_CX_AT (CPU_INTEL_COREX | CPU_INTEL_ATOM)#define CPU_CX_XE (CPU_INTEL_COREX | CPU_INTEL_XEON)#define CPU_P6_XE (CPU_INTEL_P6 | CPU_INTEL_XEON)#define CPU_PM_CO_AT (CPU_INTEL_PENTIUM_M | CPU_CO_AT)#define CPU_C2_AT_XE (CPU_C2_AT | CPU_INTEL_XEON)#define CPU_CX_AT_XE (CPU_CX_AT | CPU_INTEL_XEON) +#define CPU_C2_AT_NE (CPU_C2_AT | CPU_INTEL_NEHALEM) +#define CPU_CX_AT_NE (CPU_CX_AT | CPU_INTEL_NEHALEM)#define CPU_P6_CX_AT (CPU_INTEL_P6 | CPU_CX_AT)#define CPU_P6_CX_XE (CPU_P6_XE | CPU_INTEL_COREX) +#define CPU_C2_AT_XE_NE (CPU_C2_AT_XE | CPU_INTEL_NEHALEM) +#define CPU_CX_AT_XE_NE (CPU_CX_AT_XE | CPU_INTEL_NEHALEM) +#define CPU_P6_CX_AT_NE (CPU_P6_CX_AT | CPU_INTEL_NEHALEM) +#define CPU_P6_CX_XE_NE (CPU_P6_CX_XE | CPU_INTEL_NEHALEM)#define CPU_P6_CX_AT_XE (CPU_INTEL_P6 | CPU_CX_AT_XE)#define CPU_PM_CX_AT_XE (CPU_INTEL_PENTIUM_M | CPU_CX_AT_XE)#define CPU_PM_CX_AT (CPU_INTEL_PENTIUM_M | CPU_CX_AT)#define CPU_PM_CX_XE (CPU_INTEL_PENTIUM_M | CPU_CX_XE)#define CPU_PX_CX_AT (CPU_INTEL_PX | CPU_CX_AT) +#define CPU_PX_CX_XE (CPU_INTEL_PX | CPU_CX_XE)#define CPU_PX_CX_AT_XE (CPU_INTEL_PX | CPU_CX_AT_XE) +#define CPU_PM_CX_AT_NE (CPU_PM_CX_AT | CPU_INTEL_NEHALEM) +#define CPU_PX_CX_XE_NE (CPU_PX_CX_XE | CPU_INTEL_NEHALEM) +#define CPU_P6_CX_AT_XE_NE (CPU_P6_CX_AT_XE | CPU_INTEL_NEHALEM) +#define CPU_PX_CX_AT_XE_NE (CPU_PX_CX_AT_XE | CPU_INTEL_NEHALEM) +#define CPU_PM_CX_AT_XE_NE (CPU_PM_CX_AT_XE | CPU_INTEL_NEHALEM)/* Select all supported Intel CPUs */ #define CPU_INTEL_ALL (CPU_INTEL_PENTIUM | CPU_PX_CX_AT_XE)
arch/x86/kernel/cpu/cpu_debug.c +118 -65
345 lines not on this page · raw message
Review
Quoted 3 lines · Jaswinder Singh Rajput
(quoted diff) +1
-1{ "conf", CPU_CONF, 0 }, - { "smm", CPU_SMM, 0 }, + { "sm", CPU_SM, 0 },
Here is new pull request after fixing this tab:
The following changes since commit 88dc4c8e38d64db32907e0bd605f8c1ec4c4d1bd:
Ingo Molnar (1):
Merge branch 'tracing/ftrace'
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/jaswinder/linux-2.6-tip.git master
Jaswinder Singh Rajput (5):
x86: cpu_debug add support for Intel Xeon MP 7400 series
x86: cpu_debug add support for Intel Nehalem microarchitecture
x86: cpu_debug avoid storing cpu_descriptors locally where possible
x86: cpu_debug.c prepare report if files are inappropriate or CPU is not supported
x86: cpu_debug.c remove unwanted header files
arch/x86/include/asm/cpu_debug.h | 32 ++++++- arch/x86/kernel/cpu/cpu_debug.c | 183 ++++++++++++++++++++++++-------------- 2 files changed, 146 insertions(+), 69 deletions(-)
Complete diff:
arch/x86/include/asm/cpu_debug.h +28 -4
@@ -35,7 +35,7 @@ enum cpu_debug_bit {CPU_BASE_BIT ,/* BASE Address */ CPU_VER_BIT ,/* Version ID */ CPU_CONF_BIT ,/* Configuration */ -CPU_SMM_BIT ,/* System mgmt mode */ +CPU_SM_BIT ,/* System Management */ CPU_SVM_BIT ,/*Secure Virtual Machine*/ CPU_OSVM_BIT, /* OS-Visible Workaround*//* Standard Registers */
@@ -73,7 +73,7 @@ enum cpu_debug_bit {#define CPU_BASE (1 << CPU_BASE_BIT)#define CPU_VER (1 << CPU_VER_BIT)#define CPU_CONF (1 << CPU_CONF_BIT) -#define CPU_SMM (1 << CPU_SMM_BIT) +#define CPU_SM (1 << CPU_SM_BIT)#define CPU_SVM (1 << CPU_SVM_BIT)#define CPU_OSVM (1 << CPU_OSVM_BIT)#define CPU_TSS (1 << CPU_TSS_BIT)
@@ -89,6 +89,7 @@ enum cpu_file_bit {#define CPU_FILE_VALUE (1 << CPU_VALUE_BIT)/* +* Intel CPU support * DisplayFamily_DisplayModel Processor Families/Processor Number Series * -------------------------- ------------------------------------------ * 05_01, 05_02, 05_04 Pentium, Pentium with MMX
@@ -106,8 +107,12 @@ enum cpu_file_bit {* Pentium dual-core * 06_17 Xeon 5200, 5400 series, Core 2 Quad Q9650 * +* 06_1A Core i7, Xeon Processor 5500 series (Nehalem) +* * 06_1C Atom * +* 06_1D Xeon MP 7400 series +* * 0F_00, 0F_01, 0F_02 Xeon, Xeon MP, Pentium 4 * 0F_03, 0F_04 Xeon, Xeon MP, Pentium 4, Pentium D *
@@ -124,6 +129,8 @@ enum cpu_processor_bit {CPU_INTEL_PENTIUM_M_BIT ,CPU_INTEL_CORE_BIT ,CPU_INTEL_CORE2_BIT , +CPU_INTEL_XEON_7400_BIT , +CPU_INTEL_NEHALEM_BIT ,CPU_INTEL_ATOM_BIT ,CPU_INTEL_XEON_P4_BIT , CPU_INTEL_XEON_MP_BIT,
@@ -141,29 +148,46 @@ enum cpu_processor_bit {#define CPU_INTEL_PENTIUM_M (1 << CPU_INTEL_PENTIUM_M_BIT)#define CPU_INTEL_CORE (1 << CPU_INTEL_CORE_BIT)#define CPU_INTEL_CORE2 (1 << CPU_INTEL_CORE2_BIT) +#define CPU_INTEL_XEON_7400 (1 << CPU_INTEL_XEON_7400_BIT) +#define CPU_INTEL_NEHALEM (1 << CPU_INTEL_NEHALEM_BIT)#define CPU_INTEL_ATOM (1 << CPU_INTEL_ATOM_BIT)#define CPU_INTEL_XEON_P4 (1 << CPU_INTEL_XEON_P4_BIT)#define CPU_INTEL_XEON_MP (1 << CPU_INTEL_XEON_MP_BIT)#define CPU_INTEL_PX (CPU_INTEL_P6 | CPU_INTEL_PENTIUM_M) -#define CPU_INTEL_COREX (CPU_INTEL_CORE | CPU_INTEL_CORE2) +#define CPU_INTEL_CORE2X (CPU_INTEL_CORE2 | CPU_INTEL_XEON_7400) +#define CPU_INTEL_COREX (CPU_INTEL_CORE | CPU_INTEL_CORE2X)#define CPU_INTEL_XEON (CPU_INTEL_XEON_P4 | CPU_INTEL_XEON_MP) +#define CPU_XEON_MPX (CPU_INTEL_XEON_MP | CPU_INTEL_XEON_7400) +#define CPU_XEON_NE (CPU_INTEL_XEON | CPU_INTEL_NEHALEM)#define CPU_CO_AT (CPU_INTEL_CORE | CPU_INTEL_ATOM) -#define CPU_C2_AT (CPU_INTEL_CORE2 | CPU_INTEL_ATOM) +#define CPU_C2_AT (CPU_INTEL_CORE2X | CPU_INTEL_ATOM)#define CPU_CX_AT (CPU_INTEL_COREX | CPU_INTEL_ATOM)#define CPU_CX_XE (CPU_INTEL_COREX | CPU_INTEL_XEON)#define CPU_P6_XE (CPU_INTEL_P6 | CPU_INTEL_XEON)#define CPU_PM_CO_AT (CPU_INTEL_PENTIUM_M | CPU_CO_AT)#define CPU_C2_AT_XE (CPU_C2_AT | CPU_INTEL_XEON)#define CPU_CX_AT_XE (CPU_CX_AT | CPU_INTEL_XEON) +#define CPU_C2_AT_NE (CPU_C2_AT | CPU_INTEL_NEHALEM) +#define CPU_CX_AT_NE (CPU_CX_AT | CPU_INTEL_NEHALEM)#define CPU_P6_CX_AT (CPU_INTEL_P6 | CPU_CX_AT)#define CPU_P6_CX_XE (CPU_P6_XE | CPU_INTEL_COREX) +#define CPU_C2_AT_XE_NE (CPU_C2_AT_XE | CPU_INTEL_NEHALEM) +#define CPU_CX_AT_XE_NE (CPU_CX_AT_XE | CPU_INTEL_NEHALEM) +#define CPU_P6_CX_AT_NE (CPU_P6_CX_AT | CPU_INTEL_NEHALEM) +#define CPU_P6_CX_XE_NE (CPU_P6_CX_XE | CPU_INTEL_NEHALEM)#define CPU_P6_CX_AT_XE (CPU_INTEL_P6 | CPU_CX_AT_XE)#define CPU_PM_CX_AT_XE (CPU_INTEL_PENTIUM_M | CPU_CX_AT_XE)#define CPU_PM_CX_AT (CPU_INTEL_PENTIUM_M | CPU_CX_AT)#define CPU_PM_CX_XE (CPU_INTEL_PENTIUM_M | CPU_CX_XE)#define CPU_PX_CX_AT (CPU_INTEL_PX | CPU_CX_AT) +#define CPU_PX_CX_XE (CPU_INTEL_PX | CPU_CX_XE)#define CPU_PX_CX_AT_XE (CPU_INTEL_PX | CPU_CX_AT_XE) +#define CPU_PM_CX_AT_NE (CPU_PM_CX_AT | CPU_INTEL_NEHALEM) +#define CPU_PX_CX_XE_NE (CPU_PX_CX_XE | CPU_INTEL_NEHALEM) +#define CPU_P6_CX_AT_XE_NE (CPU_P6_CX_AT_XE | CPU_INTEL_NEHALEM) +#define CPU_PX_CX_AT_XE_NE (CPU_PX_CX_AT_XE | CPU_INTEL_NEHALEM) +#define CPU_PM_CX_AT_XE_NE (CPU_PM_CX_AT_XE | CPU_INTEL_NEHALEM)/* Select all supported Intel CPUs */ #define CPU_INTEL_ALL (CPU_INTEL_PENTIUM | CPU_PX_CX_AT_XE)
arch/x86/kernel/cpu/cpu_debug.c +118 -65
345 lines not on this page · raw message
Quoted 12 lines · Jaswinder Singh Rajput
Review
Quoted 3 lines · Jaswinder Singh Rajput
(quoted diff) +1
-1{ "conf", CPU_CONF, 0 }, - { "smm", CPU_SMM, 0 }, + { "sm", CPU_SM, 0 },Here is new pull request after fixing this tab:
The following changes since commit88dc4c8e38d64db32907e0bd605f8c1ec4c4d1bd:
Ingo Molnar (1):
Merge branch 'tracing/ftrace'are available in the git repository at:
Quoted 9 lines
git://git.kernel.org/pub/scm/linux/kernel/git/jaswinder/linux-2.6-tip.gitmasterJaswinder Singh Rajput (5):
x86:cpu_debugadd support for Intel Xeon MP 7400 series
x86:cpu_debugadd support for Intel Nehalem microarchitecture
x86:cpu_debugavoid storingcpu_descriptorslocally where possible
x86:cpu_debug.cprepare report if files are inappropriate or CPU is not supported
x86:cpu_debug.cremove unwanted header files
After some minor fix and some additional patches here is new pull request:
The following changes since commit 88dc4c8e38d64db32907e0bd605f8c1ec4c4d1bd:
Ingo Molnar (1):
Merge branch 'tracing/ftrace'
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/jaswinder/linux-2.6-tip.git master
Jaswinder Singh Rajput (7):
x86: cpu_debug add support for Intel Xeon MP 7400 series
x86: cpu_debug add support for Intel Nehalem microarchitecture
x86: cpu_debug.c avoid storing cpu_descriptors locally where possible
x86: cpu_debug.c prepare report if files are inappropriate or CPU is not supported
x86: cpu_debug.c remove unwanted header files
x86: cpu_debug update Kconfig entry
x86: cpu_debug.c move some code from while loop functions to increase performance
arch/x86/Kconfig | 11 ++- arch/x86/include/asm/cpu_debug.h | 32 +++++- arch/x86/kernel/cpu/cpu_debug.c | 240 +++++++++++++++++++++++--------------- 3 files changed, 182 insertions(+), 101 deletions(-)
Complete diff:
arch/x86/Kconfig +10 -1
@@ -944,7 +944,16 @@ config X86_CPU_DEBUG tristate "/sys/kernel/debug/x86/cpu/* - CPU Debug support" ---help--- If you select this option, this will provide various x86 CPUs - information through debugfs. + information through debugfs. Any user can read these file but writing + needs root privilege. + + Note: 1. If you compile cpu_debug as a module, it will _not_ be loaded + automatically (like usual drivers). You will need to load it manually + (or add it to list of modules loaded during boot). + + 2. You need debugfs, if you want to mount debugfs automatically + append this line in /etc/fstab: + debugfs /sys/kernel/debug debugfs defaults 0 0 choice prompt "High Memory Support"
arch/x86/include/asm/cpu_debug.h +28 -4
@@ -35,7 +35,7 @@ enum cpu_debug_bit {CPU_BASE_BIT ,/* BASE Address */ CPU_VER_BIT ,/* Version ID */ CPU_CONF_BIT ,/* Configuration */ -CPU_SMM_BIT ,/* System mgmt mode */ +CPU_SM_BIT ,/* System Management */ CPU_SVM_BIT ,/*Secure Virtual Machine*/ CPU_OSVM_BIT, /* OS-Visible Workaround*//* Standard Registers */
@@ -73,7 +73,7 @@ enum cpu_debug_bit {#define CPU_BASE (1 << CPU_BASE_BIT)#define CPU_VER (1 << CPU_VER_BIT)#define CPU_CONF (1 << CPU_CONF_BIT) -#define CPU_SMM (1 << CPU_SMM_BIT) +#define CPU_SM (1 << CPU_SM_BIT)#define CPU_SVM (1 << CPU_SVM_BIT)#define CPU_OSVM (1 << CPU_OSVM_BIT)#define CPU_TSS (1 << CPU_TSS_BIT)
@@ -89,6 +89,7 @@ enum cpu_file_bit {#define CPU_FILE_VALUE (1 << CPU_VALUE_BIT)/* +* Intel CPU support * DisplayFamily_DisplayModel Processor Families/Processor Number Series * -------------------------- ------------------------------------------ * 05_01, 05_02, 05_04 Pentium, Pentium with MMX
@@ -106,8 +107,12 @@ enum cpu_file_bit {* Pentium dual-core * 06_17 Xeon 5200, 5400 series, Core 2 Quad Q9650 * +* 06_1A Core i7, Xeon Processor 5500 series (Nehalem) +* * 06_1C Atom * +* 06_1D Xeon MP 7400 series +* * 0F_00, 0F_01, 0F_02 Xeon, Xeon MP, Pentium 4 * 0F_03, 0F_04 Xeon, Xeon MP, Pentium 4, Pentium D *
@@ -124,6 +129,8 @@ enum cpu_processor_bit {CPU_INTEL_PENTIUM_M_BIT ,CPU_INTEL_CORE_BIT ,CPU_INTEL_CORE2_BIT , +CPU_INTEL_XEON_7400_BIT , +CPU_INTEL_NEHALEM_BIT ,CPU_INTEL_ATOM_BIT ,CPU_INTEL_XEON_P4_BIT , CPU_INTEL_XEON_MP_BIT,
@@ -141,29 +148,46 @@ enum cpu_processor_bit {#define CPU_INTEL_PENTIUM_M (1 << CPU_INTEL_PENTIUM_M_BIT)#define CPU_INTEL_CORE (1 << CPU_INTEL_CORE_BIT)#define CPU_INTEL_CORE2 (1 << CPU_INTEL_CORE2_BIT) +#define CPU_INTEL_XEON_7400 (1 << CPU_INTEL_XEON_7400_BIT) +#define CPU_INTEL_NEHALEM (1 << CPU_INTEL_NEHALEM_BIT)#define CPU_INTEL_ATOM (1 << CPU_INTEL_ATOM_BIT)#define CPU_INTEL_XEON_P4 (1 << CPU_INTEL_XEON_P4_BIT)#define CPU_INTEL_XEON_MP (1 << CPU_INTEL_XEON_MP_BIT)#define CPU_INTEL_PX (CPU_INTEL_P6 | CPU_INTEL_PENTIUM_M) -#define CPU_INTEL_COREX (CPU_INTEL_CORE | CPU_INTEL_CORE2) +#define CPU_INTEL_CORE2X (CPU_INTEL_CORE2 | CPU_INTEL_XEON_7400) +#define CPU_INTEL_COREX (CPU_INTEL_CORE | CPU_INTEL_CORE2X)#define CPU_INTEL_XEON (CPU_INTEL_XEON_P4 | CPU_INTEL_XEON_MP) +#define CPU_XEON_MPX (CPU_INTEL_XEON_MP | CPU_INTEL_XEON_7400) +#define CPU_XEON_NE (CPU_INTEL_XEON | CPU_INTEL_NEHALEM)#define CPU_CO_AT (CPU_INTEL_CORE | CPU_INTEL_ATOM) -#define CPU_C2_AT (CPU_INTEL_CORE2 | CPU_INTEL_ATOM) +#define CPU_C2_AT (CPU_INTEL_CORE2X | CPU_INTEL_ATOM)#define CPU_CX_AT (CPU_INTEL_COREX | CPU_INTEL_ATOM)#define CPU_CX_XE (CPU_INTEL_COREX | CPU_INTEL_XEON)#define CPU_P6_XE (CPU_INTEL_P6 | CPU_INTEL_XEON)#define CPU_PM_CO_AT (CPU_INTEL_PENTIUM_M | CPU_CO_AT)#define CPU_C2_AT_XE (CPU_C2_AT | CPU_INTEL_XEON)#define CPU_CX_AT_XE (CPU_CX_AT | CPU_INTEL_XEON) +#define CPU_C2_AT_NE (CPU_C2_AT | CPU_INTEL_NEHALEM) +#define CPU_CX_AT_NE (CPU_CX_AT | CPU_INTEL_NEHALEM)#define CPU_P6_CX_AT (CPU_INTEL_P6 | CPU_CX_AT)#define CPU_P6_CX_XE (CPU_P6_XE | CPU_INTEL_COREX) +#define CPU_C2_AT_XE_NE (CPU_C2_AT_XE | CPU_INTEL_NEHALEM) +#define CPU_CX_AT_XE_NE (CPU_CX_AT_XE | CPU_INTEL_NEHALEM) +#define CPU_P6_CX_AT_NE (CPU_P6_CX_AT | CPU_INTEL_NEHALEM) +#define CPU_P6_CX_XE_NE (CPU_P6_CX_XE | CPU_INTEL_NEHALEM)#define CPU_P6_CX_AT_XE (CPU_INTEL_P6 | CPU_CX_AT_XE)#define CPU_PM_CX_AT_XE (CPU_INTEL_PENTIUM_M | CPU_CX_AT_XE)#define CPU_PM_CX_AT (CPU_INTEL_PENTIUM_M | CPU_CX_AT)#define CPU_PM_CX_XE (CPU_INTEL_PENTIUM_M | CPU_CX_XE)#define CPU_PX_CX_AT (CPU_INTEL_PX | CPU_CX_AT) +#define CPU_PX_CX_XE (CPU_INTEL_PX | CPU_CX_XE)#define CPU_PX_CX_AT_XE (CPU_INTEL_PX | CPU_CX_AT_XE) +#define CPU_PM_CX_AT_NE (CPU_PM_CX_AT | CPU_INTEL_NEHALEM) +#define CPU_PX_CX_XE_NE (CPU_PX_CX_XE | CPU_INTEL_NEHALEM) +#define CPU_P6_CX_AT_XE_NE (CPU_P6_CX_AT_XE | CPU_INTEL_NEHALEM) +#define CPU_PX_CX_AT_XE_NE (CPU_PX_CX_AT_XE | CPU_INTEL_NEHALEM) +#define CPU_PM_CX_AT_XE_NE (CPU_PM_CX_AT_XE | CPU_INTEL_NEHALEM)/* Select all supported Intel CPUs */ #define CPU_INTEL_ALL (CPU_INTEL_PENTIUM | CPU_PX_CX_AT_XE)
arch/x86/kernel/cpu/cpu_debug.c +144 -96
460 lines not on this page · raw message
arch/x86/kernel/cpu/cpu_debug.c line 37
Quoted 8 lines · Jaswinder Singh Rajput
static
DEFINE_PER_CPU(struct cpu_cpuX_base, cpu_arr[CPU_REG_ALL_BIT]); staticDEFINE_PER_CPU(struct cpu_private *, priv_arr[MAX_CPU_FILES]); staticDEFINE_PER_CPU(unsigned, cpu_modelflag);
staticDEFINE_PER_CPU(int, cpu_priv_count);arch/x86/kernel/cpu/cpu_debug.c +3
-1-static DEFINE_PER_CPU(unsigned, cpu_model); + +/* Storing vendor locally because it is used excessive in this code */ +static unsigned cpu_vendor;
There's still no need to store it locally - what's wrong with cpu_data(cpu) or current_cpu_data?
Also, do we need the per-cpu cpu_modelflag variable too? I'd suggest to integrate that kind of enumeration into struct cpuinfo_x86 and cpu_info. We often have such kinds of constructs in x86 code:
c->x86 <= 0x11
So extending your scheme to other code would benefit all code.
Plus this kind of enumeration:
switch (model) {
case 0x0501:
case 0x0502:
case 0x0504:
flag = CPU_INTEL_PENTIUM;
break;
case 0x0601:
case 0x0603:
case 0x0605:
case 0x0607:
case 0x0608:
case 0x060A:
case 0x060B:
flag = CPU_INTEL_P6;The 0x05/0x06 there is already available as the family flag in cpuinfo_x86, as cpu_info::x86. The 01,02...0B model portion is also already available as cpu_info::x86_model.
[ there's also cpu_info::x86_mask, which gives the stepping. ]
This is what i meant when i said that you needlessly duplicate already existing information. You encode/decode it in some weird looking way instead of using the already existing, per CPU information of cpu_info.
Ingo
Quoted 14 lines · Ingo Molnar
Review
Quoted 8 lines · Jaswinder Singh Rajput
static
DEFINE_PER_CPU(struct cpu_cpuX_base, cpu_arr[CPU_REG_ALL_BIT]); staticDEFINE_PER_CPU(struct cpu_private *, priv_arr[MAX_CPU_FILES]); staticDEFINE_PER_CPU(unsigned, cpu_modelflag);
staticDEFINE_PER_CPU(int, cpu_priv_count);(quoted diff) +3
-1-static DEFINE_PER_CPU(unsigned, cpu_model); + +/* Storing vendor locally because it is used excessive in this code */ +static unsigned cpu_vendor;There's still no need to store it locally - what's wrong with
cpu_data(cpu)orcurrent_cpu_data?
Sorry for delay. I was not feeling well.
OK fixed.
Quoted 7 lines
Also, do we need the per-cpu
cpu_modelflagvariable too? I'd suggest to integrate that kind of enumeration into structcpuinfo_x86andcpu_info. We often have such kinds of constructs in x86 code:c->x86 <= 0x11So extending your scheme to other code would benefit all code.
OK, I will do this in next pull request.
Here is updated pull request:
The following changes since commit 88dc4c8e38d64db32907e0bd605f8c1ec4c4d1bd:
Ingo Molnar (1):
Merge branch 'tracing/ftrace'
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/jaswinder/linux-2.6-tip.git master
Jaswinder Singh Rajput (6):
x86: cpu_debug add support for Intel Xeon MP 7400 series
x86: cpu_debug add support for Intel Nehalem microarchitecture
x86: cpu_debug.c avoid storing cpu_descriptors locally
x86: cpu_debug.c prepare report if files are inappropriate or CPU is not supported
x86: cpu_debug.c remove unwanted header files
x86: cpu_debug update Kconfig entry
arch/x86/Kconfig | 11 ++- arch/x86/include/asm/cpu_debug.h | 32 ++++++- arch/x86/kernel/cpu/cpu_debug.c | 194 ++++++++++++++++++++++++-------------- 3 files changed, 162 insertions(+), 75 deletions(-)
Complete diff:
arch/x86/Kconfig +10 -1
@@ -944,7 +944,16 @@ config X86_CPU_DEBUG tristate "/sys/kernel/debug/x86/cpu/* - CPU Debug support" ---help--- If you select this option, this will provide various x86 CPUs - information through debugfs. + information through debugfs. Any user can read these file but writing + needs root privilege. + + Note: 1. If you compile cpu_debug as a module, it will _not_ be loaded + automatically (like usual drivers). You will need to load it manually + (or add it to list of modules loaded during boot). + + 2. You need debugfs, if you want to mount debugfs automatically + append this line in /etc/fstab: + debugfs /sys/kernel/debug debugfs defaults 0 0 choice prompt "High Memory Support"
arch/x86/include/asm/cpu_debug.h +28 -4
@@ -35,7 +35,7 @@ enum cpu_debug_bit {CPU_BASE_BIT ,/* BASE Address */ CPU_VER_BIT ,/* Version ID */ CPU_CONF_BIT ,/* Configuration */ -CPU_SMM_BIT ,/* System mgmt mode */ +CPU_SM_BIT ,/* System Management */ CPU_SVM_BIT ,/*Secure Virtual Machine*/ CPU_OSVM_BIT, /* OS-Visible Workaround*//* Standard Registers */
@@ -73,7 +73,7 @@ enum cpu_debug_bit {#define CPU_BASE (1 << CPU_BASE_BIT)#define CPU_VER (1 << CPU_VER_BIT)#define CPU_CONF (1 << CPU_CONF_BIT) -#define CPU_SMM (1 << CPU_SMM_BIT) +#define CPU_SM (1 << CPU_SM_BIT)#define CPU_SVM (1 << CPU_SVM_BIT)#define CPU_OSVM (1 << CPU_OSVM_BIT)#define CPU_TSS (1 << CPU_TSS_BIT)
@@ -89,6 +89,7 @@ enum cpu_file_bit {#define CPU_FILE_VALUE (1 << CPU_VALUE_BIT)/* +* Intel CPU support * DisplayFamily_DisplayModel Processor Families/Processor Number Series * -------------------------- ------------------------------------------ * 05_01, 05_02, 05_04 Pentium, Pentium with MMX
@@ -106,8 +107,12 @@ enum cpu_file_bit {* Pentium dual-core * 06_17 Xeon 5200, 5400 series, Core 2 Quad Q9650 * +* 06_1A Core i7, Xeon Processor 5500 series (Nehalem) +* * 06_1C Atom * +* 06_1D Xeon MP 7400 series +* * 0F_00, 0F_01, 0F_02 Xeon, Xeon MP, Pentium 4 * 0F_03, 0F_04 Xeon, Xeon MP, Pentium 4, Pentium D *
@@ -124,6 +129,8 @@ enum cpu_processor_bit {CPU_INTEL_PENTIUM_M_BIT ,CPU_INTEL_CORE_BIT ,CPU_INTEL_CORE2_BIT , +CPU_INTEL_XEON_7400_BIT , +CPU_INTEL_NEHALEM_BIT ,CPU_INTEL_ATOM_BIT ,CPU_INTEL_XEON_P4_BIT , CPU_INTEL_XEON_MP_BIT,
@@ -141,29 +148,46 @@ enum cpu_processor_bit {#define CPU_INTEL_PENTIUM_M (1 << CPU_INTEL_PENTIUM_M_BIT)#define CPU_INTEL_CORE (1 << CPU_INTEL_CORE_BIT)#define CPU_INTEL_CORE2 (1 << CPU_INTEL_CORE2_BIT) +#define CPU_INTEL_XEON_7400 (1 << CPU_INTEL_XEON_7400_BIT) +#define CPU_INTEL_NEHALEM (1 << CPU_INTEL_NEHALEM_BIT)#define CPU_INTEL_ATOM (1 << CPU_INTEL_ATOM_BIT)#define CPU_INTEL_XEON_P4 (1 << CPU_INTEL_XEON_P4_BIT)#define CPU_INTEL_XEON_MP (1 << CPU_INTEL_XEON_MP_BIT)#define CPU_INTEL_PX (CPU_INTEL_P6 | CPU_INTEL_PENTIUM_M) -#define CPU_INTEL_COREX (CPU_INTEL_CORE | CPU_INTEL_CORE2) +#define CPU_INTEL_CORE2X (CPU_INTEL_CORE2 | CPU_INTEL_XEON_7400) +#define CPU_INTEL_COREX (CPU_INTEL_CORE | CPU_INTEL_CORE2X)#define CPU_INTEL_XEON (CPU_INTEL_XEON_P4 | CPU_INTEL_XEON_MP) +#define CPU_XEON_MPX (CPU_INTEL_XEON_MP | CPU_INTEL_XEON_7400) +#define CPU_XEON_NE (CPU_INTEL_XEON | CPU_INTEL_NEHALEM)#define CPU_CO_AT (CPU_INTEL_CORE | CPU_INTEL_ATOM) -#define CPU_C2_AT (CPU_INTEL_CORE2 | CPU_INTEL_ATOM) +#define CPU_C2_AT (CPU_INTEL_CORE2X | CPU_INTEL_ATOM)#define CPU_CX_AT (CPU_INTEL_COREX | CPU_INTEL_ATOM)#define CPU_CX_XE (CPU_INTEL_COREX | CPU_INTEL_XEON)#define CPU_P6_XE (CPU_INTEL_P6 | CPU_INTEL_XEON)#define CPU_PM_CO_AT (CPU_INTEL_PENTIUM_M | CPU_CO_AT)#define CPU_C2_AT_XE (CPU_C2_AT | CPU_INTEL_XEON)#define CPU_CX_AT_XE (CPU_CX_AT | CPU_INTEL_XEON) +#define CPU_C2_AT_NE (CPU_C2_AT | CPU_INTEL_NEHALEM) +#define CPU_CX_AT_NE (CPU_CX_AT | CPU_INTEL_NEHALEM)#define CPU_P6_CX_AT (CPU_INTEL_P6 | CPU_CX_AT)#define CPU_P6_CX_XE (CPU_P6_XE | CPU_INTEL_COREX) +#define CPU_C2_AT_XE_NE (CPU_C2_AT_XE | CPU_INTEL_NEHALEM) +#define CPU_CX_AT_XE_NE (CPU_CX_AT_XE | CPU_INTEL_NEHALEM) +#define CPU_P6_CX_AT_NE (CPU_P6_CX_AT | CPU_INTEL_NEHALEM) +#define CPU_P6_CX_XE_NE (CPU_P6_CX_XE | CPU_INTEL_NEHALEM)#define CPU_P6_CX_AT_XE (CPU_INTEL_P6 | CPU_CX_AT_XE)#define CPU_PM_CX_AT_XE (CPU_INTEL_PENTIUM_M | CPU_CX_AT_XE)#define CPU_PM_CX_AT (CPU_INTEL_PENTIUM_M | CPU_CX_AT)#define CPU_PM_CX_XE (CPU_INTEL_PENTIUM_M | CPU_CX_XE)#define CPU_PX_CX_AT (CPU_INTEL_PX | CPU_CX_AT) +#define CPU_PX_CX_XE (CPU_INTEL_PX | CPU_CX_XE)#define CPU_PX_CX_AT_XE (CPU_INTEL_PX | CPU_CX_AT_XE) +#define CPU_PM_CX_AT_NE (CPU_PM_CX_AT | CPU_INTEL_NEHALEM) +#define CPU_PX_CX_XE_NE (CPU_PX_CX_XE | CPU_INTEL_NEHALEM) +#define CPU_P6_CX_AT_XE_NE (CPU_P6_CX_AT_XE | CPU_INTEL_NEHALEM) +#define CPU_PX_CX_AT_XE_NE (CPU_PX_CX_AT_XE | CPU_INTEL_NEHALEM) +#define CPU_PM_CX_AT_XE_NE (CPU_PM_CX_AT_XE | CPU_INTEL_NEHALEM)/* Select all supported Intel CPUs */ #define CPU_INTEL_ALL (CPU_INTEL_PENTIUM | CPU_PX_CX_AT_XE)
arch/x86/kernel/cpu/cpu_debug.c +124 -70
369 lines not on this page · raw message
arch/x86/kernel/cpu/cpu_debug.c static int cpu_init_cpu(void) · line 908
Quoted 11 lines · Jaswinder Singh Rajput
arch/x86/kernel/cpu/cpu_debug.c +3
-4@@ -850,10 +903,10 @@ static int cpu_init_cpu(void) cpui = &cpu_data (cpu);if (!cpu_has (cpui,X86_FEATURE_MSR ))continue ; -per_cpu (cpu_model, cpu) = ((cpui->x86_vendor <<16 ) | - (cpui->x86 <<8 ) | - (cpui->x86_model)); -per_cpu (cpu_modelflag, cpu) =get_cpu_modelflag (cpu); +per_cpu (cpu_modelflag, cpu) =get_cpu_flag (cpui); +if (!per_cpu (cpu_modelflag, cpu)) +send_report (per_cpu (cpu_priv_count, cpu), cpui);
This means that if the CPU is not enumerated in the model table explicitly, we'll fall back to some really minimal output, right?
Ingo
Quoted 17 lines · Ingo Molnar
arch/x86/kernel/cpu/cpu_debug.c static int cpu_init_cpu(void) · line 908
Quoted 11 lines · Jaswinder Singh Rajput
arch/x86/kernel/cpu/cpu_debug.c +3
-4@@ -850,10 +903,10 @@ static int cpu_init_cpu(void) cpui = &cpu_data (cpu);if (!cpu_has (cpui,X86_FEATURE_MSR ))continue ; -per_cpu (cpu_model, cpu) = ((cpui->x86_vendor <<16 ) | - (cpui->x86 <<8 ) | - (cpui->x86_model)); -per_cpu (cpu_modelflag, cpu) =get_cpu_modelflag (cpu); +per_cpu (cpu_modelflag, cpu) =get_cpu_flag (cpui); +if (!per_cpu (cpu_modelflag, cpu)) +send_report (per_cpu (cpu_priv_count, cpu), cpui);This means that if the CPU is not enumerated in the model table explicitly, we'll fall back to some really minimal output, right?
Yes.
--
JSR
Quoted 19 lines · Jaswinder Singh Rajput
Quoted 17 lines · Ingo Molnar
arch/x86/kernel/cpu/cpu_debug.c static int cpu_init_cpu(void) · line 908
Quoted 11 lines · Jaswinder Singh Rajput
arch/x86/kernel/cpu/cpu_debug.c +3
-4@@ -850,10 +903,10 @@ static int cpu_init_cpu(void) cpui = &cpu_data (cpu);if (!cpu_has (cpui,X86_FEATURE_MSR ))continue ; -per_cpu (cpu_model, cpu) = ((cpui->x86_vendor <<16 ) | - (cpui->x86 <<8 ) | - (cpui->x86_model)); -per_cpu (cpu_modelflag, cpu) =get_cpu_modelflag (cpu); +per_cpu (cpu_modelflag, cpu) =get_cpu_flag (cpui); +if (!per_cpu (cpu_modelflag, cpu)) +send_report (per_cpu (cpu_priv_count, cpu), cpui);This means that if the CPU is not enumerated in the model table explicitly, we'll fall back to some really minimal output, right?
Quoted 1 line
Yes.
That's a bug really: it means that for every new CPU type that comes around we need to update this code. I.e. precisely for those CPUs where we might need the most help from such a debug facility, we wont have much info to look at ... New CPUs generally support all the CPU features that are displayed here, in a compatible manner.
So that needs to be improved/changed to not be tied to such a static 'cpu model' enumeration but instead be CPU feature flags driven. See all the existing cpu_has_*() tests we have.
Ingo
Quoted 29 lines · Ingo Molnar
Quoted 19 lines · Jaswinder Singh Rajput
Quoted 17 lines · Ingo Molnar
arch/x86/kernel/cpu/cpu_debug.c static int cpu_init_cpu(void) · line 908
Quoted 11 lines · Jaswinder Singh Rajput
arch/x86/kernel/cpu/cpu_debug.c +3
-4@@ -850,10 +903,10 @@ static int cpu_init_cpu(void) cpui = &cpu_data (cpu);if (!cpu_has (cpui,X86_FEATURE_MSR ))continue ; -per_cpu (cpu_model, cpu) = ((cpui->x86_vendor <<16 ) | - (cpui->x86 <<8 ) | - (cpui->x86_model)); -per_cpu (cpu_modelflag, cpu) =get_cpu_modelflag (cpu); +per_cpu (cpu_modelflag, cpu) =get_cpu_flag (cpui); +if (!per_cpu (cpu_modelflag, cpu)) +send_report (per_cpu (cpu_priv_count, cpu), cpui);This means that if the CPU is not enumerated in the model table explicitly, we'll fall back to some really minimal output, right?
Quoted 1 line
Yes.
That's a bug really: it means that for every new CPU type that comes around we need to update this code. I.e. precisely for those CPUs where we might need the most help from such a debug facility, we wont have much info to look at ... New CPUs generally support all the CPU features that are displayed here, in a compatible manner.
Quoted 4 lines
So that needs to be improved/changed to not be tied to such a static 'cpu model' enumeration but instead be CPU feature flags driven. See all the existing cpu_has_*() tests we have.
cpu_has_*() is based on boot_cpu. So you mean cpu_has tests. right ?
We can use cpu_has tests for unknown processors but 'cpu model' is accurate and cover all range.
cpu_has does not cover following registers:
1. platform
2. poweron
3. control
4. bios
5. freq
6. cache
7. misc
8. base
9. ver
10. conf
So is this looks OK to you:
1. first check for 'cpu model' if CPU not supported then goto 2
2. check for cpu_has tests
--
JSR
Quoted 30 lines · Jaswinder Singh Rajput
Quoted 29 lines · Ingo Molnar
Quoted 19 lines · Jaswinder Singh Rajput
Quoted 17 lines · Ingo Molnar
arch/x86/kernel/cpu/cpu_debug.c static int cpu_init_cpu(void) · line 908
Quoted 11 lines · Jaswinder Singh Rajput
arch/x86/kernel/cpu/cpu_debug.c +3
-4@@ -850,10 +903,10 @@ static int cpu_init_cpu(void) cpui = &cpu_data (cpu);if (!cpu_has (cpui,X86_FEATURE_MSR ))continue ; -per_cpu (cpu_model, cpu) = ((cpui->x86_vendor <<16 ) | - (cpui->x86 <<8 ) | - (cpui->x86_model)); -per_cpu (cpu_modelflag, cpu) =get_cpu_modelflag (cpu); +per_cpu (cpu_modelflag, cpu) =get_cpu_flag (cpui); +if (!per_cpu (cpu_modelflag, cpu)) +send_report (per_cpu (cpu_priv_count, cpu), cpui);This means that if the CPU is not enumerated in the model table explicitly, we'll fall back to some really minimal output, right?
Quoted 1 line
Yes.
That's a bug really: it means that for every new CPU type that comes around we need to update this code. I.e. precisely for those CPUs where we might need the most help from such a debug facility, we wont have much info to look at ... New CPUs generally support all the CPU features that are displayed here, in a compatible manner.
Quoted 6 lines
Quoted 4 lines
So that needs to be improved/changed to not be tied to such a static 'cpu model' enumeration but instead be CPU feature flags driven. See all the existing cpu_has_*() tests we have.
cpu_has_*() is based on
boot_cpu. So you meancpu_hastests. right ?
Correct.
Quoted 2 lines
We can use
cpu_hastests for unknown processors but 'cpu model' is accurate and cover all range.
So is cpu_has. If it's not accurate then various other pieces of x86 code might break as well.
Quoted 12 lines
cpu_hasdoes not cover following registers:
1. platform
2. poweron
3. control
4. bios
5. freq
6. cache
7. misc
8. base
9. ver
10. conf
Quoted 4 lines
So is this looks OK to you:
1. first check for 'cpu model' if CPU not supported then goto 2
2. check forcpu_hastests
No, please get rid of the 'cpu model' based feature tests altogether and extend the _existing_ feature flags with the above details, when needed.
That way we reuse the existing cpu_has checks and extend them. Instead of implementing a private facility in cpu_debug.c.
Ingo
Quoted 14 lines · Jaswinder Singh Rajput
We can use
cpu_hastests for unknown processors but 'cpu model' is accurate and cover all range.
cpu_hasdoes not cover following registers:
1. platform
2. poweron
3. control
4. bios
5. freq
6. cache
7. misc
8. base
9. ver
10. conf
Firstly these should be added to cpufeatures.h.
Then add cpu_has_xxx() accessors need to be added for them and during CPU init they have to be properly set, via two methods:
- via CPUID (where this is possible+specified in docs)
- or via "later than CPU version X" checks
Your cpu-model table is equivalent to an explicitly enumerated CPU version check, but this breaks every time a new CPU comes out.
"Later than" or CPUID based feature bits are a lot more future-proof
- we only have to add support for new _features_ (and quirks, occasionally), and dont have to maintain that full table of specific models to specific features mapping tables.
Ingo
RFC 1/1 x86: cpu_debug and cpufeature patches
Quoted 25 lines · Ingo Molnar
Quoted 14 lines · Jaswinder Singh Rajput
We can use
cpu_hastests for unknown processors but 'cpu model' is accurate and cover all range.
cpu_hasdoes not cover following registers:
1. platform
2. poweron
3. control
4. bios
5. freq
6. cache
7. misc
8. base
9. ver
10. confFirstly these should be added to
cpufeatures.h.Then add
cpu_has_xxx()accessors need to be added for them and during CPU init they have to be properly set, via two methods:- via CPUID (where this is possible+specified in docs)
- or via "later than CPU version X" checks
Quoted 8 lines
Your cpu-model table is equivalent to an explicitly enumerated CPU version check, but this breaks every time a new CPU comes out.
"Later than" or CPUID based feature bits are a lot more future-proof
- we only have to add support for new _features_ (and quirks, occasionally), and dont have to maintain that full table of specific models to specific features mapping tables.
I add some cpufeatures for review, I am still adding rest of them.
The following changes since commit c861b6f8ea9b39699f4a35bbf7dc06eb937a34de:
Ingo Molnar (1):
Merge branch 'irq/urgent'
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/jaswinder/linux-2.6-tip.git master
Jaswinder Singh Rajput (6):
x86: cpu_debug.c avoid storing cpu_descriptors locally
x86: cpu_debug update Kconfig entry
x86: cpu_debug.c remove unwanted header files
x86: Add cpufeature for Processor Name
x86: Add cpufeatures for Advanced Power Management
x86: Add cpufeature for Microcode update
arch/x86/Kconfig | 11 ++++++++- arch/x86/include/asm/cpufeature.h | 21 ++++++++++++++---- arch/x86/include/asm/processor.h | 1 - arch/x86/kernel/cpu/Makefile | 2 +- arch/x86/kernel/cpu/amd.c | 9 -------- arch/x86/kernel/cpu/common.c | 16 +++++++++++++- arch/x86/kernel/cpu/cpu_debug.c | 42 +++++++++++++++++------------------- arch/x86/kernel/cpu/intel.c | 14 ------------ arch/x86/kernel/cpu/powerflags.c | 20 ----------------- arch/x86/kernel/cpu/proc.c | 14 ------------ arch/x86/kernel/microcode_amd.c | 3 ++ arch/x86/kernel/microcode_intel.c | 3 ++ 12 files changed, 68 insertions(+), 88 deletions(-) delete mode 100644 arch/x86/kernel/cpu/powerflags.c
Complete diff:
arch/x86/Kconfig +10 -1
@@ -951,7 +951,16 @@ config X86_CPU_DEBUG tristate "/sys/kernel/debug/x86/cpu/* - CPU Debug support" ---help--- If you select this option, this will provide various x86 CPUs - information through debugfs. + information through debugfs. Any user can read these file but writing + needs root privilege. + + Note: 1. If you compile cpu_debug as a module, it will _not_ be loaded + automatically (like usual drivers). You will need to load it manually + (or add it to list of modules loaded during boot). + + 2. You need debugfs, if you want to mount debugfs automatically + append this line in /etc/fstab: + debugfs /sys/kernel/debug debugfs defaults 0 0 choice prompt "High Memory Support"
arch/x86/include/asm/cpufeature.h +16 -5
@@ -6,7 +6,7 @@#include <asm/required-features.h> -#define NCAPINTS 9/* N 32-bit words worth of info */ +#define NCAPINTS 10/* N 32-bit words worth of info */ /* * Note: If the comment begins with a quoted string, that string is used
@@ -76,7 +76,6 @@#define X86_FEATURE_K7 (3*32+ 5)/* "" Athlon */ #define X86_FEATURE_P3 (3*32+ 6)/* "" P3 */ #define X86_FEATURE_P4 (3*32+ 7)/* "" P4 */ -#define X86_FEATURE_CONSTANT_TSC (3*32+ 8)/* TSC ticks at a constant rate */ #define X86_FEATURE_UP (3*32+ 9)/* smp kernel running on up */ #define X86_FEATURE_FXSAVE_LEAK (3*32+10)/* "" FXSAVE leaks FOP/FIP/FOP */ #define X86_FEATURE_ARCH_PERFMON (3*32+11)/* Intel Architectural PerfMon */
@@ -153,8 +152,10 @@* Auxiliary flags: Linux defined - For features scattered in various * CPUID levels like 0x6, 0xA etc */ -#define X86_FEATURE_IDA (7*32+ 0)/* Intel Dynamic Acceleration */ -#define X86_FEATURE_ARAT (7*32+ 1)/* Always Running APIC Timer */ +#define X86_FEATURE_IDA (7*32+ 0)/* Intel Dynamic Acceleration */ +#define X86_FEATURE_ARAT (7*32+ 1)/* Always Running APIC Timer */ +#define X86_FEATURE_PNAME (7*32+ 2)/* Processor Name */ +#define X86_FEATURE_MICROCODE (7*32+ 3)/* Microcode update */ /* Virtualization flags: Linux defined */ #define X86_FEATURE_TPR_SHADOW (8*32+ 0)/* Intel TPR Shadow */
@@ -163,12 +164,22 @@#define X86_FEATURE_EPT (8*32+ 3)/* Intel Extended Page Table */ #define X86_FEATURE_VPID (8*32+ 4)/* Intel Virtual Processor ID */ +/* Advanced Power Management (Function 8000_0007h), edx */ +#define X86_FEATURE_TS (9*32+ 0)/* Temperatue sensor */ +#define X86_FEATURE_FID (9*32+ 1)/* Frequency ID control */ +#define X86_FEATURE_VID (9*32+ 2)/* Voltage ID control */ +#define X86_FEATURE_TTP (9*32+ 3)/* Thermal trip */ +#define X86_FEATURE_HTC (9*32+ 4)/* Hardware thermal control */ +#define X86_FEATURE_STC (9*32+ 5)/* Software thermal control */ +#define X86_FEATURE_100MHZSTEPS (9*32+ 6)/* 100 MHz multiplier control */ +#define X86_FEATURE_HWPSTATE (9*32+ 7)/* Hardware P-State control */ +#define X86_FEATURE_CONSTANT_TSC (9*32+ 8)/* Constant rate TSC ticks */ +#if defined(__KERNEL__) && !defined(__ASSEMBLY__)#include <linux/bitops.h> extern const char *const x86_cap_flags[NCAPINTS *32 ]; -extern const char *const x86_power_flags[32 ];#define test_cpu_cap (c, bit) \ test_bit(bit, (unsigned long *)((c)->x86_capability))
arch/x86/include/asm/processor.h +0 -1
@@ -90,7 +90,6 @@ struct cpuinfo_x86 {/* in KB - valid for CPUS which support this call: */ int x86_cache_size;int x86_cache_alignment;/* In bytes */ -int x86_power;unsigned long loops_per_jiffy;#ifdef CONFIG_SMP /* cpus sharing the last level cache: */
arch/x86/kernel/cpu/Makefile +1 -1
@@ -8,7 +8,7 @@ CFLAGS_REMOVE_common.o = -pg endif obj-y := intel_cacheinfo.o addon_cpuid_features.o -obj-y += proc.o capflags.o powerflags.o common.o +obj-y += proc.o capflags.o common.o obj-y += vmware.o hypervisor.o obj-$(CONFIG_X86_32) += bugs.o cmpxchg.o
arch/x86/kernel/cpu/amd.c +0 -9
@@ -333,15 +333,6 @@ static void __cpuinit early_init_amd(struct cpuinfo_x86 *c) {early_init_amd_mc (c); -/* -* c->x86_power is 8000_0007 edx. Bit 8 is TSC runs at constant rate -* with P/T states and does not stop in deep C-states -*/ -if (c->x86_power & (1 <<8 )) { -set_cpu_cap (c,X86_FEATURE_CONSTANT_TSC ); -set_cpu_cap (c,X86_FEATURE_NONSTOP_TSC ); - } -#ifdef CONFIG_X86_64 set_cpu_cap (c,X86_FEATURE_SYSCALL32 );#else
arch/x86/kernel/cpu/common.c +15 -1
@@ -360,6 +360,7 @@ static void __cpuinit get_model_name(struct cpuinfo_x86 *c)cpuid (0x80000003 , &v[4 ], &v[5 ], &v[6 ], &v[7 ]);cpuid (0x80000004 , &v[8 ], &v[9 ], &v[10 ], &v[11 ]); c->x86_model_id[48 ] =0 ; +set_cpu_cap (c,X86_FEATURE_PNAME );/* * Intel chips right-justify this string for some dumb reason;
@@ -575,8 +576,21 @@ static void __cpuinit get_cpu_cap(struct cpuinfo_x86 *c)#endif if (c->extended_cpuid_level >=0x80000007 ) - c->x86_power =cpuid_edx (0x80000007 ); + c->x86_capability[9 ] =cpuid_edx (0x80000007 ); +/* +* Advanced power management is 8000_0007 edx. +* Bit 8 is TSC runs at constant rate with P/T states +* and does not stop in deep C-states. +* +* It is also reliable across cores and sockets. (but not across +* cabinets - we turn it off in that case explicitly.) +*/ +if (cpu_has (c,X86_FEATURE_CONSTANT_TSC )) { +set_cpu_cap (c,X86_FEATURE_NONSTOP_TSC ); +set_cpu_cap (c,X86_FEATURE_TSC_RELIABLE ); + sched_clock_stable =1 ; + } }static void __cpuinit identify_cpu_without_cpuid (struct cpuinfo_x86 *c)
arch/x86/kernel/cpu/cpu_debug.c +20 -22
130 lines not on this page · raw message
arch/x86/kernel/cpu/intel.c +0 -14
@@ -61,20 +61,6 @@ static void __cpuinit early_init_intel(struct cpuinfo_x86 *c) c->x86_phys_bits =36 ;/* -* c->x86_power is 8000_0007 edx. Bit 8 is TSC runs at constant rate -* with P/T states and does not stop in deep C-states. -* -* It is also reliable across cores and sockets. (but not across -* cabinets - we turn it off in that case explicitly.) -*/ -if (c->x86_power & (1 <<8 )) { -set_cpu_cap (c,X86_FEATURE_CONSTANT_TSC ); -set_cpu_cap (c,X86_FEATURE_NONSTOP_TSC ); -set_cpu_cap (c,X86_FEATURE_TSC_RELIABLE ); - sched_clock_stable =1 ; - } - -/* * There is a known erratum on Pentium III and Core Solo * and Core Duo CPUs. * " Page with PAT set to WC while associated MTRR is UC
arch/x86/kernel/cpu/powerflags.c deleted +0 -20
@@ -1,20 +0,0 @@ -/* -* Strings for the various x86 power flags -* -* This file must not contain any executable code. -*/ - -#include <asm/cpufeature.h> - -const char *const x86_power_flags[32 ] = { -"ts" ,/* temperature sensor */ -"fid" ,/* frequency id control */ -"vid" ,/* voltage id control */ -"ttp" ,/* thermal trip */ -"tm" , -"stc" , -"100mhzsteps" , -"hwpstate" , -"" ,/* tsc invariant mapped to constant_tsc */ -/* nothing */ -};
arch/x86/kernel/cpu/proc.c +0 -14
@@ -121,20 +121,6 @@ static int show_cpuinfo(struct seq_file *m, void *v)seq_printf (m,"address sizes\t: %u bits physical, %u bits virtual\n" , c->x86_phys_bits, c->x86_virt_bits);#endif - -seq_printf (m,"power management:" ); -for (i =0 ; i <32 ; i++) { -if (c->x86_power & (1 << i)) { -if (i <ARRAY_SIZE (x86_power_flags) && - x86_power_flags[i]) -seq_printf (m,"%s%s" , - x86_power_flags[i][0 ]?" " :"" , - x86_power_flags[i]); -else -seq_printf (m," [%d]" , i); - } - } -seq_printf (m,"\n\n" );return 0 ;
arch/x86/kernel/microcode_amd.c +3 -0
@@ -141,6 +141,9 @@ static int get_matching_microcode(int cpu, void *mc, int rev)if (mc_header->patch_id <= rev)return 0 ; +/* setting microcode update feature to friendly access of UCODE MSRs */ +set_cpu_cap (c,X86_FEATURE_MICROCODE ); +return 1 ; }
arch/x86/kernel/microcode_intel.c +3 -0
@@ -168,6 +168,9 @@ static int collect_cpu_info(int cpu_num, struct cpu_signature *csig)return -1 ; } +/* setting microcode update feature to friendly access of UCODE MSRs */ +set_cpu_cap (c,X86_FEATURE_MICROCODE ); + csig->sig =cpuid_eax (0x00000001 );if ((c->x86_model >=5 ) || (c->x86 >6 )) {
Re: [RFC][git-pull -tip] x86: cpu_debug and cpufeature patches
Quoted 130 lines · Jaswinder Singh Rajput
Quoted 25 lines · Ingo Molnar
Quoted 14 lines · Jaswinder Singh Rajput
We can use
cpu_hastests for unknown processors but 'cpu model' is accurate and cover all range.
cpu_hasdoes not cover following registers:
1. platform
2. poweron
3. control
4. bios
5. freq
6. cache
7. misc
8. base
9. ver
10. confFirstly these should be added to
cpufeatures.h.Then add
cpu_has_xxx()accessors need to be added for them and during CPU init they have to be properly set, via two methods:- via CPUID (where this is possible+specified in docs)
- or via "later than CPU version X" checksQuoted 8 lines
Your cpu-model table is equivalent to an explicitly enumerated CPU version check, but this breaks every time a new CPU comes out.
"Later than" or CPUID based feature bits are a lot more future-proof
- we only have to add support for new _features_ (and quirks, occasionally), and dont have to maintain that full table of specific models to specific features mapping tables.I add some cpufeatures for review, I am still adding rest of them.
The following changes since commit
c861b6f8ea9b39699f4a35bbf7dc06eb937a34de:
Ingo Molnar (1):
Merge branch 'irq/urgent'are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/jaswinder/linux-2.6-tip.gitmasterJaswinder Singh Rajput (6):
x86:cpu_debug.cavoid storingcpu_descriptorslocally
x86:cpu_debugupdateKconfigentry
x86:cpu_debug.cremove unwanted header files
x86: Add cpufeature for Processor Name
x86: Add cpufeatures for Advanced Power Management
x86: Add cpufeature for Microcode updatearch/x86/Kconfig | 11 ++++++++- arch/x86/include/asm/cpufeature.h | 21 ++++++++++++++---- arch/x86/include/asm/processor.h | 1 - arch/x86/kernel/cpu/Makefile | 2 +- arch/x86/kernel/cpu/amd.c | 9 -------- arch/x86/kernel/cpu/common.c | 16 +++++++++++++- arch/x86/kernel/cpu/cpu_debug.c | 42 +++++++++++++++++------------------- arch/x86/kernel/cpu/intel.c | 14 ------------ arch/x86/kernel/cpu/powerflags.c | 20 ----------------- arch/x86/kernel/cpu/proc.c | 14 ------------ arch/x86/kernel/microcode_amd.c | 3 ++ arch/x86/kernel/microcode_intel.c | 3 ++ 12 files changed, 68 insertions(+), 88 deletions(-) delete mode 100644 arch/x86/kernel/cpu/powerflags.cComplete diff:
arch/x86/Kconfig +10
-1@@ -951,7 +951,16 @@ config X86_CPU_DEBUG tristate "/sys/kernel/debug/x86/cpu/* - CPU Debug support" ---help--- If you select this option, this will provide various x86 CPUs - information through debugfs. + information through debugfs. Any user can read these file but writing + needs root privilege. + + Note: 1. If you compile cpu_debug as a module, it will _not_ be loaded + automatically (like usual drivers). You will need to load it manually + (or add it to list of modules loaded during boot). + + 2. You need debugfs, if you want to mount debugfs automatically + append this line in /etc/fstab: + debugfs /sys/kernel/debug debugfs defaults 0 0 choice prompt "High Memory Support"arch/x86/include/asm/cpufeature.h +6
-4@@ -6,7 +6,7 @@#include <asm/required-features.h> -#define NCAPINTS 9/* N 32-bit words worth of info */ +#define NCAPINTS 10/* N 32-bit words worth of info */ /* * Note: If the comment begins with a quoted string, that string is used @@ -76,7 +76,6 @@#define X86_FEATURE_K7 (3*32+ 5)/* "" Athlon */ #define X86_FEATURE_P3 (3*32+ 6)/* "" P3 */ #define X86_FEATURE_P4 (3*32+ 7)/* "" P4 */ -#define X86_FEATURE_CONSTANT_TSC (3*32+ 8)/* TSC ticks at a constant rate */ #define X86_FEATURE_UP (3*32+ 9)/* smp kernel running on up */ #define X86_FEATURE_FXSAVE_LEAK (3*32+10)/* "" FXSAVE leaks FOP/FIP/FOP */ #define X86_FEATURE_ARCH_PERFMON (3*32+11)/* Intel Architectural PerfMon */ @@ -153,8 +152,10 @@* Auxiliary flags: Linux defined - For features scattered in various * CPUID levels like 0x6, 0xA etc */ -#define X86_FEATURE_IDA (7*32+ 0)/* Intel Dynamic Acceleration */ -#define X86_FEATURE_ARAT (7*32+ 1)/* Always Running APIC Timer */ +#define X86_FEATURE_IDA (7*32+ 0)/* Intel Dynamic Acceleration */ +#define X86_FEATURE_ARAT (7*32+ 1)/* Always Running APIC Timer */ +#define X86_FEATURE_PNAME (7*32+ 2)/* Processor Name */ +#define X86_FEATURE_MICROCODE (7*32+ 3)/* Microcode update */ /* Virtualization flags: Linux defined */ #define X86_FEATURE_TPR_SHADOW (8*32+ 0)/* Intel TPR Shadow */ @@ -163,12 +164,22 @@#define X86_FEATURE_EPT (8*32+ 3)/* Intel Extended Page Table */ #define X86_FEATURE_VPID (8*32+ 4)/* Intel Virtual Processor ID */ +/* Advanced Power Management (Function 8000_0007h), edx */
arch/x86/include/asm/cpufeature.h line 177
Quoted 10 lines
arch/x86/include/asm/cpufeature.h +10
-0+#define X86_FEATURE_TS (9*32+ 0)/* Temperatue sensor */ +#define X86_FEATURE_FID (9*32+ 1)/* Frequency ID control */ +#define X86_FEATURE_VID (9*32+ 2)/* Voltage ID control */ +#define X86_FEATURE_TTP (9*32+ 3)/* Thermal trip */ +#define X86_FEATURE_HTC (9*32+ 4)/* Hardware thermal control */ +#define X86_FEATURE_STC (9*32+ 5)/* Software thermal control */ +#define X86_FEATURE_100MHZSTEPS (9*32+ 6)/* 100 MHz multiplier control */ +#define X86_FEATURE_HWPSTATE (9*32+ 7)/* Hardware P-State control */ +#define X86_FEATURE_CONSTANT_TSC (9*32+ 8)/* Constant rate TSC ticks */ +
Yes, this general approach looks pretty good! Note how it reduces the line count in fact.
I havent looked deeply yet, but noticed that above you changed X86_FEATURE_CONSTANT_TSC - why was that done?
Ingo
Re: [RFC][git-pull -tip] x86: cpu_debug and cpufeature patches
Quoted 16 lines · Ingo Molnar
Review
Quoted 12 lines
(quoted diff) +11
-0+/* Advanced Power Management (Function 8000_0007h), edx */ +#define X86_FEATURE_TS (9*32+ 0) /* Temperatue sensor */ +#define X86_FEATURE_FID (9*32+ 1) /* Frequency ID control */ +#define X86_FEATURE_VID (9*32+ 2) /* Voltage ID control */ +#define X86_FEATURE_TTP (9*32+ 3) /* Thermal trip */ +#define X86_FEATURE_HTC (9*32+ 4) /* Hardware thermal control */ +#define X86_FEATURE_STC (9*32+ 5) /* Software thermal control */ +#define X86_FEATURE_100MHZSTEPS (9*32+ 6) /* 100 MHz multiplier control */ +#define X86_FEATURE_HWPSTATE (9*32+ 7) /* Hardware P-State control */ +#define X86_FEATURE_CONSTANT_TSC (9*32+ 8) /* Constant rate TSC ticks */ +Yes, this general approach looks pretty good! Note how it reduces the line count in fact.
Yes, thanks :-)
Quoted 3 lines
I havent looked deeply yet, but noticed that above you changed
X86_FEATURE_CONSTANT_TSC- why was that done?
X86_FEATURE_CONSTANT_TSC is used as TSC Invariant of Power Management EDX[8]. Now I made complete Advanced Power Management group so I moved it down here.
Here is the complete Advanced Power Management patch, it is a big patch, if you want I can further divide it:
Subject: [PATCH] x86: Add cpufeatures for Advanced Power Management
1. Add Advanced Power Management (Function 8000_0007h), edx
2. unification of X86_FEATURE_CONSTANT_TSC (from intel.c, amd.c to common.c)
3. Remove cpu/powerflags.c
4. Remove x86_power
5. Move 'power management' to flags of /proc/cpuinfo
/proc/cpuinfo (before)
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt rdtscp lm 3dnowext 3dnow constant_tsc rep_good nonstop_tsc pni cx16 lahf_lm cmp_legacy svm extapic cr8_legacy 3dnowprefetch osvw skinit pname ..
power management: ts ttp tm stc 100mhzsteps hwpstate
/proc/cpuinfo (after)
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx mmxext fxsr_opt rdtscp lm 3dnowext 3dnow rep_good tsc_reliable nonstop_tsc pni cx16 lahf_lm cmp_legacy svm extapic cr8_legacy 3dnowprefetch osvw skinit pname ts ttp htc stc 100mhzsteps hwpstate constant_tsc
--- arch/x86/include/asm/cpufeature.h | 15 ++++++++++++--- arch/x86/include/asm/processor.h | 1 - arch/x86/kernel/cpu/Makefile | 2 +- arch/x86/kernel/cpu/amd.c | 9 --------- arch/x86/kernel/cpu/common.c | 15 ++++++++++++++- arch/x86/kernel/cpu/intel.c | 14 -------------- arch/x86/kernel/cpu/powerflags.c | 20 -------------------- arch/x86/kernel/cpu/proc.c | 14 -------------- 8 files changed, 27 insertions(+), 63 deletions(-) delete mode 100644 arch/x86/kernel/cpu/powerflags.c
arch/x86/include/asm/cpufeature.h +12 -3
@@ -6,7 +6,7 @@#include <asm/required-features.h> -#define NCAPINTS 9/* N 32-bit words worth of info */ +#define NCAPINTS 10/* N 32-bit words worth of info */ /* * Note: If the comment begins with a quoted string, that string is used
@@ -76,7 +76,6 @@#define X86_FEATURE_K7 (3*32+ 5)/* "" Athlon */ #define X86_FEATURE_P3 (3*32+ 6)/* "" P3 */ #define X86_FEATURE_P4 (3*32+ 7)/* "" P4 */ -#define X86_FEATURE_CONSTANT_TSC (3*32+ 8)/* TSC ticks at a constant rate */ #define X86_FEATURE_UP (3*32+ 9)/* smp kernel running on up */ #define X86_FEATURE_FXSAVE_LEAK (3*32+10)/* "" FXSAVE leaks FOP/FIP/FOP */ #define X86_FEATURE_ARCH_PERFMON (3*32+11)/* Intel Architectural PerfMon */
@@ -164,12 +163,22 @@#define X86_FEATURE_EPT (8*32+ 3)/* Intel Extended Page Table */ #define X86_FEATURE_VPID (8*32+ 4)/* Intel Virtual Processor ID */ +/* Advanced Power Management (Function 8000_0007h), edx */ +#define X86_FEATURE_TS (9*32+ 0)/* Temperatue sensor */ +#define X86_FEATURE_FID (9*32+ 1)/* Frequency ID control */ +#define X86_FEATURE_VID (9*32+ 2)/* Voltage ID control */ +#define X86_FEATURE_TTP (9*32+ 3)/* Thermal trip */ +#define X86_FEATURE_HTC (9*32+ 4)/* Hardware thermal control */ +#define X86_FEATURE_STC (9*32+ 5)/* Software thermal control */ +#define X86_FEATURE_100MHZSTEPS (9*32+ 6)/* 100 MHz multiplier control */ +#define X86_FEATURE_HWPSTATE (9*32+ 7)/* Hardware P-State control */ +#define X86_FEATURE_CONSTANT_TSC (9*32+ 8)/* Constant rate TSC ticks */ +#if defined(__KERNEL__) && !defined(__ASSEMBLY__)#include <linux/bitops.h> extern const char *const x86_cap_flags[NCAPINTS *32 ]; -extern const char *const x86_power_flags[32 ];#define test_cpu_cap (c, bit) \ test_bit(bit, (unsigned long *)((c)->x86_capability))
arch/x86/include/asm/processor.h +0 -1
@@ -90,7 +90,6 @@ struct cpuinfo_x86 {/* in KB - valid for CPUS which support this call: */ int x86_cache_size;int x86_cache_alignment;/* In bytes */ -int x86_power;unsigned long loops_per_jiffy;#ifdef CONFIG_SMP /* cpus sharing the last level cache: */
arch/x86/kernel/cpu/Makefile +1 -1
@@ -8,7 +8,7 @@ CFLAGS_REMOVE_common.o = -pg endif obj-y := intel_cacheinfo.o addon_cpuid_features.o -obj-y += proc.o capflags.o powerflags.o common.o +obj-y += proc.o capflags.o common.o obj-y += vmware.o hypervisor.o obj-$(CONFIG_X86_32) += bugs.o cmpxchg.o
arch/x86/kernel/cpu/amd.c +0 -9
@@ -333,15 +333,6 @@ static void __cpuinit early_init_amd(struct cpuinfo_x86 *c) {early_init_amd_mc (c); -/* -* c->x86_power is 8000_0007 edx. Bit 8 is TSC runs at constant rate -* with P/T states and does not stop in deep C-states -*/ -if (c->x86_power & (1 <<8 )) { -set_cpu_cap (c,X86_FEATURE_CONSTANT_TSC ); -set_cpu_cap (c,X86_FEATURE_NONSTOP_TSC ); - } -#ifdef CONFIG_X86_64 set_cpu_cap (c,X86_FEATURE_SYSCALL32 );#else
arch/x86/kernel/cpu/common.c +14 -1
@@ -576,8 +576,21 @@ static void __cpuinit get_cpu_cap(struct cpuinfo_x86 *c)#endif if (c->extended_cpuid_level >=0x80000007 ) - c->x86_power =cpuid_edx (0x80000007 ); + c->x86_capability[9 ] =cpuid_edx (0x80000007 ); +/* +* Advanced power management is 8000_0007 edx. +* Bit 8 is TSC runs at constant rate with P/T states +* and does not stop in deep C-states. +* +* It is also reliable across cores and sockets. (but not across +* cabinets - we turn it off in that case explicitly.) +*/ +if (cpu_has (c,X86_FEATURE_CONSTANT_TSC )) { +set_cpu_cap (c,X86_FEATURE_NONSTOP_TSC ); +set_cpu_cap (c,X86_FEATURE_TSC_RELIABLE ); + sched_clock_stable =1 ; + } }static void __cpuinit identify_cpu_without_cpuid (struct cpuinfo_x86 *c)
arch/x86/kernel/cpu/intel.c +0 -14
@@ -61,20 +61,6 @@ static void __cpuinit early_init_intel(struct cpuinfo_x86 *c) c->x86_phys_bits =36 ;/* -* c->x86_power is 8000_0007 edx. Bit 8 is TSC runs at constant rate -* with P/T states and does not stop in deep C-states. -* -* It is also reliable across cores and sockets. (but not across -* cabinets - we turn it off in that case explicitly.) -*/ -if (c->x86_power & (1 <<8 )) { -set_cpu_cap (c,X86_FEATURE_CONSTANT_TSC ); -set_cpu_cap (c,X86_FEATURE_NONSTOP_TSC ); -set_cpu_cap (c,X86_FEATURE_TSC_RELIABLE ); - sched_clock_stable =1 ; - } - -/* * There is a known erratum on Pentium III and Core Solo * and Core Duo CPUs. * " Page with PAT set to WC while associated MTRR is UC
arch/x86/kernel/cpu/powerflags.c deleted +0 -20
@@ -1,20 +0,0 @@ -/* -* Strings for the various x86 power flags -* -* This file must not contain any executable code. -*/ - -#include <asm/cpufeature.h> - -const char *const x86_power_flags[32 ] = { -"ts" ,/* temperature sensor */ -"fid" ,/* frequency id control */ -"vid" ,/* voltage id control */ -"ttp" ,/* thermal trip */ -"tm" , -"stc" , -"100mhzsteps" , -"hwpstate" , -"" ,/* tsc invariant mapped to constant_tsc */ -/* nothing */ -};
arch/x86/kernel/cpu/proc.c +0 -14
@@ -121,20 +121,6 @@ static int show_cpuinfo(struct seq_file *m, void *v)seq_printf (m,"address sizes\t: %u bits physical, %u bits virtual\n" , c->x86_phys_bits, c->x86_virt_bits);#endif - -seq_printf (m,"power management:" ); -for (i =0 ; i <32 ; i++) { -if (c->x86_power & (1 << i)) { -if (i <ARRAY_SIZE (x86_power_flags) && - x86_power_flags[i]) -seq_printf (m,"%s%s" , - x86_power_flags[i][0 ]?" " :"" , - x86_power_flags[i]); -else -seq_printf (m," [%d]" , i); - } - } -seq_printf (m,"\n\n" );return 0 ;
Signature · 1 line
1.6.0.6
Re: [RFC][git-pull -tip] x86: cpu_debug and cpufeature patches
In reply to Jaswinder Singh RajputQuoted 45 lines · Jaswinder Singh Rajput
Quoted 25 lines · Ingo Molnar
Quoted 14 lines · Jaswinder Singh Rajput
We can use
cpu_hastests for unknown processors but 'cpu model' is accurate and cover all range.
cpu_hasdoes not cover following registers:
1. platform
2. poweron
3. control
4. bios
5. freq
6. cache
7. misc
8. base
9. ver
10. confFirstly these should be added to
cpufeatures.h.Then add
cpu_has_xxx()accessors need to be added for them and during CPU init they have to be properly set, via two methods:- via CPUID (where this is possible+specified in docs)
- or via "later than CPU version X" checksQuoted 8 lines
Your cpu-model table is equivalent to an explicitly enumerated CPU version check, but this breaks every time a new CPU comes out.
"Later than" or CPUID based feature bits are a lot more future-proof
- we only have to add support for new _features_ (and quirks, occasionally), and dont have to maintain that full table of specific models to specific features mapping tables.I add some cpufeatures for review, I am still adding rest of them.
The following changes since commit
c861b6f8ea9b39699f4a35bbf7dc06eb937a34de:
Ingo Molnar (1):
Merge branch 'irq/urgent'are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/jaswinder/linux-2.6-tip.gitmaster
Quoted 7 lines
Jaswinder Singh Rajput (6):
x86:cpu_debug.cavoid storingcpu_descriptorslocally
x86:cpu_debugupdateKconfigentry
x86:cpu_debug.cremove unwanted header files
x86: Add cpufeature for Processor Name
x86: Add cpufeatures for Advanced Power Management
x86: Add cpufeature for Microcode update
I added some more cpufeature patches for review:
The following changes since commit c861b6f8ea9b39699f4a35bbf7dc06eb937a34de:
Ingo Molnar (1):
Merge branch 'irq/urgent'
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/jaswinder/linux-2.6-tip.git master
Jaswinder Singh Rajput (11):
x86: cpu_debug.c avoid storing cpu_descriptors locally
x86: cpu_debug update Kconfig entry
x86: cpu_debug.c remove unwanted header files
x86: Add cpufeature for Processor Name
x86: Add cpufeatures for Advanced Power Management
x86: Add cpufeature for Microcode update
x86: Add cpufeature for Cache MSRs
x86: Add cpufeature for Hard and Soft Poweron configuration
x86: Add cpufeature for Scaleable bus speed
x86: Add cpufeature for Miscellaneous Features
x86: Add cpufeature for Platform feature
arch/x86/Kconfig | 11 ++++- arch/x86/include/asm/cpufeature.h | 28 +++++++++-- arch/x86/include/asm/processor.h | 1 - arch/x86/kernel/cpu/Makefile | 2 +- arch/x86/kernel/cpu/amd.c | 9 ---- arch/x86/kernel/cpu/common.c | 16 ++++++- arch/x86/kernel/cpu/cpu_debug.c | 42 ++++++++--------- arch/x86/kernel/cpu/intel.c | 93 +++++++++++++++++++++++++++++++------ arch/x86/kernel/cpu/powerflags.c | 20 -------- arch/x86/kernel/cpu/proc.c | 14 ------ arch/x86/kernel/microcode_amd.c | 3 + arch/x86/kernel/microcode_intel.c | 3 + 12 files changed, 154 insertions(+), 88 deletions(-) delete mode 100644 arch/x86/kernel/cpu/powerflags.c
Complete diff:
arch/x86/Kconfig +10 -1
@@ -951,7 +951,16 @@ config X86_CPU_DEBUG tristate "/sys/kernel/debug/x86/cpu/* - CPU Debug support" ---help--- If you select this option, this will provide various x86 CPUs - information through debugfs. + information through debugfs. Any user can read these file but writing + needs root privilege. + + Note: 1. If you compile cpu_debug as a module, it will _not_ be loaded + automatically (like usual drivers). You will need to load it manually + (or add it to list of modules loaded during boot). + + 2. You need debugfs, if you want to mount debugfs automatically + append this line in /etc/fstab: + debugfs /sys/kernel/debug debugfs defaults 0 0 choice prompt "High Memory Support"
arch/x86/include/asm/cpufeature.h +23 -5
@@ -6,7 +6,7 @@#include <asm/required-features.h> -#define NCAPINTS 9/* N 32-bit words worth of info */ +#define NCAPINTS 10/* N 32-bit words worth of info */ /* * Note: If the comment begins with a quoted string, that string is used
@@ -76,7 +76,6 @@#define X86_FEATURE_K7 (3*32+ 5)/* "" Athlon */ #define X86_FEATURE_P3 (3*32+ 6)/* "" P3 */ #define X86_FEATURE_P4 (3*32+ 7)/* "" P4 */ -#define X86_FEATURE_CONSTANT_TSC (3*32+ 8)/* TSC ticks at a constant rate */ #define X86_FEATURE_UP (3*32+ 9)/* smp kernel running on up */ #define X86_FEATURE_FXSAVE_LEAK (3*32+10)/* "" FXSAVE leaks FOP/FIP/FOP */ #define X86_FEATURE_ARCH_PERFMON (3*32+11)/* Intel Architectural PerfMon */
@@ -153,8 +152,17 @@* Auxiliary flags: Linux defined - For features scattered in various * CPUID levels like 0x6, 0xA etc */ -#define X86_FEATURE_IDA (7*32+ 0)/* Intel Dynamic Acceleration */ -#define X86_FEATURE_ARAT (7*32+ 1)/* Always Running APIC Timer */ +#define X86_FEATURE_IDA (7*32+ 0)/* Intel Dynamic Acceleration */ +#define X86_FEATURE_ARAT (7*32+ 1)/* Always Running APIC Timer */ +#define X86_FEATURE_PNAME (7*32+ 2)/* Processor Name */ +#define X86_FEATURE_MICROCODE (7*32+ 3)/* Microcode update */ +#define X86_FEATURE_CACHE (7*32+ 4)/* BBL_CR_* MSRs (PII & PIII) */ +#define X86_FEATURE_CACHE_CTL (7*32+ 5)/* Cache control MSRs */ +#define X86_FEATURE_HARD_POWERON (7*32+ 6)/* Hard Poweron configuration*/ +#define X86_FEATURE_SOFT_POWERON (7*32+ 7)/* Soft Poweron configuration*/ +#define X86_FEATURE_FSB_FREQ (7*32+ 8)/* Scaleable bus speed */ +#define X86_FEATURE_MISC (7*32+ 9)/* Miscellaneous features */ +#define X86_FEATURE_PLATFORM (7*32+ 10)/* Platform feature */ /* Virtualization flags: Linux defined */ #define X86_FEATURE_TPR_SHADOW (8*32+ 0)/* Intel TPR Shadow */
@@ -163,12 +171,22 @@#define X86_FEATURE_EPT (8*32+ 3)/* Intel Extended Page Table */ #define X86_FEATURE_VPID (8*32+ 4)/* Intel Virtual Processor ID */ +/* Advanced Power Management (Function 8000_0007h), edx */ +#define X86_FEATURE_TS (9*32+ 0)/* Temperatue sensor */ +#define X86_FEATURE_FID (9*32+ 1)/* Frequency ID control */ +#define X86_FEATURE_VID (9*32+ 2)/* Voltage ID control */ +#define X86_FEATURE_TTP (9*32+ 3)/* Thermal trip */ +#define X86_FEATURE_HTC (9*32+ 4)/* Hardware thermal control */ +#define X86_FEATURE_STC (9*32+ 5)/* Software thermal control */ +#define X86_FEATURE_100MHZSTEPS (9*32+ 6)/* 100 MHz multiplier control */ +#define X86_FEATURE_HWPSTATE (9*32+ 7)/* Hardware P-State control */ +#define X86_FEATURE_CONSTANT_TSC (9*32+ 8)/* Constant rate TSC ticks */ +#if defined(__KERNEL__) && !defined(__ASSEMBLY__)#include <linux/bitops.h> extern const char *const x86_cap_flags[NCAPINTS *32 ]; -extern const char *const x86_power_flags[32 ];#define test_cpu_cap (c, bit) \ test_bit(bit, (unsigned long *)((c)->x86_capability))
arch/x86/include/asm/processor.h +0 -1
@@ -90,7 +90,6 @@ struct cpuinfo_x86 {/* in KB - valid for CPUS which support this call: */ int x86_cache_size;int x86_cache_alignment;/* In bytes */ -int x86_power;unsigned long loops_per_jiffy;#ifdef CONFIG_SMP /* cpus sharing the last level cache: */
arch/x86/kernel/cpu/Makefile +1 -1
@@ -8,7 +8,7 @@ CFLAGS_REMOVE_common.o = -pg endif obj-y := intel_cacheinfo.o addon_cpuid_features.o -obj-y += proc.o capflags.o powerflags.o common.o +obj-y += proc.o capflags.o common.o obj-y += vmware.o hypervisor.o obj-$(CONFIG_X86_32) += bugs.o cmpxchg.o
arch/x86/kernel/cpu/amd.c +0 -9
@@ -333,15 +333,6 @@ static void __cpuinit early_init_amd(struct cpuinfo_x86 *c) {early_init_amd_mc (c); -/* -* c->x86_power is 8000_0007 edx. Bit 8 is TSC runs at constant rate -* with P/T states and does not stop in deep C-states -*/ -if (c->x86_power & (1 <<8 )) { -set_cpu_cap (c,X86_FEATURE_CONSTANT_TSC ); -set_cpu_cap (c,X86_FEATURE_NONSTOP_TSC ); - } -#ifdef CONFIG_X86_64 set_cpu_cap (c,X86_FEATURE_SYSCALL32 );#else
arch/x86/kernel/cpu/common.c +15 -1
@@ -360,6 +360,7 @@ static void __cpuinit get_model_name(struct cpuinfo_x86 *c)cpuid (0x80000003 , &v[4 ], &v[5 ], &v[6 ], &v[7 ]);cpuid (0x80000004 , &v[8 ], &v[9 ], &v[10 ], &v[11 ]); c->x86_model_id[48 ] =0 ; +set_cpu_cap (c,X86_FEATURE_PNAME );/* * Intel chips right-justify this string for some dumb reason;
@@ -575,8 +576,21 @@ static void __cpuinit get_cpu_cap(struct cpuinfo_x86 *c)#endif if (c->extended_cpuid_level >=0x80000007 ) - c->x86_power =cpuid_edx (0x80000007 ); + c->x86_capability[9 ] =cpuid_edx (0x80000007 ); +/* +* Advanced power management is 8000_0007 edx. +* Bit 8 is TSC runs at constant rate with P/T states +* and does not stop in deep C-states. +* +* It is also reliable across cores and sockets. (but not across +* cabinets - we turn it off in that case explicitly.) +*/ +if (cpu_has (c,X86_FEATURE_CONSTANT_TSC )) { +set_cpu_cap (c,X86_FEATURE_NONSTOP_TSC ); +set_cpu_cap (c,X86_FEATURE_TSC_RELIABLE ); + sched_clock_stable =1 ; + } }static void __cpuinit identify_cpu_without_cpuid (struct cpuinfo_x86 *c)
arch/x86/kernel/cpu/cpu_debug.c +20 -22
130 lines not on this page · raw message
arch/x86/kernel/cpu/intel.c +79 -14
105 lines not on this page · raw message
arch/x86/kernel/cpu/powerflags.c deleted +0 -20
@@ -1,20 +0,0 @@ -/* -* Strings for the various x86 power flags -* -* This file must not contain any executable code. -*/ - -#include <asm/cpufeature.h> - -const char *const x86_power_flags[32 ] = { -"ts" ,/* temperature sensor */ -"fid" ,/* frequency id control */ -"vid" ,/* voltage id control */ -"ttp" ,/* thermal trip */ -"tm" , -"stc" , -"100mhzsteps" , -"hwpstate" , -"" ,/* tsc invariant mapped to constant_tsc */ -/* nothing */ -};
arch/x86/kernel/cpu/proc.c +0 -14
@@ -121,20 +121,6 @@ static int show_cpuinfo(struct seq_file *m, void *v)seq_printf (m,"address sizes\t: %u bits physical, %u bits virtual\n" , c->x86_phys_bits, c->x86_virt_bits);#endif - -seq_printf (m,"power management:" ); -for (i =0 ; i <32 ; i++) { -if (c->x86_power & (1 << i)) { -if (i <ARRAY_SIZE (x86_power_flags) && - x86_power_flags[i]) -seq_printf (m,"%s%s" , - x86_power_flags[i][0 ]?" " :"" , - x86_power_flags[i]); -else -seq_printf (m," [%d]" , i); - } - } -seq_printf (m,"\n\n" );return 0 ;
arch/x86/kernel/microcode_amd.c +3 -0
@@ -95,6 +95,9 @@ static int collect_cpu_info_amd(int cpu, struct cpu_signature *csig) "supported\n", cpu, c->x86);return -1 ; } +/* setting microcode update feature to friendly access of UCODE MSRs */ +set_cpu_cap (c,X86_FEATURE_MICROCODE ); +rdmsr (MSR_AMD64_PATCH_LEVEL , csig->rev, dummy);printk (KERN_INFO "microcode: CPU%d: patch_level=0x%x\n" , cpu, csig->rev);return 0 ;
arch/x86/kernel/microcode_intel.c +3 -0
@@ -168,6 +168,9 @@ static int collect_cpu_info(int cpu_num, struct cpu_signature *csig)return -1 ; } +/* setting microcode update feature to friendly access of UCODE MSRs */ +set_cpu_cap (c,X86_FEATURE_MICROCODE ); + csig->sig =cpuid_eax (0x00000001 );if ((c->x86_model >=5 ) || (c->x86 >6 )) {
Re: [RFC][git-pull -tip] x86: cpu_debug and cpufeature patches
In reply to Jaswinder Singh RajputQuoted 37 lines · Jaswinder Singh Rajput
Quoted 25 lines · Ingo Molnar
Quoted 14 lines · Jaswinder Singh Rajput
We can use
cpu_hastests for unknown processors but 'cpu model' is accurate and cover all range.
cpu_hasdoes not cover following registers:
1. platform
2. poweron
3. control
4. bios
5. freq
6. cache
7. misc
8. base
9. ver
10. confFirstly these should be added to
cpufeatures.h.Then add
cpu_has_xxx()accessors need to be added for them and during CPU init they have to be properly set, via two methods:- via CPUID (where this is possible+specified in docs)
- or via "later than CPU version X" checksQuoted 8 lines
Your cpu-model table is equivalent to an explicitly enumerated CPU version check, but this breaks every time a new CPU comes out.
"Later than" or CPUID based feature bits are a lot more future-proof
- we only have to add support for new _features_ (and quirks, occasionally), and dont have to maintain that full table of specific models to specific features mapping tables.I add some cpufeatures for review, I am still adding rest of them.
Quoted 7 lines
The following changes since commit
c861b6f8ea9b39699f4a35bbf7dc06eb937a34de:
Ingo Molnar (1):
Merge branch 'irq/urgent'are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/jaswinder/linux-2.6-tip.gitmaster
I added some more patches for the review.
The following changes since commit c861b6f8ea9b39699f4a35bbf7dc06eb937a34de:
Ingo Molnar (1):
Merge branch 'irq/urgent'
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/jaswinder/linux-2.6-tip.git master
Jaswinder Singh Rajput (17):
x86: cpu_debug.c avoid storing cpu_descriptors locally
x86: cpu_debug update Kconfig entry
x86: cpu_debug.c remove unwanted header files
x86: Add cpufeature for Processor Name
x86: Add cpufeatures for Advanced Power Management
x86: Add cpufeature for Microcode update
x86: Add cpufeature for Cache MSRs
x86: Add cpufeature for Hard and Soft Poweron configuration
x86: Add cpufeature for Scaleable bus speed
x86: Add cpufeature for Miscellaneous Features
x86: Add cpufeature for Platform feature
x86: Add cpufeature for Hardware configuration
x86: Add cpufeature for System configuration
x86: Add cpufeature for System management mode (SMM)
x86: Add cpufeature for MM configuration
x86: Add cpufeature for Bus configuration
x86: cpu_debug replace cpu_modelflag with cpu_has
arch/x86/Kconfig | 11 +- arch/x86/include/asm/cpu_debug.h | 169 +----------- arch/x86/include/asm/cpufeature.h | 33 ++- arch/x86/include/asm/processor.h | 1 - arch/x86/kernel/cpu/Makefile | 2 +- arch/x86/kernel/cpu/amd.c | 33 ++- arch/x86/kernel/cpu/common.c | 17 +- arch/x86/kernel/cpu/cpu_debug.c | 542 ++++++++++++------------------------- arch/x86/kernel/cpu/intel.c | 93 ++++++- arch/x86/kernel/cpu/powerflags.c | 20 -- arch/x86/kernel/cpu/proc.c | 14 - arch/x86/kernel/microcode_amd.c | 3 + arch/x86/kernel/microcode_intel.c | 3 + 13 files changed, 339 insertions(+), 602 deletions(-) delete mode 100644 arch/x86/kernel/cpu/powerflags.c
Complete diff:
arch/x86/Kconfig +10 -1
@@ -951,7 +951,16 @@ config X86_CPU_DEBUG tristate "/sys/kernel/debug/x86/cpu/* - CPU Debug support" ---help--- If you select this option, this will provide various x86 CPUs - information through debugfs. + information through debugfs. Any user can read these file but writing + needs root privilege. + + Note: 1. If you compile cpu_debug as a module, it will _not_ be loaded + automatically (like usual drivers). You will need to load it manually + (or add it to list of modules loaded during boot). + + 2. You need debugfs, if you want to mount debugfs automatically + append this line in /etc/fstab: + debugfs /sys/kernel/debug debugfs defaults 0 0 choice prompt "High Memory Support"
arch/x86/include/asm/cpu_debug.h +8 -161
196 lines not on this page · raw message
arch/x86/include/asm/cpufeature.h +28 -5
@@ -6,7 +6,7 @@#include <asm/required-features.h> -#define NCAPINTS 9/* N 32-bit words worth of info */ +#define NCAPINTS 10/* N 32-bit words worth of info */ /* * Note: If the comment begins with a quoted string, that string is used
@@ -76,7 +76,6 @@#define X86_FEATURE_K7 (3*32+ 5)/* "" Athlon */ #define X86_FEATURE_P3 (3*32+ 6)/* "" P3 */ #define X86_FEATURE_P4 (3*32+ 7)/* "" P4 */ -#define X86_FEATURE_CONSTANT_TSC (3*32+ 8)/* TSC ticks at a constant rate */ #define X86_FEATURE_UP (3*32+ 9)/* smp kernel running on up */ #define X86_FEATURE_FXSAVE_LEAK (3*32+10)/* "" FXSAVE leaks FOP/FIP/FOP */ #define X86_FEATURE_ARCH_PERFMON (3*32+11)/* Intel Architectural PerfMon */
@@ -153,8 +152,22 @@* Auxiliary flags: Linux defined - For features scattered in various * CPUID levels like 0x6, 0xA etc */ -#define X86_FEATURE_IDA (7*32+ 0)/* Intel Dynamic Acceleration */ -#define X86_FEATURE_ARAT (7*32+ 1)/* Always Running APIC Timer */ +#define X86_FEATURE_IDA (7*32+ 0)/* Intel Dynamic Acceleration */ +#define X86_FEATURE_ARAT (7*32+ 1)/* Always Running APIC Timer */ +#define X86_FEATURE_PNAME (7*32+ 2)/* Processor Name */ +#define X86_FEATURE_MICROCODE (7*32+ 3)/* Microcode update */ +#define X86_FEATURE_CACHE (7*32+ 4)/* BBL_CR_* MSRs (PII & PIII) */ +#define X86_FEATURE_CACHE_CTL (7*32+ 5)/* Cache control MSRs */ +#define X86_FEATURE_HARD_POWERON (7*32+ 6)/* Hard Poweron configuration*/ +#define X86_FEATURE_SOFT_POWERON (7*32+ 7)/* Soft Poweron configuration*/ +#define X86_FEATURE_FSB_FREQ (7*32+ 8)/* Scaleable bus speed */ +#define X86_FEATURE_MISC (7*32+ 9)/* Miscellaneous features */ +#define X86_FEATURE_PLATFORM (7*32+ 10)/* Platform feature */ +#define X86_FEATURE_HW_CFG (7*32+ 11)/* Hardware configuration */ +#define X86_FEATURE_SYS_CFG (7*32+ 12)/* System configuration */ +#define X86_FEATURE_SMM (7*32+ 13)/* System Management Mode */ +#define X86_FEATURE_MM_CFG (7*32+ 14)/* MM configuration */ +#define X86_FEATURE_BUS_CFG (7*32+ 15)/* Bus configuration */ /* Virtualization flags: Linux defined */ #define X86_FEATURE_TPR_SHADOW (8*32+ 0)/* Intel TPR Shadow */
@@ -163,12 +176,22 @@#define X86_FEATURE_EPT (8*32+ 3)/* Intel Extended Page Table */ #define X86_FEATURE_VPID (8*32+ 4)/* Intel Virtual Processor ID */ +/* Advanced Power Management (Function 8000_0007h), edx */ +#define X86_FEATURE_TS (9*32+ 0)/* Temperatue sensor */ +#define X86_FEATURE_FID (9*32+ 1)/* Frequency ID control */ +#define X86_FEATURE_VID (9*32+ 2)/* Voltage ID control */ +#define X86_FEATURE_TTP (9*32+ 3)/* Thermal trip */ +#define X86_FEATURE_HTC (9*32+ 4)/* Hardware thermal control */ +#define X86_FEATURE_STC (9*32+ 5)/* Software thermal control */ +#define X86_FEATURE_100MHZSTEPS (9*32+ 6)/* 100 MHz multiplier control */ +#define X86_FEATURE_HWPSTATE (9*32+ 7)/* Hardware P-State control */ +#define X86_FEATURE_CONSTANT_TSC (9*32+ 8)/* Constant rate TSC ticks */ +#if defined(__KERNEL__) && !defined(__ASSEMBLY__)#include <linux/bitops.h> extern const char *const x86_cap_flags[NCAPINTS *32 ]; -extern const char *const x86_power_flags[32 ];#define test_cpu_cap (c, bit) \ test_bit(bit, (unsigned long *)((c)->x86_capability))
arch/x86/include/asm/processor.h +0 -1
@@ -90,7 +90,6 @@ struct cpuinfo_x86 {/* in KB - valid for CPUS which support this call: */ int x86_cache_size;int x86_cache_alignment;/* In bytes */ -int x86_power;unsigned long loops_per_jiffy;#ifdef CONFIG_SMP /* cpus sharing the last level cache: */
arch/x86/kernel/cpu/Makefile +1 -1
@@ -8,7 +8,7 @@ CFLAGS_REMOVE_common.o = -pg endif obj-y := intel_cacheinfo.o addon_cpuid_features.o -obj-y += proc.o capflags.o powerflags.o common.o +obj-y += proc.o capflags.o common.o obj-y += vmware.o hypervisor.o obj-$(CONFIG_X86_32) += bugs.o cmpxchg.o
arch/x86/kernel/cpu/amd.c +24 -9
@@ -333,15 +333,6 @@ static void __cpuinit early_init_amd(struct cpuinfo_x86 *c) {early_init_amd_mc (c); -/* -* c->x86_power is 8000_0007 edx. Bit 8 is TSC runs at constant rate -* with P/T states and does not stop in deep C-states -*/ -if (c->x86_power & (1 <<8 )) { -set_cpu_cap (c,X86_FEATURE_CONSTANT_TSC ); -set_cpu_cap (c,X86_FEATURE_NONSTOP_TSC ); - } -#ifdef CONFIG_X86_64 set_cpu_cap (c,X86_FEATURE_SYSCALL32 );#else
@@ -485,6 +476,30 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c) } }#endif + +/* Set cpufeatures for miscellaneous MSRs */ +if (c->x86 >=7 ) {/* K7+ */ +/* MSRC001_0015 Hardware Configuration Register (HWCR) */ +set_cpu_cap (c,X86_FEATURE_HW_CFG ); + } +if (c->x86 >=8 ) {/* K8+ */ +/* +* System configuration MSRs: +* MSRC001_0010 System Configuration Register (SYS_CFG) +* MSRC001_001F Northbridge Configuration Register (NB_CFG) +*/ +set_cpu_cap (c,X86_FEATURE_SYS_CFG ); +/* SMM MSRs C001_0111-C001_0113 & C001_0050-C000_0056 */ +set_cpu_cap (c,X86_FEATURE_SMM ); + } +if (c->x86 >=0x10 ) {/* fam10h+ */ +/* MSRC001_1022 Data Cache Configuration (DC_CFG) */ +set_cpu_cap (c,X86_FEATURE_CACHE_CTL ); +/* MSRC001_0058 MMIO Configuration Base Address Register*/ +set_cpu_cap (c,X86_FEATURE_MM_CFG ); +/* MSRC001_1023 Bus Unit Configuration Register (BU_CFG)*/ +set_cpu_cap (c,X86_FEATURE_BUS_CFG ); + } }#ifdef CONFIG_X86_32
arch/x86/kernel/cpu/common.c +16 -1
@@ -360,6 +360,7 @@ static void __cpuinit get_model_name(struct cpuinfo_x86 *c)cpuid (0x80000003 , &v[4 ], &v[5 ], &v[6 ], &v[7 ]);cpuid (0x80000004 , &v[8 ], &v[9 ], &v[10 ], &v[11 ]); c->x86_model_id[48 ] =0 ; +set_cpu_cap (c,X86_FEATURE_PNAME );/* * Intel chips right-justify this string for some dumb reason;
@@ -575,8 +576,22 @@ static void __cpuinit get_cpu_cap(struct cpuinfo_x86 *c)#endif if (c->extended_cpuid_level >=0x80000007 ) - c->x86_power =cpuid_edx (0x80000007 ); + c->x86_capability[9 ] =cpuid_edx (0x80000007 ); +/* +* Advanced power management is 8000_0007 edx. +* Bit 8 is TSC runs at constant rate with P/T states +* and does not stop in deep C-states. +* +* It is also reliable across cores and sockets. (but not across +* cabinets - we turn it off in that case explicitly.) +*/ +if (cpu_has (c,X86_FEATURE_CONSTANT_TSC )) { +set_cpu_cap (c,X86_FEATURE_NONSTOP_TSC ); +set_cpu_cap (c,X86_FEATURE_TSC_RELIABLE ); +if (c->x86_vendor ==X86_VENDOR_INTEL ) + sched_clock_stable =1 ; + } }static void __cpuinit identify_cpu_without_cpuid (struct cpuinfo_x86 *c)
arch/x86/kernel/cpu/cpu_debug.c +167 -375
658 lines not on this page · raw message
arch/x86/kernel/cpu/intel.c +79 -14
105 lines not on this page · raw message
arch/x86/kernel/cpu/powerflags.c deleted +0 -20
@@ -1,20 +0,0 @@ -/* -* Strings for the various x86 power flags -* -* This file must not contain any executable code. -*/ - -#include <asm/cpufeature.h> - -const char *const x86_power_flags[32 ] = { -"ts" ,/* temperature sensor */ -"fid" ,/* frequency id control */ -"vid" ,/* voltage id control */ -"ttp" ,/* thermal trip */ -"tm" , -"stc" , -"100mhzsteps" , -"hwpstate" , -"" ,/* tsc invariant mapped to constant_tsc */ -/* nothing */ -};
arch/x86/kernel/cpu/proc.c +0 -14
@@ -121,20 +121,6 @@ static int show_cpuinfo(struct seq_file *m, void *v)seq_printf (m,"address sizes\t: %u bits physical, %u bits virtual\n" , c->x86_phys_bits, c->x86_virt_bits);#endif - -seq_printf (m,"power management:" ); -for (i =0 ; i <32 ; i++) { -if (c->x86_power & (1 << i)) { -if (i <ARRAY_SIZE (x86_power_flags) && - x86_power_flags[i]) -seq_printf (m,"%s%s" , - x86_power_flags[i][0 ]?" " :"" , - x86_power_flags[i]); -else -seq_printf (m," [%d]" , i); - } - } -seq_printf (m,"\n\n" );return 0 ;
arch/x86/kernel/microcode_amd.c +3 -0
@@ -95,6 +95,9 @@ static int collect_cpu_info_amd(int cpu, struct cpu_signature *csig) "supported\n", cpu, c->x86);return -1 ; } +/* setting microcode update feature to friendly access of UCODE MSRs */ +set_cpu_cap (c,X86_FEATURE_MICROCODE ); +rdmsr (MSR_AMD64_PATCH_LEVEL , csig->rev, dummy);printk (KERN_INFO "microcode: CPU%d: patch_level=0x%x\n" , cpu, csig->rev);return 0 ;
arch/x86/kernel/microcode_intel.c +3 -0
@@ -168,6 +168,9 @@ static int collect_cpu_info(int cpu_num, struct cpu_signature *csig)return -1 ; } +/* setting microcode update feature to friendly access of UCODE MSRs */ +set_cpu_cap (c,X86_FEATURE_MICROCODE ); + csig->sig =cpuid_eax (0x00000001 );if ((c->x86_model >=5 ) || (c->x86 >6 )) {
Re: [RFC][git-pull -tip] x86: cpu_debug and cpufeature patches
Quoted 76 lines · Jaswinder Singh Rajput
Quoted 37 lines · Jaswinder Singh Rajput
Quoted 25 lines · Ingo Molnar
Quoted 14 lines · Jaswinder Singh Rajput
We can use
cpu_hastests for unknown processors but 'cpu model' is accurate and cover all range.
cpu_hasdoes not cover following registers:
1. platform
2. poweron
3. control
4. bios
5. freq
6. cache
7. misc
8. base
9. ver
10. confFirstly these should be added to
cpufeatures.h.Then add
cpu_has_xxx()accessors need to be added for them and during CPU init they have to be properly set, via two methods:- via CPUID (where this is possible+specified in docs)
- or via "later than CPU version X" checksQuoted 8 lines
Your cpu-model table is equivalent to an explicitly enumerated CPU version check, but this breaks every time a new CPU comes out.
"Later than" or CPUID based feature bits are a lot more future-proof
- we only have to add support for new _features_ (and quirks, occasionally), and dont have to maintain that full table of specific models to specific features mapping tables.I add some cpufeatures for review, I am still adding rest of them.
Quoted 7 lines
The following changes since commit
c861b6f8ea9b39699f4a35bbf7dc06eb937a34de:
Ingo Molnar (1):
Merge branch 'irq/urgent'are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/jaswinder/linux-2.6-tip.gitmasterI added some more patches for the review.
The following changes since commit
c861b6f8ea9b39699f4a35bbf7dc06eb937a34de:
Ingo Molnar (1):
Merge branch 'irq/urgent'are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/jaswinder/linux-2.6-tip.gitmasterJaswinder Singh Rajput (17):
x86:cpu_debug.cavoid storingcpu_descriptorslocally
x86:cpu_debugupdateKconfigentry
x86:cpu_debug.cremove unwanted header files
x86: Add cpufeature for Processor Name
x86: Add cpufeatures for Advanced Power Management
x86: Add cpufeature for Microcode update
x86: Add cpufeature for Cache MSRs
x86: Add cpufeature for Hard and Soft Poweron configuration
x86: Add cpufeature for Scaleable bus speed
x86: Add cpufeature for Miscellaneous Features
x86: Add cpufeature for Platform feature
x86: Add cpufeature for Hardware configuration
x86: Add cpufeature for System configuration
x86: Add cpufeature for System management mode (SMM)
x86: Add cpufeature for MM configuration
x86: Add cpufeature for Bus configuration
x86:cpu_debugreplacecpu_modelflagwithcpu_has
Quoted 15 lines
arch/x86/Kconfig | 11 +- arch/x86/include/asm/cpu_debug.h | 169 +----------- arch/x86/include/asm/cpufeature.h | 33 ++- arch/x86/include/asm/processor.h | 1 - arch/x86/kernel/cpu/Makefile | 2 +- arch/x86/kernel/cpu/amd.c | 33 ++- arch/x86/kernel/cpu/common.c | 17 +- arch/x86/kernel/cpu/cpu_debug.c | 542 ++++++++++++------------------------- arch/x86/kernel/cpu/intel.c | 93 ++++++- arch/x86/kernel/cpu/powerflags.c | 20 -- arch/x86/kernel/cpu/proc.c | 14 - arch/x86/kernel/microcode_amd.c | 3 + arch/x86/kernel/microcode_intel.c | 3 + 13 files changed, 339 insertions(+), 602 deletions(-) delete mode 100644 arch/x86/kernel/cpu/powerflags.c
ok, this removes a ton of code, so it's a big step forward.
Logistics-wise, it would be nice to separate out the CPU features bits, and submit them in a separate thread, right now. Please base that branch on the latest version of tip:x86/cpufeature.
That is where most of the discussion/tweaking will be. The arch/x86/kernel/cpu/cpu_debug.c bits then will be obvious cleanups and obvious enhancements.
Thanks,
Ingo
Hello Ingo,
Quoted 25 lines · Ingo Molnar
Quoted 14 lines · Jaswinder Singh Rajput
We can use
cpu_hastests for unknown processors but 'cpu model' is accurate and cover all range.
cpu_hasdoes not cover following registers:
1. platform
2. poweron
3. control
4. bios
5. freq
6. cache
7. misc
8. base
9. ver
10. confFirstly these should be added to
cpufeatures.h.Then add
cpu_has_xxx()accessors need to be added for them and during CPU init they have to be properly set, via two methods:- via CPUID (where this is possible+specified in docs)
- or via "later than CPU version X" checks
Quoted 8 lines
Your cpu-model table is equivalent to an explicitly enumerated CPU version check, but this breaks every time a new CPU comes out.
"Later than" or CPUID based feature bits are a lot more future-proof
- we only have to add support for new _features_ (and quirks, occasionally), and dont have to maintain that full table of specific models to specific features mapping tables.
It seems that other developers have some objections for adding new cpuid features.
May be we can try accessing MSRs without any checking, it will work on new processors but we need to check it on old processors, so I will need your help to run this modules on old processors.
Now what should be the next step.
Thanks,
--
JSR