1. 30 6月, 2020 2 次提交
  2. 22 3月, 2020 1 次提交
    • P
      rcu: Make rcu_barrier() account for offline no-CBs CPUs · 127e2981
      Paul E. McKenney 提交于
      Currently, rcu_barrier() ignores offline CPUs,  However, it is possible
      for an offline no-CBs CPU to have callbacks queued, and rcu_barrier()
      must wait for those callbacks.  This commit therefore makes rcu_barrier()
      directly invoke the rcu_barrier_func() with interrupts disabled for such
      CPUs.  This requires passing the CPU number into this function so that
      it can entrain the rcu_barrier() callback onto the correct CPU's callback
      list, given that the code must instead execute on the current CPU.
      
      While in the area, this commit fixes a bug where the first CPU's callback
      might have been invoked before rcu_segcblist_entrain() returned, which
      would also result in an early wakeup.
      
      Fixes: 5d6742b3 ("rcu/nocb: Use rcu_segcblist for no-CBs CPUs")
      Signed-off-by: NPaul E. McKenney <paulmck@kernel.org>
      [ paulmck: Apply optimization feedback from Boqun Feng. ]
      Cc: <stable@vger.kernel.org> # 5.5.x
      127e2981
  3. 21 2月, 2020 1 次提交
  4. 25 1月, 2020 1 次提交
  5. 10 12月, 2019 2 次提交
    • L
      rcu: Make PREEMPT_RCU be a modifier to TREE_RCU · b3e627d3
      Lai Jiangshan 提交于
      Currently PREEMPT_RCU and TREE_RCU are mutually exclusive Kconfig
      options.  But PREEMPT_RCU actually specifies a kind of TREE_RCU,
      namely a preemptible TREE_RCU. This commit therefore makes PREEMPT_RCU
      be a modifer to the TREE_RCU Kconfig option.  This has the benefit of
      simplifying several of the #if expressions that formerly needed to
      check both, but now need only check one or the other.
      Signed-off-by: NLai Jiangshan <laijs@linux.alibaba.com>
      Signed-off-by: NLai Jiangshan <jiangshanlai@gmail.com>
      Reviewed-by: NJoel Fernandes (Google) <joel@joelfernandes.org>
      Signed-off-by: NPaul E. McKenney <paulmck@kernel.org>
      b3e627d3
    • M
      rcu: Fix data-race due to atomic_t copy-by-value · 6cf539a8
      Marco Elver 提交于
      This fixes a data-race where `atomic_t dynticks` is copied by value. The
      copy is performed non-atomically, resulting in a data-race if `dynticks`
      is updated concurrently.
      
      This data-race was found with KCSAN:
      ==================================================================
      BUG: KCSAN: data-race in dyntick_save_progress_counter / rcu_irq_enter
      
      write to 0xffff989dbdbe98e0 of 4 bytes by task 10 on cpu 3:
       atomic_add_return include/asm-generic/atomic-instrumented.h:78 [inline]
       rcu_dynticks_snap kernel/rcu/tree.c:310 [inline]
       dyntick_save_progress_counter+0x43/0x1b0 kernel/rcu/tree.c:984
       force_qs_rnp+0x183/0x200 kernel/rcu/tree.c:2286
       rcu_gp_fqs kernel/rcu/tree.c:1601 [inline]
       rcu_gp_fqs_loop+0x71/0x880 kernel/rcu/tree.c:1653
       rcu_gp_kthread+0x22c/0x3b0 kernel/rcu/tree.c:1799
       kthread+0x1b5/0x200 kernel/kthread.c:255
       <snip>
      
      read to 0xffff989dbdbe98e0 of 4 bytes by task 154 on cpu 7:
       rcu_nmi_enter_common kernel/rcu/tree.c:828 [inline]
       rcu_irq_enter+0xda/0x240 kernel/rcu/tree.c:870
       irq_enter+0x5/0x50 kernel/softirq.c:347
       <snip>
      
      Reported by Kernel Concurrency Sanitizer on:
      CPU: 7 PID: 154 Comm: kworker/7:1H Not tainted 5.3.0+ #5
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014
      Workqueue: kblockd blk_mq_run_work_fn
      ==================================================================
      Signed-off-by: NMarco Elver <elver@google.com>
      Cc: Paul E. McKenney <paulmck@kernel.org>
      Cc: Josh Triplett <josh@joshtriplett.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Cc: Joel Fernandes <joel@joelfernandes.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: rcu@vger.kernel.org
      Cc: linux-kernel@vger.kernel.org
      Reviewed-by: NJoel Fernandes (Google) <joel@joelfernandes.org>
      Signed-off-by: NPaul E. McKenney <paulmck@kernel.org>
      6cf539a8
  6. 30 10月, 2019 3 次提交
  7. 14 8月, 2019 2 次提交
    • P
      rcu/nocb: Use rcu_segcblist for no-CBs CPUs · 5d6742b3
      Paul E. McKenney 提交于
      Currently the RCU callbacks for no-CBs CPUs are queued on a series of
      ad-hoc linked lists, which means that these callbacks cannot benefit
      from "drive-by" grace periods, thus suffering needless delays prior
      to invocation.  In addition, the no-CBs grace-period kthreads first
      wait for callbacks to appear and later wait for a new grace period,
      which means that callbacks appearing during a grace-period wait can
      be delayed.  These delays increase memory footprint, and could even
      result in an out-of-memory condition.
      
      This commit therefore enqueues RCU callbacks from no-CBs CPUs on the
      rcu_segcblist structure that is already used by non-no-CBs CPUs.  It also
      restructures the no-CBs grace-period kthread to be checking for incoming
      callbacks while waiting for grace periods.  Also, instead of waiting
      for a new grace period, it waits for the closest grace period that will
      cause some of the callbacks to be safe to invoke.  All of these changes
      reduce callback latency and thus the number of outstanding callbacks,
      in turn reducing the probability of an out-of-memory condition.
      Signed-off-by: NPaul E. McKenney <paulmck@linux.ibm.com>
      5d6742b3
    • P
      rcu/nocb: Rename and document no-CB CB kthread sleep trace event · f7c9a9b6
      Paul E. McKenney 提交于
      The nocb_cb_wait() function traces a "FollowerSleep" trace_rcu_nocb_wake()
      event, which never was documented and is now misleading.  This commit
      therefore changes "FollowerSleep" to "CBSleep", documents this, and
      updates the documentation for "Sleep" as well.
      Signed-off-by: NPaul E. McKenney <paulmck@linux.ibm.com>
      f7c9a9b6
  8. 09 4月, 2019 1 次提交
    • S
      treewide: Switch printk users from %pf and %pF to %ps and %pS, respectively · d75f773c
      Sakari Ailus 提交于
      %pF and %pf are functionally equivalent to %pS and %ps conversion
      specifiers. The former are deprecated, therefore switch the current users
      to use the preferred variant.
      
      The changes have been produced by the following command:
      
      	git grep -l '%p[fF]' | grep -v '^\(tools\|Documentation\)/' | \
      	while read i; do perl -i -pe 's/%pf/%ps/g; s/%pF/%pS/g;' $i; done
      
      And verifying the result.
      
      Link: http://lkml.kernel.org/r/20190325193229.23390-1-sakari.ailus@linux.intel.com
      Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: sparclinux@vger.kernel.org
      Cc: linux-um@lists.infradead.org
      Cc: xen-devel@lists.xenproject.org
      Cc: linux-acpi@vger.kernel.org
      Cc: linux-pm@vger.kernel.org
      Cc: drbd-dev@lists.linbit.com
      Cc: linux-block@vger.kernel.org
      Cc: linux-mmc@vger.kernel.org
      Cc: linux-nvdimm@lists.01.org
      Cc: linux-pci@vger.kernel.org
      Cc: linux-scsi@vger.kernel.org
      Cc: linux-btrfs@vger.kernel.org
      Cc: linux-f2fs-devel@lists.sourceforge.net
      Cc: linux-mm@kvack.org
      Cc: ceph-devel@vger.kernel.org
      Cc: netdev@vger.kernel.org
      Signed-off-by: NSakari Ailus <sakari.ailus@linux.intel.com>
      Acked-by: David Sterba <dsterba@suse.com> (for btrfs)
      Acked-by: Mike Rapoport <rppt@linux.ibm.com> (for mm/memblock.c)
      Acked-by: Bjorn Helgaas <bhelgaas@google.com> (for drivers/pci)
      Acked-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: NPetr Mladek <pmladek@suse.com>
      d75f773c
  9. 08 4月, 2019 1 次提交
  10. 31 8月, 2018 2 次提交
    • P
      rcu: Eliminate ->rcu_qs_ctr from the rcu_dynticks structure · 7e28c5af
      Paul E. McKenney 提交于
      The ->rcu_qs_ctr counter was intended to allow providing a lightweight
      report of a quiescent state to all RCU flavors.  But now that there is
      only one flavor of RCU in any one running kernel, there is no point in
      having this feature.  This commit therefore removes the ->rcu_qs_ctr
      field from the rcu_dynticks structure and the ->rcu_qs_ctr_snap field
      from the rcu_data structure.  This results in the "rqc" option to the
      rcu_fqs trace event no longer being used, so this commit also removes the
      "rqc" description from the header comment.
      
      While in the neighborhood, this commit also causes the forward-progress
      request .rcu_need_heavy_qs be set one jiffies_till_sched_qs interval
      later in the grace period than the first setting of .rcu_urgent_qs.
      Signed-off-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      7e28c5af
    • P
      rcu: Inline _rcu_barrier() into its sole remaining caller · dd46a788
      Paul E. McKenney 提交于
      Because rcu_barrier() is a one-line wrapper function for _rcu_barrier()
      and because nothing else calls _rcu_barrier(), this commit inlines
      _rcu_barrier() into rcu_barrier().
      Signed-off-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      dd46a788
  11. 13 7月, 2018 10 次提交
  12. 16 5月, 2018 1 次提交
  13. 21 2月, 2018 2 次提交
  14. 12 12月, 2017 1 次提交
  15. 29 11月, 2017 5 次提交
  16. 02 11月, 2017 1 次提交
    • G
      License cleanup: add SPDX GPL-2.0 license identifier to files with no license · b2441318
      Greg Kroah-Hartman 提交于
      Many source files in the tree are missing licensing information, which
      makes it harder for compliance tools to determine the correct license.
      
      By default all files without license information are under the default
      license of the kernel, which is GPL version 2.
      
      Update the files which contain no license information with the 'GPL-2.0'
      SPDX license identifier.  The SPDX identifier is a legally binding
      shorthand, which can be used instead of the full boiler plate text.
      
      This patch is based on work done by Thomas Gleixner and Kate Stewart and
      Philippe Ombredanne.
      
      How this work was done:
      
      Patches were generated and checked against linux-4.14-rc6 for a subset of
      the use cases:
       - file had no licensing information it it.
       - file was a */uapi/* one with no licensing information in it,
       - file was a */uapi/* one with existing licensing information,
      
      Further patches will be generated in subsequent months to fix up cases
      where non-standard license headers were used, and references to license
      had to be inferred by heuristics based on keywords.
      
      The analysis to determine which SPDX License Identifier to be applied to
      a file was done in a spreadsheet of side by side results from of the
      output of two independent scanners (ScanCode & Windriver) producing SPDX
      tag:value files created by Philippe Ombredanne.  Philippe prepared the
      base worksheet, and did an initial spot review of a few 1000 files.
      
      The 4.13 kernel was the starting point of the analysis with 60,537 files
      assessed.  Kate Stewart did a file by file comparison of the scanner
      results in the spreadsheet to determine which SPDX license identifier(s)
      to be applied to the file. She confirmed any determination that was not
      immediately clear with lawyers working with the Linux Foundation.
      
      Criteria used to select files for SPDX license identifier tagging was:
       - Files considered eligible had to be source code files.
       - Make and config files were included as candidates if they contained >5
         lines of source
       - File already had some variant of a license header in it (even if <5
         lines).
      
      All documentation files were explicitly excluded.
      
      The following heuristics were used to determine which SPDX license
      identifiers to apply.
      
       - when both scanners couldn't find any license traces, file was
         considered to have no license information in it, and the top level
         COPYING file license applied.
      
         For non */uapi/* files that summary was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0                                              11139
      
         and resulted in the first patch in this series.
      
         If that file was a */uapi/* path one, it was "GPL-2.0 WITH
         Linux-syscall-note" otherwise it was "GPL-2.0".  Results of that was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0 WITH Linux-syscall-note                        930
      
         and resulted in the second patch in this series.
      
       - if a file had some form of licensing information in it, and was one
         of the */uapi/* ones, it was denoted with the Linux-syscall-note if
         any GPL family license was found in the file or had no licensing in
         it (per prior point).  Results summary:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|------
         GPL-2.0 WITH Linux-syscall-note                       270
         GPL-2.0+ WITH Linux-syscall-note                      169
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)    21
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)    17
         LGPL-2.1+ WITH Linux-syscall-note                      15
         GPL-1.0+ WITH Linux-syscall-note                       14
         ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause)    5
         LGPL-2.0+ WITH Linux-syscall-note                       4
         LGPL-2.1 WITH Linux-syscall-note                        3
         ((GPL-2.0 WITH Linux-syscall-note) OR MIT)              3
         ((GPL-2.0 WITH Linux-syscall-note) AND MIT)             1
      
         and that resulted in the third patch in this series.
      
       - when the two scanners agreed on the detected license(s), that became
         the concluded license(s).
      
       - when there was disagreement between the two scanners (one detected a
         license but the other didn't, or they both detected different
         licenses) a manual inspection of the file occurred.
      
       - In most cases a manual inspection of the information in the file
         resulted in a clear resolution of the license that should apply (and
         which scanner probably needed to revisit its heuristics).
      
       - When it was not immediately clear, the license identifier was
         confirmed with lawyers working with the Linux Foundation.
      
       - If there was any question as to the appropriate license identifier,
         the file was flagged for further research and to be revisited later
         in time.
      
      In total, over 70 hours of logged manual review was done on the
      spreadsheet to determine the SPDX license identifiers to apply to the
      source files by Kate, Philippe, Thomas and, in some cases, confirmation
      by lawyers working with the Linux Foundation.
      
      Kate also obtained a third independent scan of the 4.13 code base from
      FOSSology, and compared selected files where the other two scanners
      disagreed against that SPDX file, to see if there was new insights.  The
      Windriver scanner is based on an older version of FOSSology in part, so
      they are related.
      
      Thomas did random spot checks in about 500 files from the spreadsheets
      for the uapi headers and agreed with SPDX license identifier in the
      files he inspected. For the non-uapi files Thomas did random spot checks
      in about 15000 files.
      
      In initial set of patches against 4.14-rc6, 3 files were found to have
      copy/paste license identifier errors, and have been fixed to reflect the
      correct identifier.
      
      Additionally Philippe spent 10 hours this week doing a detailed manual
      inspection and review of the 12,461 patched files from the initial patch
      version early this week with:
       - a full scancode scan run, collecting the matched texts, detected
         license ids and scores
       - reviewing anything where there was a license detected (about 500+
         files) to ensure that the applied SPDX license was correct
       - reviewing anything where there was no detection but the patch license
         was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
         SPDX license was correct
      
      This produced a worksheet with 20 files needing minor correction.  This
      worksheet was then exported into 3 different .csv files for the
      different types of files to be modified.
      
      These .csv files were then reviewed by Greg.  Thomas wrote a script to
      parse the csv files and add the proper SPDX tag to the file, in the
      format that the file expected.  This script was further refined by Greg
      based on the output to detect more types of files automatically and to
      distinguish between header and source .c files (which need different
      comment types.)  Finally Greg ran the script using the .csv files to
      generate the patches.
      Reviewed-by: NKate Stewart <kstewart@linuxfoundation.org>
      Reviewed-by: NPhilippe Ombredanne <pombredanne@nexb.com>
      Reviewed-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b2441318
  17. 25 7月, 2017 1 次提交
    • P
      rcutorture: Place event-traced strings into trace buffer · b3c98314
      Paul E. McKenney 提交于
      Strings used in event tracing need to be specially handled, for example,
      being copied to the trace buffer instead of being pointed to by the trace
      buffer.  Although the TPS() macro can be used to "launder" pointed-to
      strings, this might not be all that effective within a loadable module.
      This commit therefore copies rcutorture's strings to the trace buffer.
      Signed-off-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      b3c98314
  18. 08 6月, 2017 1 次提交
    • P
      rcu: Prevent rcu_barrier() from starting needless grace periods · f92c734f
      Paul E. McKenney 提交于
      Currently rcu_barrier() uses call_rcu() to enqueue new callbacks
      on each CPU with a non-empty callback list.  This works, but means
      that rcu_barrier() forces grace periods that are not otherwise needed.
      The key point is that rcu_barrier() never needs to wait for a grace
      period, but instead only for all pre-existing callbacks to be invoked.
      This means that rcu_barrier()'s new callbacks should be placed in
      the callback-list segment containing the last pre-existing callback.
      
      This commit makes this change using the new rcu_segcblist_entrain()
      function.
      Signed-off-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      f92c734f
  19. 24 1月, 2017 1 次提交
    • P
      rcu: Check cond_resched_rcu_qs() state less often to reduce GP overhead · 3a19b46a
      Paul E. McKenney 提交于
      Commit 4a81e832 ("rcu: Reduce overhead of cond_resched() checks
      for RCU") moved quiescent-state generation out of cond_resched()
      and commit bde6c3aa ("rcu: Provide cond_resched_rcu_qs() to force
      quiescent states in long loops") introduced cond_resched_rcu_qs(), and
      commit 5cd37193 ("rcu: Make cond_resched_rcu_qs() apply to normal RCU
      flavors") introduced the per-CPU rcu_qs_ctr variable, which is frequently
      polled by the RCU core state machine.
      
      This frequent polling can increase grace-period rate, which in turn
      increases grace-period overhead, which is visible in some benchmarks
      (for example, the "open1" benchmark in Anton Blanchard's "will it scale"
      suite).  This commit therefore reduces the rate at which rcu_qs_ctr
      is polled by moving that polling into the force-quiescent-state (FQS)
      machinery, and by further polling it only after the grace period has
      been in effect for at least jiffies_till_sched_qs jiffies.
      Signed-off-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      Reviewed-by: NJosh Triplett <josh@joshtriplett.org>
      3a19b46a
  20. 15 11月, 2016 1 次提交
    • P
      torture: Trace long read-side delays · d0af39e8
      Paul E. McKenney 提交于
      Although rcutorture will occasionally do a 50-millisecond grace-period
      delay, these delays are quite rare.  And rightly so, because otherwise
      the read rate would be quite low.  Thie means that it can be important
      to identify whether or not a given run contained a long-delay read.
      This commit therefore inserts a trace_rcu_torture_read() event to flag
      runs containing long delays.
      Signed-off-by: NPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      d0af39e8