From: Eric Dumazet <eric.dumazet@gmail.com>
To: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Cc: davem@davemloft.net,
"Akeem G. Abodunrin" <akeem.g.abodunrin@intel.com>,
netdev@vger.kernel.org, gospo@redhat.com, sassmann@redhat.com
Subject: Re: [net-next 07/10] igb: Added rcu_lock to avoid race
Date: Wed, 26 Jun 2013 04:20:28 -0700 [thread overview]
Message-ID: <1372245628.3301.172.camel@edumazet-glaptop> (raw)
In-Reply-To: <1372244122-17664-8-git-send-email-jeffrey.t.kirsher@intel.com>
On Wed, 2013-06-26 at 03:55 -0700, Jeff Kirsher wrote:
> From: "Akeem G. Abodunrin" <akeem.g.abodunrin@intel.com>
>
> This patch adds rcu_lock to avoid possible race condition with igb_update_stats
> function accessing the rings in free_ q_vector.
>
> Signed-off-by: Akeem G Abodunrin <akeem.g.abodunrin@intel.com>
> Tested-by: Aaron Brown <aaron.f.brown@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> ---
> drivers/net/ethernet/intel/igb/igb_main.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
> index 7112e52..c74ad78 100644
> --- a/drivers/net/ethernet/intel/igb/igb_main.c
> +++ b/drivers/net/ethernet/intel/igb/igb_main.c
> @@ -705,6 +705,8 @@ static void __exit igb_exit_module(void)
> dca_unregister_notify(&dca_notifier);
> #endif
> pci_unregister_driver(&igb_driver);
> +
> + rcu_barrier(); /* Wait for completion of call_rcu()'s */
> }
>
This is not needed.
If this is really needed, a better comment would be welcomed ;)
> module_exit(igb_exit_module);
> @@ -1013,7 +1015,7 @@ static void igb_free_q_vector(struct igb_adapter *adapter, int v_idx)
> adapter->q_vector[v_idx] = NULL;
> netif_napi_del(&q_vector->napi);
>
> - /* ixgbe_get_stats64() might access the rings on this vector,
> + /* igb_get_stats64() might access the rings on this vector,
> * we must wait a grace period before freeing it.
> */
> kfree_rcu(q_vector, rcu);
> @@ -4860,6 +4862,8 @@ void igb_update_stats(struct igb_adapter *adapter,
>
> bytes = 0;
> packets = 0;
> +
> + rcu_read_lock();
> for (i = 0; i < adapter->num_rx_queues; i++) {
> u32 rqdpc = rd32(E1000_RQDPC(i));
> struct igb_ring *ring = adapter->rx_ring[i];
> @@ -4895,6 +4899,7 @@ void igb_update_stats(struct igb_adapter *adapter,
> }
> net_stats->tx_bytes = bytes;
> net_stats->tx_packets = packets;
> + rcu_read_unlock();
>
> /* read stats registers */
> adapter->stats.crcerrs += rd32(E1000_CRCERRS);
next prev parent reply other threads:[~2013-06-26 11:20 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-26 10:55 [net-next 00/10][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
2013-06-26 10:55 ` [net-next 01/10] ixgbe: Retain VLAN filtering in promiscuous + VT mode Jeff Kirsher
2013-06-26 10:55 ` [net-next 02/10] ixgbe: Use pci_vfs_assigned instead of ixgbe_vfs_are_assigned Jeff Kirsher
2013-06-26 10:55 ` [net-next 03/10] ixgbe: Fix typo Jeff Kirsher
2013-06-26 14:51 ` Joe Perches
2013-06-26 10:55 ` [net-next 04/10] e100: dump small buffers via %*ph Jeff Kirsher
2013-06-26 10:55 ` [net-next 05/10] igb: Reset the link when EEE setting changed Jeff Kirsher
2013-06-26 10:55 ` [net-next 06/10] igb: Read register for latch_on without return value Jeff Kirsher
2013-06-26 10:55 ` [net-next 07/10] igb: Added rcu_lock to avoid race Jeff Kirsher
2013-06-26 11:20 ` Eric Dumazet [this message]
2013-06-26 16:42 ` Abodunrin, Akeem G
2013-06-26 19:52 ` Eric Dumazet
2013-06-26 19:58 ` Eric Dumazet
2013-06-26 10:55 ` [net-next 08/10] igb: don't allow SR-IOV without MSI-X Jeff Kirsher
2013-06-26 10:55 ` [net-next 09/10] e1000e: restore call to pci_clear_master() Jeff Kirsher
2013-06-26 10:55 ` [net-next 10/10] e1000e: Remove duplicate assignment of default rx/tx ring size Jeff Kirsher
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=1372245628.3301.172.camel@edumazet-glaptop \
--to=eric.dumazet@gmail.com \
--cc=akeem.g.abodunrin@intel.com \
--cc=davem@davemloft.net \
--cc=gospo@redhat.com \
--cc=jeffrey.t.kirsher@intel.com \
--cc=netdev@vger.kernel.org \
--cc=sassmann@redhat.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