IB/hfi1: Don't call cond_resched in atomic mode when sending packets
authorKaike Wan <kaike.wan@intel.com>
Sat, 5 Mar 2016 16:50:49 +0000 (08:50 -0800)
committerDoug Ledford <dledford@redhat.com>
Thu, 17 Mar 2016 19:55:18 +0000 (15:55 -0400)
This patch fixed the problem where the driver might reschedule in atomic
mode when sending packets. This is due to the fact that the call to
cond_resched() in hfi1_do_send() might occur in atomic mode and a check is
required to avoid the warning message:
    "kernel: BUG: scheduling while atomic: swapper/2/0/0x10000100."

Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Kaike Wan <kaike.wan@intel.com>
Signed-off-by: Jubin John <jubin.john@intel.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
drivers/staging/rdma/hfi1/ruc.c

index aa53859503ee9af628cd388a52e213cb61da416c..08813cdbd475773b73bd9ee38ee9ff9cd40f0100 100644 (file)
@@ -906,8 +906,11 @@ void hfi1_do_send(struct rvt_qp *qp)
                                                *ps.ppd->dd->send_schedule);
                                        return;
                                }
-                               cond_resched();
-                               this_cpu_inc(*ps.ppd->dd->send_schedule);
+                               if (!irqs_disabled()) {
+                                       cond_resched();
+                                       this_cpu_inc(
+                                          *ps.ppd->dd->send_schedule);
+                               }
                                timeout = jiffies + (timeout_int) / 8;
                        }
                        spin_lock_irqsave(&qp->s_lock, flags);