Author: mav
Date: Mon Aug 28 20:00:21 2017
New Revision: 322981
URL: https://svnweb.freebsd.org/changeset/base/322981

Log:
  Mask doorbells while processing them.
  
  This fixes interrupt storms on hardware using legacy level-triggered
  interrupts, since doorbell processing could take time after interrupt
  handler completion, that triggered extra interrupts in a loop.
  
  MFC after:    2 weeks
  Sponsored by: iXsystems, Inc.

Modified:
  head/sys/dev/ntb/ntb_transport.c

Modified: head/sys/dev/ntb/ntb_transport.c
==============================================================================
--- head/sys/dev/ntb/ntb_transport.c    Mon Aug 28 19:52:57 2017        
(r322980)
+++ head/sys/dev/ntb/ntb_transport.c    Mon Aug 28 20:00:21 2017        
(r322981)
@@ -835,6 +835,7 @@ static void
 ntb_transport_rxc_db(void *arg, int pending __unused)
 {
        struct ntb_transport_qp *qp = arg;
+       uint64_t qp_mask = 1ull << qp->qp_num;
        int rc;
 
        CTR0(KTR_NTB, "RX: transport_rx");
@@ -843,11 +844,13 @@ again:
                ;
        CTR1(KTR_NTB, "RX: process_rxc returned %d", rc);
 
-       if ((ntb_db_read(qp->dev) & (1ull << qp->qp_num)) != 0) {
+       if ((ntb_db_read(qp->dev) & qp_mask) != 0) {
                /* If db is set, clear it and check queue once more. */
-               ntb_db_clear(qp->dev, 1ull << qp->qp_num);
+               ntb_db_clear(qp->dev, qp_mask);
                goto again;
        }
+       if (qp->link_is_up)
+               ntb_db_clear_mask(qp->dev, qp_mask);
 }
 
 static int
@@ -1009,6 +1012,8 @@ ntb_transport_doorbell_callback(void *data, uint32_t v
        vec_mask &= nt->qp_bitmap;
        if ((vec_mask & (vec_mask - 1)) != 0)
                vec_mask &= ntb_db_read(nt->dev);
+       if (vec_mask != 0)
+               ntb_db_set_mask(nt->dev, vec_mask);
        while (vec_mask != 0) {
                qp_num = ffsll(vec_mask) - 1;
 
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to