netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Flavio Leitner <fbl@redhat.com>
To: netdev <netdev@vger.kernel.org>
Subject: preempting while holding rtnl_lock
Date: Thu, 14 Jul 2011 18:15:02 -0300	[thread overview]
Message-ID: <20110714181502.4a5602aa@asterix.rh> (raw)


Hi,

I was reviewing driver sources and found that
ethtool ops holds rtnl_lock() and there are few
drivers (for example: tg3, bnx2) that use napi_disable()
in this context.

/**     
 *      napi_disable - prevent NAPI from scheduling
 *      @n: napi context
 *              
 * Stop NAPI from being scheduled on this context.
 * Waits till any outstanding processing completes.
 */
static inline void napi_disable(struct napi_struct *n)
{
        set_bit(NAPI_STATE_DISABLE, &n->state);
        while (test_and_set_bit(NAPI_STATE_SCHED, &n->state))
                msleep(1);
        clear_bit(NAPI_STATE_DISABLE, &n->state);
}

The msleep() above will preempt.  I believe this is wrong.
See the functions below as examples:
bnx2_set_ringparam()
+ bnx2_change_ring_size()
  + bnx2_netif_stop()
    + bnx2_napi_disable()
      + napi_disable()


+ tg3_change_mtu() = ndo_change_mtu
  + tg3_netif_stop()
    + tg3_napi_disable()
      + napi_disable()

What am I missing?
thanks,
fbl

             reply	other threads:[~2011-07-14 21:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-14 21:15 Flavio Leitner [this message]
2011-07-14 23:06 ` preempting while holding rtnl_lock Ben Hutchings

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=20110714181502.4a5602aa@asterix.rh \
    --to=fbl@redhat.com \
    --cc=netdev@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).