All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: speck@linutronix.de
Subject: Re: [patch V4 05/13] cpu/hotplug: Provide knobs to control SMT
Date: Thu, 21 Jun 2018 08:08:23 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.21.1806210804430.1591@nanos.tec.linutronix.de> (raw)
In-Reply-To: <20180620230524.GA31814@kroah.com>

On Thu, 21 Jun 2018, speck for Greg KH wrote:
> On Wed, Jun 20, 2018 at 10:19:12PM +0200, speck for Thomas Gleixner wrote:
> > +static int cpuhp_smt_disable(enum cpuhp_smt_control ctrlval)
> > +{
> > +	int cpu, ret = 0;
> > +
> > +	cpu_maps_update_begin();
> > +	for_each_online_cpu(cpu) {
> > +		struct device *dev;
> > +
> > +		if (topology_is_primary_thread(cpu))
> > +			continue;
> > +		ret = cpu_down_maps_locked(cpu, CPUHP_OFFLINE);
> > +		if (ret)
> > +			break;
> > +		/*
> > +		 * As this needs to hold the cpu maps lock it's impossible
> > +		 * to call device_offline(), so nothing would update
> > +		 * device:offline state. That would leave the sysfs entry
> > +		 * stale and prevent onlining after smt control has been
> > +		 * changed to 'off' again. This is called under the sysfs
> > +		 * hotplug lock, so it is properly serialized.
> > +		 *
> > +		 * Temporary workaround until Greg has a smarter idea to do
> > +		 * that.
> > +		 */
> > +		dev = get_cpu_device(cpu);
> > +		dev->offline = true;
> 
> You are right to call me out here.  Ugh.
> 
> I'm missing where device_offline() wants to call any lock other than the
> lock on the device you are offlineing.  Why can't that be called here?

Because it ends up cpu_maps_update_begin() at the end, which is already
held.

> If you do just want to "open code" this, you should also tell userspace
> what just happened, so should you add this line as well:
> 		kobject_uevent(&dev->kobj, KOBJ_OFFLINE);

Ok.

Thanks,

	tglx

  reply	other threads:[~2018-06-21  6:08 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-20 20:19 [patch V4 00/13] SMT control knobs Thomas Gleixner
2018-06-20 20:19 ` [patch V4 01/13] sched/smt: Update sched_smt_present at runtime Thomas Gleixner
2018-06-20 20:19 ` [patch V4 02/13] x86/smp: Provide topology_is_primary_thread() Thomas Gleixner
2018-06-27 13:56   ` [MODERATED] " Josh Poimboeuf
2018-06-27 15:54     ` Thomas Gleixner
2018-06-27 16:20       ` [MODERATED] " Josh Poimboeuf
2018-06-27 16:52         ` Thomas Gleixner
2018-06-20 20:19 ` [patch V4 03/13] cpu/hotplug: Make bringup/teardown of smp threads symmetric Thomas Gleixner
2018-06-20 20:19 ` [patch V4 04/13] cpu/hotplug: Split do_cpu_down() Thomas Gleixner
2018-06-20 20:19 ` [patch V4 05/13] cpu/hotplug: Provide knobs to control SMT Thomas Gleixner
2018-06-20 23:05   ` [MODERATED] " Greg KH
2018-06-21  6:08     ` Thomas Gleixner [this message]
2018-06-20 20:19 ` [patch V4 06/13] x86/cpu: Remove the pointless CPU printout Thomas Gleixner
2018-06-20 20:19 ` [patch V4 07/13] x86/cpu/AMD: Remove the pointless detect_ht() call Thomas Gleixner
2018-06-20 20:19 ` [patch V4 08/13] x86/cpu/common: Provide detect_ht_early() Thomas Gleixner
2018-06-20 20:19 ` [patch V4 09/13] x86/cpu/topology: Provide detect_extended_topology_early() Thomas Gleixner
2018-06-20 20:19 ` [patch V4 10/13] x86/cpu/intel: Evaluate smp_num_siblings early Thomas Gleixner
2018-06-20 20:19 ` [patch V4 11/13] x86/CPU/AMD: Do not check CPUID max ext level before parsing SMP info Thomas Gleixner
2018-06-20 20:19 ` [patch V4 12/13] x86/cpu/AMD: Evaluate smp_num_siblings early Thomas Gleixner
2018-06-20 20:19 ` [patch V4 13/13] x86/apic: Ignore secondary threads if nosmt=force Thomas Gleixner
2018-06-20 21:44   ` [MODERATED] " Linus Torvalds
2018-06-28 22:13   ` Dave Hansen
2018-06-28 22:19     ` Andrew Cooper
2018-06-28 22:23     ` Luck, Tony
2018-06-28 22:29       ` Andrew Cooper
2018-06-29  8:26     ` [MODERATED] " Borislav Petkov
2018-06-29 17:01       ` Luck, Tony
2018-06-29 17:08         ` Linus Torvalds
2018-06-29 18:36           ` Thomas Gleixner
2018-06-29  8:50     ` Thomas Gleixner
2018-06-29 16:48       ` [MODERATED] " Dave Hansen
2018-06-20 20:53 ` [patch V4 00/13] SMT control knobs Thomas Gleixner
2018-06-21 11:52 ` [MODERATED] " Ingo Molnar

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=alpine.DEB.2.21.1806210804430.1591@nanos.tec.linutronix.de \
    --to=tglx@linutronix.de \
    --cc=speck@linutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.