1. 25 Jan, 2019 11 commits
    • Zhang, Jun's avatar
      rcu: Do RCU GP kthread self-wakeup from softirq and interrupt · 1d1f898d
      Zhang, Jun authored
      The rcu_gp_kthread_wake() function is invoked when it might be necessary
      to wake the RCU grace-period kthread.  Because self-wakeups are normally
      a useless waste of CPU cycles, if rcu_gp_kthread_wake() is invoked from
      this kthread, it naturally refuses to do the wakeup.
      
      Unfortunately, natural though it might be, this heuristic fails when
      rcu_gp_kthread_wake() is invoked from an interrupt or softirq handler
      that interrupted the grace-period kthread just after the final check of
      the wait-event condition but just before the schedule() call.  In this
      case, a wakeup is required, even though the call to rcu_gp_kthread_wake()
      is within the RCU grace-period kthread's context.  Failing to provide
      this wakeup can result in grace periods failing to start, which in turn
      results in out-of-memory conditions.
      
      This race window is quite narrow, but it actually did happen during real
      testing.  It would of course need to be fixed even if it was strictly
      theoretical in nature.
      
      This patch does not Cc stable because it does not apply cleanly to
      earlier kernel versions.
      
      Fixes: 48a7639c ("rcu: Make callers awaken grace-period kthread")
      Reported-by: default avatar"He, Bo" <bo.he@intel.com>
      Co-developed-by: default avatar"Zhang, Jun" <jun.zhang@intel.com>
      Co-developed-by: default avatar"He, Bo" <bo.he@intel.com>
      Co-developed-by: default avatar"xiao, jin" <jin.xiao@intel.com>
      Co-developed-by: default avatarBai, Jie A <jie.a.bai@intel.com>
      Signed-off: "Zhang, Jun" <jun.zhang@intel.com>
      Signed-off: "He, Bo" <bo.he@intel.com>
      Signed-off: "xiao, jin" <jin.xiao@intel.com>
      Signed-off: Bai, Jie A <jie.a.bai@intel.com>
      Signed-off-by: default avatar"Zhang, Jun" <jun.zhang@intel.com>
      [ paulmck: Switch from !in_softirq() to "!in_interrupt() &&
        !in_serving_softirq() to avoid redundant wakeups and to also handle the
        interrupt-handler scenario as well as the softirq-handler scenario that
        actually occurred in testing. ]
      Signed-off-by: default avatarPaul E. McKenney <paulmck@linux.ibm.com>
      Link: https://lkml.kernel.org/r/CD6925E8781EFD4D8E11882D20FC406D52A11F61@SHSMSX104.ccr.corp.intel.com
      1d1f898d
    • Paul E. McKenney's avatar
      rcu: Add sysrq rcu_node-dump capability · 2ccaff10
      Paul E. McKenney authored
      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: default avatarPaul E. McKenney <paulmck@linux.ibm.com>
      2ccaff10
    • Paul E. McKenney's avatar
      rcu: Protect rcu_check_gp_kthread_starvation() access to ->gp_flags · 3b6505fd
      Paul E. McKenney authored
      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: default avatarPaul E. McKenney <paulmck@linux.ibm.com>
      3b6505fd
    • Paul E. McKenney's avatar
      rcu: Improve diagnostics for failed RCU grace-period start · fd897573
      Paul E. McKenney authored
      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: default avatarPaul E. McKenney <paulmck@linux.ibm.com>
      fd897573
    • Paul E. McKenney's avatar
      rcu: Update NOCB comments · a9fefdb2
      Paul E. McKenney authored
      This commit updates a few obsolete comments in the RCU callback-offload
      code.
      Signed-off-by: default avatarPaul E. McKenney <paulmck@linux.ibm.com>
      a9fefdb2
    • Paul E. McKenney's avatar
      rcu: Remove unused rcu_cpu_kthread_cpu per-CPU variable · b2c1955b
      Paul E. McKenney authored
      The rcu_cpu_kthread_cpu used to provide debugfs information, but is no
      longer used.  This commit therefore removes it.
      Signed-off-by: default avatarPaul E. McKenney <paulmck@linux.ibm.com>
      b2c1955b
    • Paul E. McKenney's avatar
      rcu: Move rcu_cpu_has_work to rcu_data structure · f7e972ee
      Paul E. McKenney authored
      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: default avatarPaul E. McKenney <paulmck@linux.ibm.com>
      f7e972ee
    • Paul E. McKenney's avatar
      rcu: Remove unused rcu_cpu_kthread_loops per-CPU variable · 8b4d0f48
      Paul E. McKenney authored
      The rcu_cpu_kthread_loops variable used to provide debugfs information,
      but is no longer used.  This commit therefore removes it.
      Signed-off-by: default avatarPaul E. McKenney <paulmck@linux.ibm.com>
      8b4d0f48
    • Paul E. McKenney's avatar
      rcu: Move rcu_cpu_kthread_status to rcu_data structure · 6ffdde28
      Paul E. McKenney authored
      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: default avatarPaul E. McKenney <paulmck@linux.ibm.com>
      6ffdde28
    • Paul E. McKenney's avatar
      rcu: Move rcu_cpu_kthread_task to rcu_data structure · 37f62d7c
      Paul E. McKenney authored
      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: default avatarPaul E. McKenney <paulmck@linux.ibm.com>
      37f62d7c
    • Paul E. McKenney's avatar
      rcu: Accommodate zero jiffies_till_first_fqs and kthread kicking · 9cf422a8
      Paul E. McKenney authored
      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: default avatarPaul E. McKenney <paulmck@linux.ibm.com>
      9cf422a8
  2. 21 Jan, 2019 3 commits
    • Paul E. McKenney's avatar
      tools/memory-model: Make scripts take "-j" abbreviation for "--jobs" · 910cc959
      Paul E. McKenney authored
      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: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarPaul 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: default avatarIngo Molnar <mingo@kernel.org>
      910cc959
    • Paul E. McKenney's avatar
      tools/memory-model: Add scripts to check github litmus tests · b02eb5b0
      Paul E. McKenney authored
      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: default avatarPaul 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: default avatarIngo Molnar <mingo@kernel.org>
      b02eb5b0
    • Andrea Parri's avatar
      tools/memory-model: Model smp_mb__after_unlock_lock() · 5b735eb1
      Andrea Parri authored
      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: default avatarAndrea Parri <andrea.parri@amarulasolutions.com>
      Signed-off-by: default avatarPaul 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: default avatarIngo Molnar <mingo@kernel.org>
      5b735eb1
  3. 18 Jan, 2019 4 commits
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma · d7393226
      Linus Torvalds authored
      Pull rdma fixes frfom Jason Gunthorpe:
       "Not much so far. We have the usual batch of bugs and two fixes to code
        merged this cycle:
      
         - Restore valgrind support for the ioctl verbs interface merged this
           window, and fix a missed error code on an error path from that
           conversion
      
         - A user reported crash on obsolete mthca hardware
      
         - pvrdma was using the wrong command opcode toward the hypervisor
      
         - NULL pointer crash regression when dumping rdma-cm over netlink
      
         - Be conservative about exposing the global rkey"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rdma/rdma:
        RDMA/uverbs: Mark ioctl responses with UVERBS_ATTR_F_VALID_OUTPUT
        RDMA/mthca: Clear QP objects during their allocation
        RDMA/vmw_pvrdma: Return the correct opcode when creating WR
        RDMA/cma: Add cm_id restrack resource based on kernel or user cm_id type
        RDMA/nldev: Don't expose unsafe global rkey to regular user
        RDMA/uverbs: Fix post send success return value in case of error
      d7393226
    • Linus Torvalds's avatar
      Merge tag 'drm-fixes-2019-01-18' of git://anongit.freedesktop.org/drm/drm · 1092a94f
      Linus Torvalds authored
      Pull drm fixes from Dave Airlie:
       "The rc3 fixes are a bit scattered:
      
         - meson, sun4i and rockchip all had missing of_node_put.
      
         - qxl and virtio both were advertising dma-buf to userspace when they
           really shouldn't have.
      
        Otherwise:
      
        meson:
         - modesetting regression fix
      
        i915 GVT:
         - one cmd parser failure fix
         - region cleanup fix in vGPU destroy
      
        amdgpu:
         - KFD fixes for arm64 mixed APU/DGPU
         - vega12 powerplay fix
         - raven DC fixes
         - freesync fix"
      
      * tag 'drm-fixes-2019-01-18' of git://anongit.freedesktop.org/drm/drm:
        drm/amd/display: Detach backlight from stream
        drm/sun4i: backend: add missing of_node_puts
        Revert "drm/amdgpu: validate user pitch alignment"
        Revert "drm/amdgpu: validate user GEM object size"
        drm/meson: Fix atomic mode switching regression
        drm/i915/gvt: Fix mmap range check
        drm/i915/gvt: free VFIO region space in vgpu detach
        drm/amd/display: Fix disabled cursor on top screen edge
        drm/amd/display: fix warning on raven hotplug
        drm/amd/display: fix PME notification not working in RV desktop
        drm/amd/display: Only get the connector state for VRR when toggled
        drm/amd/display: Pack DMCU iRAM alignment
        drm/amd/powerplay: run acg btc for Vega12
        drm/amdkfd: Don't assign dGPUs to APU topology devices
        drm/amdkfd: Allow building KFD on ARM64 (v2)
        drm/meson: add missing of_node_put
        drm/virtio: drop prime import/export callbacks
        drm/qxl: drop prime import/export callbacks
        drm/i915/gvt: Allow F_CMD_ACCESS on mmio 0x21f0
        drm/rockchip: add missing of_node_put
      1092a94f
    • Linus Torvalds's avatar
      Merge tag 'led-fix-for-5.0-rc3' of... · 2451f371
      Linus Torvalds authored
      Merge tag 'led-fix-for-5.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds
      
      Pull LED fix from Jacek Anaszewski.
      
      * tag 'led-fix-for-5.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/j.anaszewski/linux-leds:
        leds: lp5523: fix a missing check of return value of lp55xx_read
      2451f371
    • Linus Torvalds's avatar
      Merge tag 'hwmon-for-v5.0-rc3' of... · 0a2fbed8
      Linus Torvalds authored
      Merge tag 'hwmon-for-v5.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging
      
      Pull hwmon fixes from Guenter Roeck:
       "Minor fixes/regressions"
      
      * tag 'hwmon-for-v5.0-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging:
        hwmon: (tmp421) Correct the misspelling of the tmp442 compatible attribute in OF device ID table
        hwmon: (occ) Fix potential integer overflow
        hwmon: (lm80) Fix missing unlock on error in set_fan_div()
        hwmon: (nct6775) Enable IO mapping for NCT6797D and NCT6798D
        hwmon: (nct6775) Fix chip ID for NCT6798D
      0a2fbed8
  4. 17 Jan, 2019 18 commits
  5. 16 Jan, 2019 4 commits