From: Prarit Bhargava <prarit@redhat.com>
To: Oren Twaig <oren@scalemp.com>
Cc: linux-kernel@vger.kernel.org, pbonzini@redhat.com,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>,
x86@kernel.org, Borislav Petkov <bp@suse.de>,
Paul Gortmaker <paul.gortmaker@windriver.com>,
Andrew Morton <akpm@linux-foundation.org>,
Andi Kleen <ak@linux.intel.com>, Dave Jones <davej@redhat.com>,
Torsten Kaiser <just.for.lkml@googlemail.com>,
Jan Beulich <JBeulich@suse.com>,
Jan Kiszka <jan.kiszka@siemens.com>,
Toshi Kani <toshi.kani@hp.com>, Andrew Jones <drjones@redhat.com>,
"Shai (Shai@ScaleMP.com)" <Shai@scalemp.com>
Subject: Re: [PATCH 1/2] x86, Clean up smp_num_siblings calculation
Date: Sun, 01 Jun 2014 19:19:45 -0400 [thread overview]
Message-ID: <538BB511.1020709@redhat.com> (raw)
In-Reply-To: <538AF11F.8060802@scalemp.com>
On 06/01/2014 05:23 AM, Oren Twaig wrote:
> Hi Prarit,
>
> See below,
>
> On 05/30/2014 02:43 PM, Prarit Bhargava wrote:
>> 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 ares of kernel that use
>> smp_num_siblings, the value is supposed to be the the number of threads
>> per core.
>>
>> The 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 set three times in some cases and is overwritten by the call
>> to detect_ht() from identify_cpu() in all cases.
>>
>> It should be noted that nothing in the identify_cpu() path or the cpu_up()
>> path requires smp_num_siblings to be set, prior to the final call to
>> detect_ht().
>>
>> For x86 boxes, smp_num_siblings is set to a value read in a CPUID call in
>> detect_ht(). This value is the *factory defined* value in all cases; even
>> if HT is disabled in BIOS the value still returns 2 if the CPU supports
>> HT. AMD also reports the factory defined value in all cases.
>
> The above is incorrect in case of X-TOPOLOGY mode. I such a case the information
> about number of siblings comes from the LEVEL_MAX_SIBLINGS() macro and the
> X86_FEATURE_XTOPOLOGY flag is set to skip detect_ht() work :
> void detect_ht(struct cpuinfo_x86 *c)
> ...
> if (cpu_has(c, X86_FEATURE_XTOPOLOGY))
> return;
>
> In addition, the information about the number of sibling no longer comes from
> CPUID(0x1)->ebx but rather from the 0xb leaf of CPUID.
>
> I've marked below the problematic code change.
I will do a [v2] of the patchset that omits this change
>> - core_level_siblings = smp_num_siblings = LEVEL_MAX_SIBLINGS(ebx);
>> + core_level_siblings = LEVEL_MAX_SIBLINGS(ebx);
and then removes the setting of smp_num_siblings in 2/2.
Thanks,
P.
next prev parent reply other threads:[~2014-06-01 23:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-30 11:43 [PATCH 0/2] x86, fix smp_num_siblings calculation and usage Prarit Bhargava
2014-05-30 11:43 ` [PATCH 1/2] x86, Clean up smp_num_siblings calculation Prarit Bhargava
2014-06-01 9:23 ` Oren Twaig
2014-06-01 23:19 ` Prarit Bhargava [this message]
2014-05-30 11:43 ` [PATCH 2/2] x86, Calculate smp_num_siblings once Prarit Bhargava
-- strict thread matches above, loose matches on Subject: below --
2014-06-20 17:27 [PATCH 0/2] Fixes for smp_num_siblings calculation Prarit Bhargava
2014-06-20 17:27 ` [PATCH 1/2] x86, Clean up " Prarit Bhargava
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=538BB511.1020709@redhat.com \
--to=prarit@redhat.com \
--cc=JBeulich@suse.com \
--cc=Shai@scalemp.com \
--cc=ak@linux.intel.com \
--cc=akpm@linux-foundation.org \
--cc=bp@suse.de \
--cc=davej@redhat.com \
--cc=drjones@redhat.com \
--cc=hpa@zytor.com \
--cc=jan.kiszka@siemens.com \
--cc=just.for.lkml@googlemail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=oren@scalemp.com \
--cc=paul.gortmaker@windriver.com \
--cc=pbonzini@redhat.com \
--cc=tglx@linutronix.de \
--cc=toshi.kani@hp.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox