public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: linux-kernel@vger.kernel.org, linux-tip-commits@vger.kernel.org,
	tip-bot2 for Giovanni Gherdovich <tip-bot2@linutronix.de>,
	Giovanni Gherdovich <ggherdovich@suse.cz>,
	Ingo Molnar <mingo@kernel.org>,
	Doug Smythies <dsmythies@telus.net>,
	"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
	x86 <x86@kernel.org>
Subject: Re: [tip: sched/core] x86, sched: Add support for frequency invariance
Date: Mon, 30 Mar 2020 14:52:19 +0200	[thread overview]
Message-ID: <20200330125219.GM20696@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <158556634294.3228.4889951961483021094@build.alporthouse.com>

On Mon, Mar 30, 2020 at 12:05:42PM +0100, Chris Wilson wrote:
> Quoting tip-bot2 for Giovanni Gherdovich (2020-01-29 11:32:58)
> > The following commit has been merged into the sched/core branch of tip:
> > 
> > Commit-ID:     1567c3e3467cddeb019a7b53ec632f834b6a9239
> > Gitweb:        https://git.kernel.org/tip/1567c3e3467cddeb019a7b53ec632f834b6a9239
> > Author:        Giovanni Gherdovich <ggherdovich@suse.cz>
> > AuthorDate:    Wed, 22 Jan 2020 16:16:12 +01:00
> > Committer:     Ingo Molnar <mingo@kernel.org>
> > CommitterDate: Tue, 28 Jan 2020 21:36:59 +01:00
> > 
> > x86, sched: Add support for frequency invariance
> > diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
> > index 69881b2..28696bc 100644
> > --- a/arch/x86/kernel/smpboot.c
> > +++ b/arch/x86/kernel/smpboot.c
> > @@ -147,6 +147,8 @@ static inline void smpboot_restore_warm_reset_vector(void)
> >         *((volatile u32 *)phys_to_virt(TRAMPOLINE_PHYS_LOW)) = 0;
> >  }
> >  
> > +static void init_freq_invariance(void);
> > +
> >  /*
> >   * Report back to the Boot Processor during boot time or to the caller processor
> >   * during CPU online.
> > @@ -183,6 +185,8 @@ static void smp_callin(void)
> >          */
> >         set_cpu_sibling_map(raw_smp_processor_id());
> >  
> > +       init_freq_invariance();
> > +
> >         /*
> >          * Get our bogomips.
> >          * Update loops_per_jiffy in cpu_data. Previous call to
> > @@ -1337,7 +1341,7 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus)
> >         set_sched_topology(x86_topology);
> >  
> >         set_cpu_sibling_map(0);
> > -
> > +       init_freq_invariance();
> >         smp_sanity_check();
> >  
> >         switch (apic_intr_mode) {
> 
> Since this has become visible via linux-next [20200326?], we have been
> deluged by oops during cpu-hotplug.

Ooh, you're doing CPU-0 hotplug, yuck!

I think something like the below ought to work; let me go see if I can
get that cpu-0 hotplug crud working on my machines.

---

diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index fe3ab9632f3b..681f96f05619 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -147,7 +147,7 @@ static inline void smpboot_restore_warm_reset_vector(void)
 	*((volatile u32 *)phys_to_virt(TRAMPOLINE_PHYS_LOW)) = 0;
 }
 
-static void init_freq_invariance(void);
+static void init_freq_invariance(bool secondary);
 
 /*
  * Report back to the Boot Processor during boot time or to the caller processor
@@ -185,7 +185,7 @@ static void smp_callin(void)
 	 */
 	set_cpu_sibling_map(raw_smp_processor_id());
 
-	init_freq_invariance();
+	init_freq_invariance(true);
 
 	/*
 	 * Get our bogomips.
@@ -1341,7 +1341,7 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus)
 	set_sched_topology(x86_topology);
 
 	set_cpu_sibling_map(0);
-	init_freq_invariance();
+	init_freq_invariance(false);
 	smp_sanity_check();
 
 	switch (apic_intr_mode) {
@@ -2002,13 +2002,20 @@ static void init_counter_refs(void *arg)
 	this_cpu_write(arch_prev_mperf, mperf);
 }
 
-static void init_freq_invariance(void)
+static void init_freq_invariance(bool secondary)
 {
 	bool ret = false;
 
-	if (smp_processor_id() != 0 || !boot_cpu_has(X86_FEATURE_APERFMPERF))
+	if (!boot_cpu_has(X86_FEATURE_APERFMPERF))
 		return;
 
+	if (secondary) {
+		if (static_branch_likely(&arch_scale_freq_key)) {
+			init_counter_refs(NULL);
+		}
+		return;
+	}
+
 	if (boot_cpu_data.x86_vendor == X86_VENDOR_INTEL)
 		ret = intel_set_max_freq_ratio();
 

  parent reply	other threads:[~2020-03-30 12:52 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-22 15:16 [PATCH v5 0/6] Add support for frequency invariance for (some) x86 Giovanni Gherdovich
2020-01-22 15:16 ` [PATCH v5 1/6] x86,sched: Add support for frequency invariance Giovanni Gherdovich
2020-01-29 11:32   ` [tip: sched/core] x86, sched: " tip-bot2 for Giovanni Gherdovich
2020-03-30 11:05     ` Chris Wilson
2020-03-30 11:30       ` Valentin Schneider
2020-03-30 12:52       ` Peter Zijlstra [this message]
2020-03-30 16:03         ` Valentin Schneider
2020-03-31 18:11       ` Giovanni Gherdovich
2020-03-31 18:33         ` Chris Wilson
2020-01-22 15:16 ` [PATCH v5 2/6] x86,sched: Add support for frequency invariance on SKYLAKE_X Giovanni Gherdovich
2020-01-29 11:32   ` [tip: sched/core] x86, sched: " tip-bot2 for Giovanni Gherdovich
2020-01-22 15:16 ` [PATCH v5 3/6] x86,sched: Add support for frequency invariance on XEON_PHI_KNL/KNM Giovanni Gherdovich
2020-01-29 11:32   ` [tip: sched/core] x86, sched: " tip-bot2 for Giovanni Gherdovich
2020-01-22 15:16 ` [PATCH v5 4/6] x86,sched: Add support for frequency invariance on ATOM_GOLDMONT* Giovanni Gherdovich
2020-01-29 11:32   ` [tip: sched/core] x86, sched: " tip-bot2 for Giovanni Gherdovich
2020-01-22 15:16 ` [PATCH v5 5/6] x86,sched: Add support for frequency invariance on ATOM Giovanni Gherdovich
2020-01-29 11:32   ` [tip: sched/core] x86, sched: " tip-bot2 for Giovanni Gherdovich
2020-01-22 15:16 ` [PATCH v5 6/6] x86: intel_pstate: handle runtime turbo disablement/enablement in freq. invariance Giovanni Gherdovich
2020-01-29 11:32   ` [tip: sched/core] x86/intel_pstate: Handle runtime turbo disablement/enablement in frequency invariance tip-bot2 for Giovanni Gherdovich
2020-01-23 15:30 ` [PATCH v5 0/6] Add support for frequency invariance for (some) x86 Rafael J. Wysocki
2020-01-23 15:44   ` Peter Zijlstra

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=20200330125219.GM20696@hirez.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=chris@chris-wilson.co.uk \
    --cc=dsmythies@telus.net \
    --cc=ggherdovich@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=tip-bot2@linutronix.de \
    --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