netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: WingMan Kwok <w-kwok2@ti.com>
To: <davem@davemloft.net>, <m-karicheri2@ti.com>,
	<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Cc: WingMan Kwok <w-kwok2@ti.com>
Subject: [net-next PATCH v0 1/6] net: netcp: Fixes the use of spin_lock_bh in timer function
Date: Thu, 23 Jul 2015 09:32:43 -0400	[thread overview]
Message-ID: <1437658368-1679-2-git-send-email-w-kwok2@ti.com> (raw)
In-Reply-To: <1437658368-1679-1-git-send-email-w-kwok2@ti.com>

This patch fixes a bug in which the timer routine synchronized
against the ethtool-triggered statistics updates with spin_lock_bh().
A timer function is itself a bottom-half, so this should be
spin_lock().

Signed-off-by: WingMan Kwok <w-kwok2@ti.com>
---
 drivers/net/ethernet/ti/netcp_ethss.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/ti/netcp_ethss.c b/drivers/net/ethernet/ti/netcp_ethss.c
index 9b7e0a3..cabf977 100644
--- a/drivers/net/ethernet/ti/netcp_ethss.c
+++ b/drivers/net/ethernet/ti/netcp_ethss.c
@@ -2189,14 +2189,15 @@ static void netcp_ethss_timer(unsigned long arg)
 		netcp_ethss_update_link_state(gbe_dev, slave, NULL);
 	}
 
-	spin_lock_bh(&gbe_dev->hw_stats_lock);
+	/* A timer runs as a BH, no need to block them */
+	spin_lock(&gbe_dev->hw_stats_lock);
 
 	if (gbe_dev->ss_version == GBE_SS_VERSION_14)
 		gbe_update_stats_ver14(gbe_dev, NULL);
 	else
 		gbe_update_stats(gbe_dev, NULL);
 
-	spin_unlock_bh(&gbe_dev->hw_stats_lock);
+	spin_unlock(&gbe_dev->hw_stats_lock);
 
 	gbe_dev->timer.expires	= jiffies + GBE_TIMER_INTERVAL;
 	add_timer(&gbe_dev->timer);
-- 
1.7.9.5

  reply	other threads:[~2015-07-23 13:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-23 13:32 [net-next PATCH v0 0/6] net: netcp: Bug fixes of CPSW statistics collection WingMan Kwok
2015-07-23 13:32 ` WingMan Kwok [this message]
2015-07-23 13:32 ` [net-next PATCH v0 2/6] net: netcp: Fixes hw statistics module base setting error WingMan Kwok
2015-07-23 13:32 ` [net-next PATCH v0 3/6] net: netcp: Fixes error in oversized memory allocation for statistics storage WingMan Kwok
2015-07-23 14:01   ` Murali Karicheri
2015-07-23 13:32 ` [net-next PATCH v0 4/6] net: netcp: Consolidates statistics collection code WingMan Kwok
2015-07-23 13:32 ` [net-next PATCH v0 5/6] net: netcp: Fixes to CPSW statistics collection WingMan Kwok
2015-07-23 13:32 ` [net-next PATCH v0 6/6] net: netcp: Adds missing statistics for K2L and K2E WingMan Kwok
2015-07-27  7:18 ` [net-next PATCH v0 0/6] net: netcp: Bug fixes of CPSW statistics collection 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=1437658368-1679-2-git-send-email-w-kwok2@ti.com \
    --to=w-kwok2@ti.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m-karicheri2@ti.com \
    --cc=netdev@vger.kernel.org \
    /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).