netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] netxen_nic: use spin_[un]lock_bh around tx_clean_lock
@ 2015-04-30 11:51 Tony Camuso
  2015-04-30 12:58 ` Neil Horman
  2015-04-30 20:37 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Tony Camuso @ 2015-04-30 11:51 UTC (permalink / raw)
  To: netdev, linux-kernel; +Cc: manish.chopra, sony.chacko, rajesh.borundia, nhorman

While testing this driver with DEBUG_LOCKDEP and DEBUG_SPINLOCK
enabled did not produce any traces, it would be more prudent in the
case of tx_clean_lock to use spin_[un]lock_bh, since this lock is
manipulated in both the process and softirq contexts.

This patch was tested for functionality and regressions with netperf
and DEBUG_LOCKDEP and DEBUG_SPINLOCK enabled.

Signed-off-by: Tony Camuso <tcamuso@redhat.com>

---
 drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c
index d746c97..2da9627 100644
--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c
+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c
@@ -137,7 +137,7 @@ void netxen_release_tx_buffers(struct netxen_adapter *adapter)
 	int i, j;
 	struct nx_host_tx_ring *tx_ring = adapter->tx_ring;
 
-	spin_lock(&adapter->tx_clean_lock);
+	spin_lock_bh(&adapter->tx_clean_lock);
 	cmd_buf = tx_ring->cmd_buf_arr;
 	for (i = 0; i < tx_ring->num_desc; i++) {
 		buffrag = cmd_buf->frag_array;
@@ -161,7 +161,7 @@ void netxen_release_tx_buffers(struct netxen_adapter *adapter)
 		}
 		cmd_buf++;
 	}
-	spin_unlock(&adapter->tx_clean_lock);
+	spin_unlock_bh(&adapter->tx_clean_lock);
 }
 
 void netxen_free_sw_resources(struct netxen_adapter *adapter)
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] netxen_nic: use spin_[un]lock_bh around tx_clean_lock
  2015-04-30 11:51 [PATCH] netxen_nic: use spin_[un]lock_bh around tx_clean_lock Tony Camuso
@ 2015-04-30 12:58 ` Neil Horman
  2015-04-30 20:37 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Neil Horman @ 2015-04-30 12:58 UTC (permalink / raw)
  To: Tony Camuso
  Cc: netdev, linux-kernel, manish.chopra, sony.chacko, rajesh.borundia

On Thu, Apr 30, 2015 at 07:51:27AM -0400, Tony Camuso wrote:
> While testing this driver with DEBUG_LOCKDEP and DEBUG_SPINLOCK
> enabled did not produce any traces, it would be more prudent in the
> case of tx_clean_lock to use spin_[un]lock_bh, since this lock is
> manipulated in both the process and softirq contexts.
> 
> This patch was tested for functionality and regressions with netperf
> and DEBUG_LOCKDEP and DEBUG_SPINLOCK enabled.
> 
> Signed-off-by: Tony Camuso <tcamuso@redhat.com>
> 
> ---
>  drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c b/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c
> index d746c97..2da9627 100644
> --- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c
> +++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c
> @@ -137,7 +137,7 @@ void netxen_release_tx_buffers(struct netxen_adapter *adapter)
>  	int i, j;
>  	struct nx_host_tx_ring *tx_ring = adapter->tx_ring;
>  
> -	spin_lock(&adapter->tx_clean_lock);
> +	spin_lock_bh(&adapter->tx_clean_lock);
>  	cmd_buf = tx_ring->cmd_buf_arr;
>  	for (i = 0; i < tx_ring->num_desc; i++) {
>  		buffrag = cmd_buf->frag_array;
> @@ -161,7 +161,7 @@ void netxen_release_tx_buffers(struct netxen_adapter *adapter)
>  		}
>  		cmd_buf++;
>  	}
> -	spin_unlock(&adapter->tx_clean_lock);
> +	spin_unlock_bh(&adapter->tx_clean_lock);
>  }
>  
>  void netxen_free_sw_resources(struct netxen_adapter *adapter)
> -- 
> 1.8.3.1
> 

Acked-by: Neil Horman <nhorman@tuxdriver.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] netxen_nic: use spin_[un]lock_bh around tx_clean_lock
  2015-04-30 11:51 [PATCH] netxen_nic: use spin_[un]lock_bh around tx_clean_lock Tony Camuso
  2015-04-30 12:58 ` Neil Horman
@ 2015-04-30 20:37 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2015-04-30 20:37 UTC (permalink / raw)
  To: tcamuso
  Cc: netdev, linux-kernel, manish.chopra, sony.chacko,
	rajesh.borundia, nhorman

From: Tony Camuso <tcamuso@redhat.com>
Date: Thu, 30 Apr 2015 07:51:27 -0400

> While testing this driver with DEBUG_LOCKDEP and DEBUG_SPINLOCK
> enabled did not produce any traces, it would be more prudent in the
> case of tx_clean_lock to use spin_[un]lock_bh, since this lock is
> manipulated in both the process and softirq contexts.
> 
> This patch was tested for functionality and regressions with netperf
> and DEBUG_LOCKDEP and DEBUG_SPINLOCK enabled.
> 
> Signed-off-by: Tony Camuso <tcamuso@redhat.com>

Applied, thanks Tony.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-04-30 20:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-30 11:51 [PATCH] netxen_nic: use spin_[un]lock_bh around tx_clean_lock Tony Camuso
2015-04-30 12:58 ` Neil Horman
2015-04-30 20:37 ` David Miller

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).