From: Eric Dumazet <dada1@cosmosbay•com>
To: Yevgeny Petrilin <yevgenyp@mellanox•co.il>
Cc: David Miller <davem@davemloft•net>,
netdev@vger•kernel.org, tziporet@mellanox•co.il
Subject: Re: [net-2.6 PATCH V2] mlx4_en: Fix a kernel panic when waking tx queue
Date: Tue, 26 May 2009 12:48:04 +0200 [thread overview]
Message-ID: <4A1BC8E4.1050009@cosmosbay.com> (raw)
In-Reply-To: <4A1B92D1.8070907@mellanox.co.il>
Yevgeny Petrilin a écrit :
> When the transmit queue gets full we enable interrupts for TX completions
> There was a race that we handled the TX queue both from the interrupt context
> and from the transmit function. Using "spin_trylock_irq()" ensures this
> doesn't happen.
>
> Signed-off-by: Yevgeny Petrilin <yevgenyp@mellanox•co.il>
> ---
> drivers/net/mlx4/en_tx.c | 8 ++++----
> 1 files changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/mlx4/en_tx.c b/drivers/net/mlx4/en_tx.c
> index ac6fc49..e5c98a9 100644
> --- a/drivers/net/mlx4/en_tx.c
> +++ b/drivers/net/mlx4/en_tx.c
> @@ -426,7 +426,7 @@ void mlx4_en_poll_tx_cq(unsigned long data)
>
> INC_PERF_COUNTER(priv->pstats.tx_poll);
>
> - if (!spin_trylock(&ring->comp_lock)) {
> + if (!spin_trylock_irq(&ring->comp_lock)) {
> mod_timer(&cq->timer, jiffies + MLX4_EN_TX_POLL_TIMEOUT);
> return;
> }
> @@ -439,7 +439,7 @@ void mlx4_en_poll_tx_cq(unsigned long data)
> if (inflight && priv->port_up)
> mod_timer(&cq->timer, jiffies + MLX4_EN_TX_POLL_TIMEOUT);
>
> - spin_unlock(&ring->comp_lock);
> + spin_unlock_irq(&ring->comp_lock);
> }
>
> static struct mlx4_en_tx_desc *mlx4_en_bounce_to_desc(struct mlx4_en_priv *priv,
> @@ -482,9 +482,9 @@ static inline void mlx4_en_xmit_poll(struct mlx4_en_priv *priv, int tx_ind)
>
> /* Poll the CQ every mlx4_en_TX_MODER_POLL packets */
> if ((++ring->poll_cnt & (MLX4_EN_TX_POLL_MODER - 1)) == 0)
> - if (spin_trylock(&ring->comp_lock)) {
> + if (spin_trylock_irq(&ring->comp_lock)) {
> mlx4_en_process_tx_cq(priv->dev, cq);
> - spin_unlock(&ring->comp_lock);
> + spin_unlock_irq(&ring->comp_lock);
> }
> }
>
Just curious.
Blocking hard IRQ while doing TX completion is quite nasty,
as freeing one hundred of skb take long.
Could you try something in process context instead ?
Is this timer driven tx completion thing really good for performance ?
static inline void mlx4_en_xmit_poll(struct mlx4_en_priv *priv, int tx_ind)
{
struct mlx4_en_cq *cq = &priv->tx_cq[tx_ind];
struct mlx4_en_tx_ring *ring = &priv->tx_ring[tx_ind];
/* If we don't have a pending timer, set one up to catch our recent
post in case the interface becomes idle */
if (!timer_pending(&cq->timer))
mod_timer(&cq->timer, jiffies + MLX4_EN_TX_POLL_TIMEOUT);
/* Poll the CQ every mlx4_en_TX_MODER_POLL packets */
if ((++ring->poll_cnt & (MLX4_EN_TX_POLL_MODER - 1)) == 0)
if (spin_trylock(&ring->comp_lock)) {
mlx4_en_process_tx_cq(priv->dev, cq);
spin_unlock(&ring->comp_lock);
}
}
One interesting thing is calling mlx4_en_process_tx_cq() once every 16 packets,
this means the producer cpu is also the cpu doing the TX completion, I like this.
next prev parent reply other threads:[~2009-05-26 10:48 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-04-20 14:24 [PATCH 1/5] mlx4_en: Fix error handling while activating RX rings Yevgeny Petrilin
2009-04-20 14:26 ` [PATCH 2/5]mlx4_en: Fix a race at restart task Yevgeny Petrilin
2009-04-21 4:32 ` [PATCH] mlx4_en: Fix cleanup if workqueue create in mlx4_en_add() fails Roland Dreier
2009-04-21 8:50 ` David Miller
2009-04-21 8:49 ` [PATCH 2/5]mlx4_en: Fix a race at restart task David Miller
2009-04-20 14:30 ` [PATCH 3/5] mlx4_en: Assign dummy event handler for TX queue Yevgeny Petrilin
2009-04-21 8:50 ` David Miller
2009-04-20 14:33 ` [PATCH 4/5] mlx4_en: use NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM for tx csum at initialization Yevgeny Petrilin
2009-04-20 14:34 ` [PATCH 5/5] mlx4_en: Move to SW counters for total bytes and packets Yevgeny Petrilin
2009-04-21 8:50 ` David Miller
2009-04-21 8:50 ` [PATCH 4/5] mlx4_en: use NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM for tx csum at initialization David Miller
2009-04-27 6:42 ` [PATCH 2/2] mlx4_en: Handle page allocation failure during receive Yevgeny Petrilin
2009-04-27 9:31 ` David Miller
2009-04-21 8:49 ` [PATCH 1/5] mlx4_en: Fix error handling while activating RX rings David Miller
2009-04-27 6:41 ` [PATCH 1/2] mlx4_en: Fix cleanup flow on cq activation Yevgeny Petrilin
2009-04-27 9:31 ` David Miller
2009-05-13 11:47 ` [PATCH] mlx4_en: Fix not deleted napi structures Yevgeny Petrilin
2009-05-18 3:49 ` David Miller
2009-05-24 13:16 ` [PATCH 1/2] mlx4_en: Removed redundant stride variable Yevgeny Petrilin
2009-05-25 7:36 ` David Miller
2009-05-24 13:17 ` [PATCH 2/2] mlx4_en: Fix partial rings feature Yevgeny Petrilin
2009-05-25 7:36 ` David Miller
2009-05-25 8:32 ` [net-2.6 PATCH] mlx4_en: Fix a kernel panic when waking tx queue Yevgeny Petrilin
2009-05-25 8:44 ` David Miller
2009-05-26 6:49 ` Yevgeny Petrilin
2009-06-02 9:20 ` [PATCH 2/8] mlx4_en: Moved all module parameters handling to en_main.c Yevgeny Petrilin
2009-06-02 9:21 ` [PATCH 3/8] mlx4_en renamed en_params.c to en_ethtool.c Yevgeny Petrilin
2009-06-02 9:22 ` [PATCH 4/8] mlx4_en: Work with part of the ports Yevgeny Petrilin
2009-06-02 9:23 ` [PATCH 5/8] mlx4_en: Coalescing target is equal for all mtu's Yevgeny Petrilin
2009-06-02 9:24 ` [PATCH 6/8] mlx4_en: multiqueue support Yevgeny Petrilin
2009-06-02 9:28 ` [PATCH 7/8] mlx4_en: Added vlan_features support Yevgeny Petrilin
2009-06-02 9:29 ` [PATCH 8/8] mlx4_en: Updated driver version Yevgeny Petrilin
2009-06-02 9:36 ` David Miller
2009-05-26 6:57 ` [net-2.6 PATCH V2] mlx4_en: Fix a kernel panic when waking tx queue Yevgeny Petrilin
2009-05-26 10:48 ` Eric Dumazet [this message]
2009-05-27 6:08 ` Yevgeny Petrilin
2009-05-30 5:00 ` David Miller
2009-06-02 6:27 ` [PATCH 1/8] mlx4_en: Giving interface name in debug messages Yevgeny Petrilin
2009-06-02 7:36 ` 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=4A1BC8E4.1050009@cosmosbay.com \
--to=dada1@cosmosbay$(echo .)com \
--cc=davem@davemloft$(echo .)net \
--cc=netdev@vger$(echo .)kernel.org \
--cc=tziporet@mellanox$(echo .)co.il \
--cc=yevgenyp@mellanox$(echo .)co.il \
/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