* [PATCH] netxen_nic: use spin_[un]lock_bh around tx_clean_lock (2)
@ 2015-05-06 13:09 Tony Camuso
2015-05-06 14:09 ` Neil Horman
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Tony Camuso @ 2015-05-06 13:09 UTC (permalink / raw)
To: linux-kernel, netdev; +Cc: manish.chopra, sony.chacko, rajesh.borundia, nhorman
This patch should have been part of the previous patch having the
same summary. See http://marc.info/?l=linux-kernel&m=143039470103795&w=2
Unfortunately, I didn't check to see where else this lock was used before
submitting that patch. This should take care of it for netxen_nic, as I
did a thorough search this time.
To recap from the original patch; although 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 _bh
versions of spin_[un]lock, 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 2da9627..6301bae 100644
--- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c
+++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c
@@ -1766,7 +1766,7 @@ int netxen_process_cmd_ring(struct netxen_adapter *adapter)
int done = 0;
struct nx_host_tx_ring *tx_ring = adapter->tx_ring;
- if (!spin_trylock(&adapter->tx_clean_lock))
+ if (!spin_trylock_bh(&adapter->tx_clean_lock))
return 1;
sw_consumer = tx_ring->sw_consumer;
@@ -1821,7 +1821,7 @@ int netxen_process_cmd_ring(struct netxen_adapter *adapter)
*/
hw_consumer = le32_to_cpu(*(tx_ring->hw_consumer));
done = (sw_consumer == hw_consumer);
- spin_unlock(&adapter->tx_clean_lock);
+ spin_unlock_bh(&adapter->tx_clean_lock);
return done;
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] netxen_nic: use spin_[un]lock_bh around tx_clean_lock (2)
2015-05-06 13:09 [PATCH] netxen_nic: use spin_[un]lock_bh around tx_clean_lock (2) Tony Camuso
@ 2015-05-06 14:09 ` Neil Horman
2015-05-07 10:57 ` Manish Chopra
2015-05-09 20:45 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Neil Horman @ 2015-05-06 14:09 UTC (permalink / raw)
To: Tony Camuso
Cc: linux-kernel, netdev, manish.chopra, sony.chacko, rajesh.borundia
On Wed, May 06, 2015 at 09:09:18AM -0400, Tony Camuso wrote:
> This patch should have been part of the previous patch having the
> same summary. See http://marc.info/?l=linux-kernel&m=143039470103795&w=2
> Unfortunately, I didn't check to see where else this lock was used before
> submitting that patch. This should take care of it for netxen_nic, as I
> did a thorough search this time.
>
> To recap from the original patch; although 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 _bh
> versions of spin_[un]lock, 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 2da9627..6301bae 100644
> --- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c
> +++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c
> @@ -1766,7 +1766,7 @@ int netxen_process_cmd_ring(struct netxen_adapter *adapter)
> int done = 0;
> struct nx_host_tx_ring *tx_ring = adapter->tx_ring;
>
> - if (!spin_trylock(&adapter->tx_clean_lock))
> + if (!spin_trylock_bh(&adapter->tx_clean_lock))
> return 1;
>
> sw_consumer = tx_ring->sw_consumer;
> @@ -1821,7 +1821,7 @@ int netxen_process_cmd_ring(struct netxen_adapter *adapter)
> */
> hw_consumer = le32_to_cpu(*(tx_ring->hw_consumer));
> done = (sw_consumer == hw_consumer);
> - spin_unlock(&adapter->tx_clean_lock);
> + spin_unlock_bh(&adapter->tx_clean_lock);
>
> return done;
> }
> --
> 1.8.3.1
>
Acked-By: Neil Horman <nhorman@tuxdriver.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] netxen_nic: use spin_[un]lock_bh around tx_clean_lock (2)
2015-05-06 13:09 [PATCH] netxen_nic: use spin_[un]lock_bh around tx_clean_lock (2) Tony Camuso
2015-05-06 14:09 ` Neil Horman
@ 2015-05-07 10:57 ` Manish Chopra
2015-05-09 20:45 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Manish Chopra @ 2015-05-07 10:57 UTC (permalink / raw)
To: Tony Camuso, linux-kernel, netdev; +Cc: Sony Chacko, Rajesh Borundia, nhorman
> -----Original Message-----
> From: Tony Camuso [mailto:tcamuso@redhat.com]
> Sent: Wednesday, May 06, 2015 6:39 PM
> To: linux-kernel; netdev
> Cc: Manish Chopra; Sony Chacko; Rajesh Borundia; nhorman@redhat.com
> Subject: [PATCH] netxen_nic: use spin_[un]lock_bh around tx_clean_lock (2)
>
> This patch should have been part of the previous patch having the same
> summary. See http://marc.info/?l=linux-kernel&m=143039470103795&w=2
> Unfortunately, I didn't check to see where else this lock was used before
> submitting that patch. This should take care of it for netxen_nic, as I did a
> thorough search this time.
>
> To recap from the original patch; although 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 _bh versions of
> spin_[un]lock, 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 2da9627..6301bae 100644
> --- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c
> +++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_init.c
> @@ -1766,7 +1766,7 @@ int netxen_process_cmd_ring(struct netxen_adapter
> *adapter)
> int done = 0;
> struct nx_host_tx_ring *tx_ring = adapter->tx_ring;
>
> - if (!spin_trylock(&adapter->tx_clean_lock))
> + if (!spin_trylock_bh(&adapter->tx_clean_lock))
> return 1;
>
> sw_consumer = tx_ring->sw_consumer;
> @@ -1821,7 +1821,7 @@ int netxen_process_cmd_ring(struct netxen_adapter
> *adapter)
> */
> hw_consumer = le32_to_cpu(*(tx_ring->hw_consumer));
> done = (sw_consumer == hw_consumer);
> - spin_unlock(&adapter->tx_clean_lock);
> + spin_unlock_bh(&adapter->tx_clean_lock);
>
> return done;
> }
> --
> 1.8.3.1
Acked-By: Manish Chopra <manish.chopra@qlogic.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] netxen_nic: use spin_[un]lock_bh around tx_clean_lock (2)
2015-05-06 13:09 [PATCH] netxen_nic: use spin_[un]lock_bh around tx_clean_lock (2) Tony Camuso
2015-05-06 14:09 ` Neil Horman
2015-05-07 10:57 ` Manish Chopra
@ 2015-05-09 20:45 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2015-05-09 20:45 UTC (permalink / raw)
To: tcamuso
Cc: linux-kernel, netdev, manish.chopra, sony.chacko,
rajesh.borundia, nhorman
From: Tony Camuso <tcamuso@redhat.com>
Date: Wed, 6 May 2015 09:09:18 -0400
> This patch should have been part of the previous patch having the
> same summary. See http://marc.info/?l=linux-kernel&m=143039470103795&w=2
> Unfortunately, I didn't check to see where else this lock was used before
> submitting that patch. This should take care of it for netxen_nic, as I
> did a thorough search this time.
>
> To recap from the original patch; although 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 _bh
> versions of spin_[un]lock, 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.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-05-09 20:45 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-06 13:09 [PATCH] netxen_nic: use spin_[un]lock_bh around tx_clean_lock (2) Tony Camuso
2015-05-06 14:09 ` Neil Horman
2015-05-07 10:57 ` Manish Chopra
2015-05-09 20:45 ` 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).