netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Cong Wang <amwang@redhat.com>
To: nhorman@tuxdriver.com
Cc: netdev@vger.kernel.org, bonding-devel@lists.sourceforge.net,
	fubar@us.ibm.com, davem@davemloft.net, andy@greyhouse.net
Subject: Re: [PATCH 2/5] Fix deadlock in bonding driver resulting from internal locking when using netpoll
Date: Wed, 13 Oct 2010 10:44:55 +0800	[thread overview]
Message-ID: <4CB51D27.8030703@redhat.com> (raw)
In-Reply-To: <1286920552-2173-3-git-send-email-nhorman@tuxdriver.com>

On 10/13/10 05:55, nhorman@tuxdriver.com wrote:
> --- a/drivers/net/bonding/bond_main.c
> +++ b/drivers/net/bonding/bond_main.c
> @@ -76,6 +76,7 @@
>   #include<linux/if_vlan.h>
>   #include<linux/if_bonding.h>
>   #include<linux/jiffies.h>
> +#include<linux/preempt.h>
>   #include<net/route.h>
>   #include<net/net_namespace.h>
>   #include<net/netns/generic.h>
> @@ -169,6 +170,35 @@ MODULE_PARM_DESC(resend_igmp, "Number of IGMP membership reports to send on link
>
>   /*----------------------------- Global variables ----------------------------*/
>
> +#ifdef CONFIG_NET_POLL_CONTROLLER
> +static cpumask_var_t netpoll_block_tx;
> +
> +static inline void block_netpoll_tx(void
> +{
> +	preempt_disable();
> +	BUG_ON(cpumask_test_and_set_cpu(smp_processor_id(),
> +					netpoll_block_tx));
> +}
> +
> +static inline void unblock_netpoll_tx(void)
> +{
> +	BUG_ON(!cpumask_test_and_clear_cpu(smp_processor_id(),
> +					  netpoll_block_tx));
> +	preempt_enable();
> +}
> +
> +static inline int is_netpoll_tx_blocked(struct net_device *dev)
> +{
> +	if (unlikely(dev->priv_flags&  IFF_IN_NETPOLL))
> +		return cpumask_test_cpu(smp_processor_id(), netpoll_block_tx);
> +	return 0;
> +}
> +#else
> +#define block_netpoll_tx()
> +#define unblock_netpoll_tx()
> +#define is_netpoll_tx_blocked(dev)
> +#endif
> +

These should go to netpoll.h, IMHO.

  reply	other threads:[~2010-10-13  2:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-12 21:55 [PATCH] bonding: various fixes for bonding, netpoll & netconsole nhorman
2010-10-12 21:55 ` [PATCH 1/5] Fix bonding drivers improper modification of netpoll structure nhorman
2010-10-12 21:55 ` [PATCH 2/5] Fix deadlock in bonding driver resulting from internal locking when using netpoll nhorman
2010-10-13  2:44   ` Cong Wang [this message]
2010-10-13 10:51     ` Neil Horman
2010-10-12 21:55 ` [PATCH 3/5] Fix napi poll for bonding driver nhorman
2010-10-12 21:55 ` [PATCH 4/5] Fix netconsole to not deadlock on rmmod nhorman
2010-10-12 21:55 ` [PATCH 5/5] Re-enable netpoll over bonding nhorman
  -- strict thread matches above, loose matches on Subject: below --
2010-10-14  2:01 [PATCH] bonding: various fixes for bonding, netpoll & netconsole (v3) nhorman
2010-10-14  2:01 ` [PATCH 2/5] Fix deadlock in bonding driver resulting from internal locking when using netpoll nhorman
2010-10-13 12:35 [PATCH] bonding: various fixes for bonding, netpoll & netconsole (v2) nhorman
2010-10-13 12:35 ` [PATCH 2/5] Fix deadlock in bonding driver resulting from internal locking when using netpoll nhorman
2010-10-12 20:29 [PATCH] bonding: various fixes for bonding, netpoll & netconsole nhorman
2010-10-12 20:29 ` [PATCH 2/5] Fix deadlock in bonding driver resulting from internal locking when using netpoll nhorman

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=4CB51D27.8030703@redhat.com \
    --to=amwang@redhat.com \
    --cc=andy@greyhouse.net \
    --cc=bonding-devel@lists.sourceforge.net \
    --cc=davem@davemloft.net \
    --cc=fubar@us.ibm.com \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@tuxdriver.com \
    /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).