From: Amir Vadai <amirv@mellanox•com>
To: Jacob Keller <jacob.e.keller@intel•com>
Cc: <netdev@vger•kernel.org>,
Alex Duyck <alexander.h.duyck@intel•com>,
Hyong-Youb Kim <hykim@myri•com>,
Dmitry Kravkov <dmitry@broadcom•com>,
Eliezer Tamir <eliezer.tamir@linux•intel.com>
Subject: Re: [PATCH net RFC 1/2] netdevice: add might_sleep() call to napi_disable
Date: Tue, 8 Oct 2013 15:39:18 +0300 [thread overview]
Message-ID: <5253FCF6.1040808@mellanox.com> (raw)
In-Reply-To: <20130918201949.8697.50700.stgit@jekeller-desk1.amr.corp.intel.com>
On 18/09/2013 23:20, Jacob Keller wrote:
> napi_disable potentially calls msleep(1) if the NAPI_STATE_SCHED bit is
> previously set by something else. Because it does not always call msleep, it
> was difficult to track down a bug related to calling napi_disable within
> local_bh_disable()d context. This patch adds a might_sleep() call to the
> napi_disable routine in order to aid in the future debugging of similar issues.
> This will cause a BUG in drivers which have implemented busy polling in a
> similar fashion to ixgbe, and which call napi_disable inside the
> local_bh_disable()d section where the vector napi lock is taken.
>
> Signed-off-by: Jacob Keller <jacob.e.keller@intel•com>
> Cc: Eliezer Tamir <eliezer.tamir@linux•intel.com>
> Cc: Alex Duyck <alexander.h.duyck@intel•com>
> Cc: Hyong-Youb Kim <hykim@myri•com>
> Cc: Amir Vadai <amirv@mellanox•com>
> Cc: Dmitry Kravkov <dmitry@broadcom•com>
> ---
> include/linux/netdevice.h | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> index 3de49ac..81dab00 100644
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
> @@ -483,6 +483,8 @@ extern void napi_hash_del(struct napi_struct *napi);
> */
> static inline void napi_disable(struct napi_struct *n)
> {
> + might_sleep();
> +
> set_bit(NAPI_STATE_DISABLE, &n->state);
> while (test_and_set_bit(NAPI_STATE_SCHED, &n->state))
> msleep(1);
>
Works ok with mlx4_en driver.
Acked-By: Amir Vadai <amirv@mellanox•com>
next prev parent reply other threads:[~2013-10-08 12:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-18 20:19 [PATCH net RFC 0/2] net: BUG napi_disable sleep while atomic Jacob Keller
2013-09-18 20:20 ` [PATCH net RFC 1/2] netdevice: add might_sleep() call to napi_disable Jacob Keller
2013-10-08 12:39 ` Amir Vadai [this message]
2013-09-18 20:20 ` [PATCH net RFC 2/2] ixgbe: fix sleep bug caused by napi_disable inside local_bh_disable()d context Jacob Keller
2013-09-18 23:09 ` Francois Romieu
2013-09-18 23:24 ` Keller, Jacob E
2013-09-19 21:32 ` Francois Romieu
2013-09-19 22:28 ` Keller, Jacob E
2013-10-01 12:11 ` Yuval Mintz
2013-10-01 20:05 ` Keller, Jacob E
2013-10-01 20:08 ` Keller, Jacob E
-- strict thread matches above, loose matches on Subject: below --
2013-09-17 0:59 [PATCH net RFC 0/2] Series short description Jacob Keller
2013-09-17 0:59 ` [PATCH net RFC 1/2] netdevice: add might_sleep() call to napi_disable Jacob Keller
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=5253FCF6.1040808@mellanox.com \
--to=amirv@mellanox$(echo .)com \
--cc=alexander.h.duyck@intel$(echo .)com \
--cc=dmitry@broadcom$(echo .)com \
--cc=eliezer.tamir@linux$(echo .)intel.com \
--cc=hykim@myri$(echo .)com \
--cc=jacob.e.keller@intel$(echo .)com \
--cc=netdev@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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