Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/pci add comment about txq->txq_lock contentions in w...



details:   https://anonhg.NetBSD.org/src/rev/1d8455418bbd
branches:  trunk
changeset: 350921:1d8455418bbd
user:      knakahara <knakahara%NetBSD.org@localhost>
date:      Fri Jan 27 05:04:47 2017 +0000

description:
add comment about txq->txq_lock contentions in wm_nq_transmit().

diffstat:

 sys/dev/pci/if_wm.c |  14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diffs (35 lines):

diff -r 665dad9c235b -r 1d8455418bbd sys/dev/pci/if_wm.c
--- a/sys/dev/pci/if_wm.c       Fri Jan 27 03:53:01 2017 +0000
+++ b/sys/dev/pci/if_wm.c       Fri Jan 27 05:04:47 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_wm.c,v 1.469 2017/01/26 10:14:52 knakahara Exp $    */
+/*     $NetBSD: if_wm.c,v 1.470 2017/01/27 05:04:47 knakahara Exp $    */
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -84,7 +84,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.469 2017/01/26 10:14:52 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.470 2017/01/27 05:04:47 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -7018,6 +7018,16 @@
        if (m->m_flags & M_MCAST)
                ifp->if_omcasts++;
 
+       /*
+        * The situations which this mutex_tryenter() fails at running time
+        * are below two patterns.
+        *     (1) contention with interrupt handler(wm_txrxintr_msix())
+        *     (2) contention with deferred if_start softint(wm_deferred_start())
+        * In the case of (1), the last packet enqueued to txq->txq_interq is
+        * dequeued by wm_deferred_start(). So, it does not get stuck.
+        * In the case of (2), the last packet enqueued to txq->txq_interq is also
+        * dequeued by wm_deferred_start(). So, it does not get stuck, either.
+        */
        if (mutex_tryenter(txq->txq_lock)) {
                if (!txq->txq_stopping)
                        wm_nq_transmit_locked(ifp, txq);



Home | Main Index | Thread Index | Old Index