Re: [bug report] rcu/nocb: Add bypass callback queueing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Aug 14, 2019 at 01:38:39PM +0300, Dan Carpenter wrote:
> Hello Paul E. McKenney,
> 
> The patch 1afc4b18724f: "rcu/nocb: Add bypass callback queueing" from
> Jul 2, 2019, leads to the following static checker warning:
> 
> 	kernel/rcu/tree_plugin.h:1792 rcu_nocb_try_bypass()
> 	warn: unsigned 'c' is never less than zero.

Good catch, but Coverity and Colin Ian King beat you to it.  The alleged
fixed commit may be found on -rcu at d1b222c6be1f ("rcu/nocb: Add bypass
callback queueing").

							Thanx, Paul

> kernel/rcu/tree_plugin.h
>   1761  static bool rcu_nocb_try_bypass(struct rcu_data *rdp, struct rcu_head *rhp,
>   1762                                  bool *was_alldone, unsigned long flags)
>   1763  {
>   1764          unsigned long c;
>                 ^^^^^^^^^^^^^^^
>   1765          unsigned long cur_gp_seq;
>   1766          unsigned long j = jiffies;
>   1767          long ncbs = rcu_cblist_n_cbs(&rdp->nocb_bypass);
>   1768  
>   1769          if (!rcu_segcblist_is_offloaded(&rdp->cblist)) {
>   1770                  *was_alldone = !rcu_segcblist_pend_cbs(&rdp->cblist);
>   1771                  return false; /* Not offloaded, no bypassing. */
>   1772          }
>   1773          lockdep_assert_irqs_disabled();
>   1774  
>   1775          // Don't use ->nocb_bypass during early boot.
>   1776          if (rcu_scheduler_active != RCU_SCHEDULER_RUNNING) {
>   1777                  rcu_nocb_lock(rdp);
>   1778                  WARN_ON_ONCE(rcu_cblist_n_cbs(&rdp->nocb_bypass));
>   1779                  *was_alldone = !rcu_segcblist_pend_cbs(&rdp->cblist);
>   1780                  return false;
>   1781          }
>   1782  
>   1783          // If we have advanced to a new jiffy, reset counts to allow
>   1784          // moving back from ->nocb_bypass to ->cblist.
>   1785          if (j == rdp->nocb_nobypass_last) {
>   1786                  c = rdp->nocb_nobypass_count + 1;
>   1787          } else {
>   1788                  WRITE_ONCE(rdp->nocb_nobypass_last, j);
>   1789                  c = rdp->nocb_nobypass_count - nocb_nobypass_lim_per_jiffy;
>   1790                  if (c > nocb_nobypass_lim_per_jiffy)
>   1791                          c = nocb_nobypass_lim_per_jiffy;
>   1792                  else if (c < 0)
>                                  ^^^^^
> Impossible!
> 
>   1793                          c = 0;
>   1794          }
> 
> regards,
> dan carpenter
> 



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux