1. 20 Oct, 2015 1 commit
    • Oleg Nesterov's avatar
      stop_machine: Kill smp_hotplug_thread->pre_unpark, introduce stop_machine_unpark() · c00166d8
      Oleg Nesterov authored
      1. Change smpboot_unpark_thread() to check ->selfparking, just
         like smpboot_park_thread() does.
      
      2. Introduce stop_machine_unpark() which sets ->enabled and calls
         kthread_unpark().
      
      3. Change smpboot_thread_call() and cpu_stop_init() to call
         stop_machine_unpark() by hand.
      
      This way:
      
          - IMO the ->selfparking logic becomes more consistent.
      
          - We can kill the smp_hotplug_thread->pre_unpark() method.
      
          - We can easily unpark the stopper thread earlier. Say, we
            can move stop_machine_unpark() from smpboot_thread_call()
            to sched_cpu_active() as Peter suggests.
      Signed-off-by: default avatarOleg Nesterov <oleg@redhat.com>
      Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: heiko.carstens@de.ibm.com
      Link: http://lkml.kernel.org/r/20151009160049.GA10166@redhat.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      c00166d8
  2. 04 Sep, 2015 1 commit
  3. 24 Jun, 2015 1 commit
    • Chris Metcalf's avatar
      smpboot: allow excluding cpus from the smpboot threads · b5242e98
      Chris Metcalf authored
      This patch series allows the watchdog to run by default only on the
      housekeeping cores when nohz_full is in effect; this seems to be a good
      compromise short of turning it off completely (since the nohz_full cores
      can't tolerate a watchdog).
      
      To provide customizability, we add /proc/sys/kernel/watchdog_cpumask so
      that the set of cores running the watchdog can be tuned to different
      values after bootup.
      
      To implement this customizability, we add a new
      smpboot_update_cpumask_percpu_thread() API to the smpboot_thread
      subsystem that lets us park or unpark "unwanted" threads.
      
      And now that threads can be parked for long periods of time, we tweak the
      /proc/<pid>/stat and /proc/<pid>/status code so parked threads aren't
      reported as running, which is otherwise confusing.
      
      This patch (of 3):
      
      This change allows some cores to be excluded from running the
      smp_hotplug_thread tasks.  The following commit to update
      kernel/watchdog.c to use this functionality is the motivating example, and
      more information on the motivation is provided there.
      
      A new smp_hotplug_thread field is introduced, "cpumask", which is cpumask
      field managed by the smpboot subsystem that indicates whether or not the
      given smp_hotplug_thread should run on that core; the cpumask is checked
      when deciding whether to unpark the thread.
      
      To limit the cpumask to less than cpu_possible, you must call
      smpboot_update_cpumask_percpu_thread() after registering.
      Signed-off-by: default avatarChris Metcalf <cmetcalf@ezchip.com>
      Cc: Don Zickus <dzickus@redhat.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Ulrich Obergfell <uobergfe@redhat.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      b5242e98
  4. 06 Mar, 2015 1 commit
  5. 26 Feb, 2013 1 commit
    • Thomas Gleixner's avatar
      stop_machine: Mark per cpu stopper enabled early · 46c498c2
      Thomas Gleixner authored
      commit 14e568e7 (stop_machine: Use smpboot threads) introduced the
      following regression:
      
      Before this commit the stopper enabled bit was set in the online
      notifier.
      
      CPU0				CPU1
      cpu_up
      				cpu online
      hotplug_notifier(ONLINE)
        stopper(CPU1)->enabled = true;
      ...
      stop_machine()
      
      The conversion to smpboot threads moved the enablement to the wakeup
      path of the parked thread. The majority of users seem to have the
      following working order:
      
      CPU0				CPU1
      cpu_up
      				cpu online
      unpark_threads()
        wakeup(stopper[CPU1])
      ....
      				stopper thread runs
      				  stopper(CPU1)->enabled = true;
      stop_machine()
      
      But Konrad and Sander have observed:
      
      CPU0				CPU1
      cpu_up
      				cpu online
      unpark_threads()
        wakeup(stopper[CPU1])
      ....
      stop_machine()
      				stopper thread runs
      				  stopper(CPU1)->enabled = true;
      
      Now the stop machinery kicks CPU0 into the stop loop, where it gets
      stuck forever because the queue code saw stopper(CPU1)->enabled ==
      false, so CPU0 waits for CPU1 to enter stomp_machine, but the CPU1
      stopper work got discarded due to enabled == false.
      
      Add a pre_unpark function to the smpboot thread descriptor and call it
      before waking the thread.
      
      This fixes the problem at hand, but the stop_machine code should be
      more robust. The stopper->enabled flag smells fishy at best.
      
      Thanks to Konrad for going through a loop of debug patches and
      providing the information to decode this issue.
      Reported-and-tested-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Reported-and-tested-by: default avatarSander Eikelenboom <linux@eikelenboom.it>
      Cc: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Link: http://lkml.kernel.org/r/alpine.LFD.2.02.1302261843240.22263@ionosSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      46c498c2
  6. 14 Feb, 2013 1 commit
    • Thomas Gleixner's avatar
      smpboot: Allow selfparking per cpu threads · 7d7e499f
      Thomas Gleixner authored
      The stop machine threads are still killed when a cpu goes offline. The
      reason is that the thread is used to bring the cpu down, so it can't
      be parked along with the other per cpu threads.
      
      Allow a per cpu thread to be excluded from automatic parking, so it
      can park itself once it's done
      
      Add a create callback function as well.
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rusty Russell <rusty@rustcorp.com.au>
      Cc: Paul McKenney <paulmck@linux.vnet.ibm.com>
      Cc: Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
      Cc: Arjan van de Veen <arjan@infradead.org>
      Cc: Paul Turner <pjt@google.com>
      Cc: Richard Weinberger <rw@linutronix.de>
      Cc: Magnus Damm <magnus.damm@gmail.com>
      Link: http://lkml.kernel.org/r/20130131120741.553993267@linutronix.deSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      7d7e499f
  7. 13 Aug, 2012 1 commit