All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: paulmck@linux.ibm.com
Cc: rcu@vger.kernel.org
Subject: [bug report] rcu/nocb: Add bypass callback queueing
Date: Wed, 14 Aug 2019 13:38:39 +0300	[thread overview]
Message-ID: <20190814103839.GA12599@mwanda> (raw)

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.

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

             reply	other threads:[~2019-08-14 10:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-14 10:38 Dan Carpenter [this message]
2019-08-14 12:29 ` [bug report] rcu/nocb: Add bypass callback queueing Paul E. McKenney

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190814103839.GA12599@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=paulmck@linux.ibm.com \
    --cc=rcu@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.