1. 26 1月, 2019 10 次提交
    • P
      rcu: Add sysrq rcu_node-dump capability · 2ccaff10
      Paul E. McKenney 提交于
      Life is hard if RCU manages to get stuck without triggering RCU CPU
      stall warnings or triggering the rcu_check_gp_start_stall() checks
      for failing to start a grace period.  This commit therefore adds a
      boot-time-selectable sysrq key (commandeering "y") that allows manually
      dumping Tree RCU state.  The new rcutree.sysrq_rcu kernel boot parameter
      must be set for this sysrq to be available.
      Signed-off-by: NPaul E. McKenney <paulmck@linux.ibm.com>
      2ccaff10
    • P
      rcu: Protect rcu_check_gp_kthread_starvation() access to ->gp_flags · 3b6505fd
      Paul E. McKenney 提交于
      The rcu_check_gp_kthread_starvation() function can be invoked without
      holding locks, so the access to the rcu_state structure's ->gp_flags
      field must be protected with READ_ONCE().  This commit therefore adds
      this protection.
      Signed-off-by: NPaul E. McKenney <paulmck@linux.ibm.com>
      3b6505fd
    • P
      rcu: Improve diagnostics for failed RCU grace-period start · fd897573
      Paul E. McKenney 提交于
      If a grace period fails to start (for example, because you commented
      out the last two lines of rcu_accelerate_cbs_unlocked()), rcu_core()
      will invoke rcu_check_gp_start_stall(), which will notice and complain.
      However, this complaint is lacking crucial debugging information such
      as when the last wakeup executed and what the value of ->gp_seq was at
      that time.  This commit therefore removes the current pr_alert() from
      rcu_check_gp_start_stall(), instead invoking show_rcu_gp_kthreads(),
      which has been updated to print the needed information, which is collected
      by rcu_gp_kthread_wake().
      Signed-off-by: NPaul E. McKenney <paulmck@linux.ibm.com>
      fd897573
    • P
      rcu: Update NOCB comments · a9fefdb2
      Paul E. McKenney 提交于
      This commit updates a few obsolete comments in the RCU callback-offload
      code.
      Signed-off-by: NPaul E. McKenney <paulmck@linux.ibm.com>
      a9fefdb2
    • P
      rcu: Remove unused rcu_cpu_kthread_cpu per-CPU variable · b2c1955b
      Paul E. McKenney 提交于
      The rcu_cpu_kthread_cpu used to provide debugfs information, but is no
      longer used.  This commit therefore removes it.
      Signed-off-by: NPaul E. McKenney <paulmck@linux.ibm.com>
      b2c1955b
    • P
      rcu: Move rcu_cpu_has_work to rcu_data structure · f7e972ee
      Paul E. McKenney 提交于
      Given that RCU has a perfectly good per-CPU rcu_data structure, most
      per-CPU quantities should be stored there.
      
      This commit therefore moves the rcu_cpu_has_work per-CPU variable to
      the rcu_data structure.  This also makes this variable unconditionally
      present, which should be acceptable given the memory reduction due to the
      RCU flavor consolidation and also due to simplifications this will enable.
      Signed-off-by: NPaul E. McKenney <paulmck@linux.ibm.com>
      f7e972ee
    • P
      rcu: Remove unused rcu_cpu_kthread_loops per-CPU variable · 8b4d0f48
      Paul E. McKenney 提交于
      The rcu_cpu_kthread_loops variable used to provide debugfs information,
      but is no longer used.  This commit therefore removes it.
      Signed-off-by: NPaul E. McKenney <paulmck@linux.ibm.com>
      8b4d0f48
    • P
      rcu: Move rcu_cpu_kthread_status to rcu_data structure · 6ffdde28
      Paul E. McKenney 提交于
      Given that RCU has a perfectly good per-CPU rcu_data structure, most
      per-CPU quantities should be stored there.
      
      This commit therefore moves the rcu_cpu_kthread_status per-CPU variable
      to the rcu_data structure.  This also makes this variable unconditionally
      present, which should be acceptable given the memory reduction due to the
      RCU flavor consolidation and also due to simplifications this will enable.
      Signed-off-by: NPaul E. McKenney <paulmck@linux.ibm.com>
      6ffdde28
    • P
      rcu: Move rcu_cpu_kthread_task to rcu_data structure · 37f62d7c
      Paul E. McKenney 提交于
      Given that RCU has a perfectly good per-CPU rcu_data structure, most
      per-CPU quantities should be stored there.
      
      This commit therefore moves the rcu_cpu_kthread_task per-CPU variable to
      the rcu_data structure.  This also makes this variable unconditionally
      present, which should be acceptable given the memory reduction due to the
      RCU flavor consolidation and also due to simplifications this will enable.
      Signed-off-by: NPaul E. McKenney <paulmck@linux.ibm.com>
      37f62d7c
    • P
      rcu: Accommodate zero jiffies_till_first_fqs and kthread kicking · 9cf422a8
      Paul E. McKenney 提交于
      It is perfectly fine to set the rcutree.jiffies_till_first_fqs boot
      parameter to zero, in fact, this can be useful on specialty systems that
      usually have at least one idle CPU and that need fast grace periods.
      This is because this setting causes the RCU grace-period kthread to
      scan for idle threads immediately after grace-period initialization,
      as opposed to waiting several jiffies to do so.
      
      It is also perfectly fine to set the rcutree.rcu_kick_kthreads kernel
      parameter, which gives the RCU grace-period kthread an extra wakeup
      if it doesn't make progress for a period of three times the setting of
      the rcutree.jiffies_till_first_fqs boot parameter.  This is of course
      problematic when the value of this parameter is zero, as it can result
      in unnecessary wakeup IPIs along with unnecessary WARN_ONCE() invocations.
      
      This commit therefore defers kthread kicking for at least two jiffies,
      regardless of the setting of rcutree.jiffies_till_first_fqs.
      Signed-off-by: NPaul E. McKenney <paulmck@linux.ibm.com>
      9cf422a8
  2. 21 1月, 2019 3 次提交
    • P
      tools/memory-model: Make scripts take "-j" abbreviation for "--jobs" · 910cc959
      Paul E. McKenney 提交于
      The "--jobs" argument to the litmus-test scripts is similar to the "-jN"
      argument to "make", so this commit allows the "-jN" form as well.  While
      in the area, it also prohibits the various forms of "-j0".
      Suggested-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: akiyks@gmail.com
      Cc: boqun.feng@gmail.com
      Cc: dhowells@redhat.com
      Cc: j.alglave@ucl.ac.uk
      Cc: linux-arch@vger.kernel.org
      Cc: luc.maranget@inria.fr
      Cc: npiggin@gmail.com
      Cc: parri.andrea@gmail.com
      Cc: will.deacon@arm.com
      Link: http://lkml.kernel.org/r/20181203230451.28921-3-paulmck@linux.ibm.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
      910cc959
    • P
      tools/memory-model: Add scripts to check github litmus tests · b02eb5b0
      Paul E. McKenney 提交于
      The https://github.com/paulmckrcu/litmus repository contains a large
      number of C-language litmus tests that include "Result:" comments
      predicting the verification result.  This commit adds a number of scripts
      that run tests on these litmus tests:
      
      checkghlitmus.sh:
      	Runs all litmus tests in the https://github.com/paulmckrcu/litmus
              archive that are C-language and that have "Result:" comment lines
      	documenting expected results, comparing the actual results to
      	those expected.  Clones the repository if it has not already
      	been cloned into the "tools/memory-model/litmus" directory.
      
      initlitmushist.sh
      	Run all litmus tests having no more than the specified number
      	of processes given a specified timeout, recording the results in
      	.litmus.out files.  Clones the repository if it has not already
      	been cloned into the "tools/memory-model/litmus" directory.
      
      newlitmushist.sh
      	For all new or updated litmus tests having no more than the
      	specified number of processes given a specified timeout, run
      	and record the results in .litmus.out files.
      
      checklitmushist.sh
      	Run all litmus tests having .litmus.out files from previous
      	initlitmushist.sh or newlitmushist.sh runs, comparing the
      	herd output to that of the original runs.
      
      The above scripts will run litmus tests concurrently, by default with
      one job per available CPU.  Giving any of these scripts the --help
      argument will cause them to print usage information.
      
      This commit also adds a number of helper scripts that are not intended
      to be invoked from the command line:
      
      cmplitmushist.sh: Compare the output of two different runs of the same
      	litmus test.
      
      judgelitmus.sh: Compare the output of a litmus test to its "Result:"
      	comment line.
      
      parseargs.sh: Parse command-line arguments.
      
      runlitmushist.sh: Run the litmus tests whose pathnames are provided one
      	per line on standard input.
      
      While in the area, this commit also makes the existing checklitmus.sh
      and checkalllitmus.sh scripts use parseargs.sh in order to provide a
      bit of uniformity.  In addition, per-litmus-test status output is directed
      to stdout, while end-of-test summary information is directed to stderr.
      Finally, the error flag standardizes on "!!!" to assist those familiar
      with rcutorture output.
      
      The defaults for the parseargs.sh arguments may be overridden by using
      environment variables: LKMM_DESTDIR for --destdir, LKMM_HERD_OPTIONS
      for --herdoptions, LKMM_JOBS for --jobs, LKMM_PROCS for --procs, and
      LKMM_TIMEOUT for --timeout.
      
      [ paulmck: History-check summary-line changes per Alan Stern feedback. ]
      Signed-off-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: akiyks@gmail.com
      Cc: boqun.feng@gmail.com
      Cc: dhowells@redhat.com
      Cc: j.alglave@ucl.ac.uk
      Cc: linux-arch@vger.kernel.org
      Cc: luc.maranget@inria.fr
      Cc: npiggin@gmail.com
      Cc: parri.andrea@gmail.com
      Cc: stern@rowland.harvard.edu
      Cc: will.deacon@arm.com
      Link: http://lkml.kernel.org/r/20181203230451.28921-2-paulmck@linux.ibm.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
      b02eb5b0
    • A
      tools/memory-model: Model smp_mb__after_unlock_lock() · 5b735eb1
      Andrea Parri 提交于
      The kernel documents smp_mb__after_unlock_lock() the following way:
      
        "Place this after a lock-acquisition primitive to guarantee that
         an UNLOCK+LOCK pair acts as a full barrier.  This guarantee applies
         if the UNLOCK and LOCK are executed by the same CPU or if the
         UNLOCK and LOCK operate on the same lock variable."
      
      Formalize in LKMM the above guarantee by defining (new) mb-links according
      to the law:
      
        ([M] ; po ; [UL] ; (co | po) ; [LKW] ;
      	fencerel(After-unlock-lock) ; [M])
      
      where the component ([UL] ; co ; [LKW]) identifies "UNLOCK+LOCK pairs on
      the same lock variable" and the component ([UL] ; po ; [LKW]) identifies
      "UNLOCK+LOCK pairs executed by the same CPU".
      
      In particular, the LKMM forbids the following two behaviors (the second
      litmus test below is based on:
      
        Documentation/RCU/Design/Memory-Ordering/Tree-RCU-Memory-Ordering.html
      
      c.f., Section "Tree RCU Grace Period Memory Ordering Building Blocks"):
      
      C after-unlock-lock-same-cpu
      
      (*
       * Result: Never
       *)
      
      {}
      
      P0(spinlock_t *s, spinlock_t *t, int *x, int *y)
      {
      	int r0;
      
      	spin_lock(s);
      	WRITE_ONCE(*x, 1);
      	spin_unlock(s);
      	spin_lock(t);
      	smp_mb__after_unlock_lock();
      	r0 = READ_ONCE(*y);
      	spin_unlock(t);
      }
      
      P1(int *x, int *y)
      {
      	int r0;
      
      	WRITE_ONCE(*y, 1);
      	smp_mb();
      	r0 = READ_ONCE(*x);
      }
      
      exists (0:r0=0 /\ 1:r0=0)
      
      C after-unlock-lock-same-lock-variable
      
      (*
       * Result: Never
       *)
      
      {}
      
      P0(spinlock_t *s, int *x, int *y)
      {
      	int r0;
      
      	spin_lock(s);
      	WRITE_ONCE(*x, 1);
      	r0 = READ_ONCE(*y);
      	spin_unlock(s);
      }
      
      P1(spinlock_t *s, int *y, int *z)
      {
      	int r0;
      
      	spin_lock(s);
      	smp_mb__after_unlock_lock();
      	WRITE_ONCE(*y, 1);
      	r0 = READ_ONCE(*z);
      	spin_unlock(s);
      }
      
      P2(int *z, int *x)
      {
      	int r0;
      
      	WRITE_ONCE(*z, 1);
      	smp_mb();
      	r0 = READ_ONCE(*x);
      }
      
      exists (0:r0=0 /\ 1:r0=0 /\ 2:r0=0)
      Signed-off-by: NAndrea Parri <andrea.parri@amarulasolutions.com>
      Signed-off-by: NPaul E. McKenney <paulmck@linux.ibm.com>
      Cc: Akira Yokosawa <akiyks@gmail.com>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Boqun Feng <boqun.feng@gmail.com>
      Cc: Daniel Lustig <dlustig@nvidia.com>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Jade Alglave <j.alglave@ucl.ac.uk>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Luc Maranget <luc.maranget@inria.fr>
      Cc: Nicholas Piggin <npiggin@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: linux-arch@vger.kernel.org
      Cc: parri.andrea@gmail.com
      Link: http://lkml.kernel.org/r/20181203230451.28921-1-paulmck@linux.ibm.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
      5b735eb1
  3. 18 1月, 2019 13 次提交
  4. 17 1月, 2019 14 次提交