lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1403285253-25547-1-git-send-email-prarit@redhat.com>
Date:	Fri, 20 Jun 2014 13:27:31 -0400
From:	Prarit Bhargava <prarit@...hat.com>
To:	linux-kernel@...r.kernel.org
Cc:	Prarit Bhargava <prarit@...hat.com>, Oren Twaig <oren@...lemp.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	"H. Peter Anvin" <hpa@...or.com>, x86@...nel.org,
	Borislav Petkov <bp@...e.de>,
	Paul Gortmaker <paul.gortmaker@...driver.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Andi Kleen <ak@...ux.intel.com>, Dave Jones <davej@...hat.com>,
	Torsten Kaiser <just.for.lkml@...glemail.com>,
	Jan Beulich <JBeulich@...e.com>,
	Jan Kiszka <jan.kiszka@...mens.com>,
	Toshi Kani <toshi.kani@...com>,
	Andrew Jones <drjones@...hat.com>
Subject: [PATCH 0/2] Fixes for smp_num_siblings calculation

I have a system on which I have disabled threading in the BIOS, and I am booting
the kernel with the option "idle=poll".

The kernel displays

process: WARNING: polling idle and HT enabled, performance may degrade

which is incorrect -- I've already disabled HT.

This warning is issued here:

void select_idle_routine(const struct cpuinfo_x86 *c)
{
        if (boot_option_idle_override == IDLE_POLL && smp_num_siblings > 1)
                pr_warn_once("WARNING: polling idle and HT enabled, performance may degrade\n");

>From my understanding of the other areas of kernel that use smp_num_siblings,
the value is supposed to be the actual number of threads per core, and
this value of smp_num_siblings is incorrect.  In theory, it should be 1 but it
is reported as 2.  When I looked into how smp_num_siblings is calculated I
found the following call sequence in the kernel:

start_kernel ->
        check_bugs ->
                identify_boot_cpu ->
                                identify_cpu ->
                                        c_init = init_intel
                                                init_intel ->
                                                        detect_extended_topology
                                                        (sets value)

                                        OR

                                        c_init = init_amd
                                                init_amd -> amd_detect_cmp
                                                             -> amd_get_topology
                                                                (sets value)
                                                         -> detect_ht()
                                        ...		    (sets value)
                                        detect_ht()
                                        (also sets value)

ie) it is confusing to figure out where smp_num_siblings is set, and AFAICT,
it is set to the "factory reported" value.

This patchset sets smp_num_siblings to the expected value of the actual number
of siblings each core has.  The 2/2 patchset, disables the "ht" flag if
each core has only one sibling.

Cc: Oren Twaig <oren@...lemp.com>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Ingo Molnar <mingo@...hat.com>
Cc: "H. Peter Anvin" <hpa@...or.com>
Cc: x86@...nel.org
Cc: Borislav Petkov <bp@...e.de>
Cc: Paul Gortmaker <paul.gortmaker@...driver.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: Andi Kleen <ak@...ux.intel.com>
Cc: Dave Jones <davej@...hat.com>
Cc: Torsten Kaiser <just.for.lkml@...glemail.com>
Cc: Jan Beulich <JBeulich@...e.com>
Cc: Jan Kiszka <jan.kiszka@...mens.com>
Cc: Toshi Kani <toshi.kani@...com>
Cc: Andrew Jones <drjones@...hat.com>
Signed-off-by: Prarit Bhargava <prarit@...hat.com>

Prarit Bhargava (2):
  x86, Clean up smp_num_siblings calculation
  x86, disable ht flag when hyperthreading is disabled

 arch/x86/kernel/cpu/amd.c      |    1 -
 arch/x86/kernel/cpu/common.c   |   23 +++++++++++------------
 arch/x86/kernel/cpu/topology.c |    2 +-
 arch/x86/kernel/smpboot.c      |   14 +++++++++++---
 4 files changed, 23 insertions(+), 17 deletions(-)

-- 
1.7.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ