netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Roland Dreier <rdreier@cisco.com>
To: Krishna Kumar <krkumar2@in.ibm.com>
Cc: netdev@vger.kernel.org, general@lists.openfabrics.org,
	davem@davemloft.net
Subject: Re: [PATCH 1/2] IPoIB: Fix unregister_netdev hang
Date: Tue, 18 Sep 2007 07:27:24 -0700	[thread overview]
Message-ID: <adalkb4kq0j.fsf@cisco.com> (raw)
In-Reply-To: <20070918111803.1769.60619.sendpatchset@localhost.localdomain> (Krishna Kumar's message of "Tue, 18 Sep 2007 16:48:03 +0530")

Thanks for testing on ehca...

 > While using IPoIB over EHCA (rc6 bits), unregister_netdev hangs with

I don't think you're actually using rc6 bits, since in your patch you have:

 > -poll_more:

and I think that is only in Dave's net-2.6.24 tree now, right?

 > The problem is that the poll handler does netif_rx_complete (which
 > does a dev_put) followed by netif_rx_reschedule() to schedule for
 > more receives (which again does a dev_put). This reduces refcount to
 > < 0 (depending on how many times netif_rx_complete followed by
 > netif_rx_reschedule was called).

Dave, the real problem seems to be that netif_rx_recschedule() calls
__napi_schedule() rather than __netif_rx_schedule(), so it misses the
call to dev_hold() that is needed to balance the dev_put() in
netif_rx_complete().  The current netif_rx_reschedule() looks like it
really should be napi_reschedule(), and we need a new function that
takes a netdev too.  Or am I misunderstanding the refcounting?

I'll send a patch once I've had some breakfast and had a chance to at
least compile it...

Krishna, unfortunately your proposed fix has a race:

 > -		netif_rx_complete(dev, napi);
 > -		if (unlikely(ib_req_notify_cq(priv->cq,
 > -					      IB_CQ_NEXT_COMP |
 > -					      IB_CQ_REPORT_MISSED_EVENTS)) &&
 > -		    netif_rx_reschedule(napi))
 > -			goto poll_more;
 > +		if (likely(!ib_req_notify_cq(priv->cq,
 > +					     IB_CQ_NEXT_COMP |
 > +					     IB_CQ_REPORT_MISSED_EVENTS)))

It is possible for an interrupt to happen immediately right here,
before the netif_rx_complete(), so that netif_rx_schedule() gets
called while we are still on the poll list.

 > +			netif_rx_complete(dev, napi);

 - R.

  parent reply	other threads:[~2007-09-18 14:27 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-18 11:18 [ofa-general] [PATCH 1/2] IPoIB: Fix unregister_netdev hang Krishna Kumar
2007-09-18 11:18 ` [ofa-general] [PATCH 2/2] IPoIB: Code cleanup Krishna Kumar
2007-09-18 14:27 ` Roland Dreier [this message]
2007-09-19  3:23   ` [PATCH 1/2] IPoIB: Fix unregister_netdev hang Krishna Kumar2
2007-09-19  3:30     ` [ofa-general] " Roland Dreier
2007-09-19  4:24       ` Krishna Kumar2
2007-09-18 17:58 ` [PATCH net-2.6.24] Fix refcounting problem with netif_rx_reschedule() Roland Dreier
2007-09-18 18:04   ` [ofa-general] [PATCH net-2.6.24] Fix documentation for dev_put()/dev_hold() Roland Dreier
2007-09-18 20:16     ` David Miller
2007-09-18 20:15   ` [ofa-general] Re: [PATCH net-2.6.24] Fix refcounting problem with netif_rx_reschedule() David Miller
2007-09-18 22:46     ` Roland Dreier
2007-09-18 22:50       ` David Miller

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=adalkb4kq0j.fsf@cisco.com \
    --to=rdreier@cisco.com \
    --cc=davem@davemloft.net \
    --cc=general@lists.openfabrics.org \
    --cc=krkumar2@in.ibm.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).