The commit is pushed to "branch-rh7-3.10.0-229.7.2.vz7.9.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git after rh7-3.10.0-229.7.2.vz7.8.9 ------> commit 41e0b6471b4ef32fd2888a79a1b2eb18bd091e7f Author: Vladimir Davydov <vdavy...@virtuozzo.com> Date: Tue Oct 20 20:00:19 2015 +0400
arch/x86: check if cpuid level exists while reporting cpuinfo Port diff-arch-x86-check-if-cpuid-level-exists-while-reporting-cpuinfo For /proc/cpuinfo to reflect cpuid masking/faulting setup we use cpuid instruction to get some features. However, the cpuid levels may not exist, in which case cpuid'll return rubbish. Let's assure that the cpuid levels exist, just like we do in get_cpu_cap. Signed-off-by: Vladimir Davydov <vdavy...@parallels.com> Acked-by: Cyrill Gorcunov <gorcu...@openvz.org> ============================================================================= https://jira.sw.ru/browse/PSBM-33638 Signed-off-by: Vladimir Davydov <vdavy...@virtuozzo.com> --- arch/x86/kernel/cpu/proc.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/arch/x86/kernel/cpu/proc.c b/arch/x86/kernel/cpu/proc.c index e98290b..77c7c82 100644 --- a/arch/x86/kernel/cpu/proc.c +++ b/arch/x86/kernel/cpu/proc.c @@ -75,10 +75,14 @@ static void init_cpu_flags(void *dummy) if (cpu_has(c, i)) set_bit(i, (unsigned long *)flags); - __do_cpuid_fault(0x00000001, 0, &tmp1, &tmp2, - &flags->val[4], &flags->val[0]); - __do_cpuid_fault(0x80000001, 0, &tmp1, &tmp2, - &flags->val[6], &flags->val[1]); + if (c->cpuid_level >= 0x00000001) + __do_cpuid_fault(0x00000001, 0, &tmp1, &tmp2, + &flags->val[4], &flags->val[0]); + + if ((c->extended_cpuid_level & 0xffff0000) == 0x80000000 && + c->extended_cpuid_level >= 0x80000001) + __do_cpuid_fault(0x80000001, 0, &tmp1, &tmp2, + &flags->val[6], &flags->val[1]); } static int show_cpuinfo(struct seq_file *m, void *v) _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel