mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Feng Tang <feng.tang@intel.com>
To: Dave Hansen <dave.hansen@intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	"H . Peter Anvin" <hpa@zytor.com>,
	"Peter Zijlstra" <peterz@infradead.org>, <x86@kernel.org>,
	<linux-kernel@vger.kernel.org>, <rui.zhang@intel.com>,
	<tim.c.chen@intel.com>, <liaoyu15@huawei.com>
Subject: Re: [RFC PATCH] x86/tsc: use topology_max_packages() in tsc watchdog check
Date: Tue, 18 Oct 2022 09:07:46 +0800	[thread overview]
Message-ID: <Y038Ym8e0K7Cz3WR@feng-clx> (raw)
In-Reply-To: <ff269ad9-2811-e427-3bb9-5b4c978e80bf@intel.com>

On Mon, Oct 17, 2022 at 04:15:24PM -0700, Dave Hansen wrote:
> On 10/17/22 06:29, Feng Tang wrote:
> > +	if (boot_cpu_has(X86_FEATURE_CONSTANT_TSC) &&
> > +	    boot_cpu_has(X86_FEATURE_NONSTOP_TSC) &&
> > +	    boot_cpu_has(X86_FEATURE_TSC_ADJUST) &&
> > +	    topology_max_packages() <= 2)
> > +		clocksource_tsc.flags &= ~CLOCK_SOURCE_MUST_VERIFY;
> 
> I couldn't help but notice the comment in here:
> 
> > void __init calculate_max_logical_packages(void)
> > {
> >         int ncpus;
> > 
> >         /*
> >          * Today neither Intel nor AMD support heterogeneous systems so
> >          * extrapolate the boot cpu's data to all packages.
> >          */
> >         ncpus = cpu_data(0).booted_cores * topology_max_smt_threads();
> >         __max_logical_packages = DIV_ROUND_UP(total_cpus, ncpus);
> >         pr_info("Max logical packages: %u\n", __max_logical_packages);
> > }
> 
> Could you double check for me that the Alder Lake combination Core/Atom
> CPUs don't count as "heterogeneous systems" in this case?

Thanks for the great catch! This API seems to be obsolete and shouldn't
be used, even if the number happens to equal to 'logical_packages'  

I found a Alder Lake platform which has 6 P-cores and 8 E-cores (Thanks
Rui for sharing it), the log shows "smpboot: Max logical packages: 1",
and 'cat /proc/cpuinfo | grep "physical id"' shows all its CPU's package
ID is '0'

When writing the RFC patch, I followed the smp_init() discussed by Peter
and Rui, where 'logical_packages' is the appropriate number, which is
updated in topology_update_package_map() after each CPU gets initialized.

Possible fix for this could be:
* export 'logical_packages' for tsc use
* update calculate_max_logical_packages() to return 'logical_packages'

Thoughts?

Thanks,
Feng

      reply	other threads:[~2022-10-18  1:08 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-17 13:29 Feng Tang
2022-10-17 23:15 ` Dave Hansen
2022-10-18  1:07   ` Feng Tang [this message]

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=Y038Ym8e0K7Cz3WR@feng-clx \
    --to=feng.tang@intel.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@intel.com \
    --cc=hpa@zytor.com \
    --cc=liaoyu15@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rui.zhang@intel.com \
    --cc=tglx@linutronix.de \
    --cc=tim.c.chen@intel.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

all inboxes | Powered by JetHome®