Message ID | 20200512031322.189865.4129.stgit@awfm-01.aw.intel.com (mailing list archive) |
---|---|
State | Changes Requested |
Headers | show |
Series | minor hfi and qib fixes | expand |
On Mon, May 11, 2020 at 11:13:22PM -0400, Dennis Dalessandro wrote: > From: Kaike Wan <kaike.wan@intel.com> > > The workqueue link_wq should only be destroyed when the hfi1 driver > is unloaded, not when the device is shut down. It really doesn't make sense to keep workqueue if no devices exist. Thanks
> -----Original Message----- > From: Leon Romanovsky <leon@kernel.org> > Sent: Tuesday, May 12, 2020 1:57 AM > To: Dalessandro, Dennis <dennis.dalessandro@intel.com> > Cc: jgg@ziepe.ca; dledford@redhat.com; linux-rdma@vger.kernel.org; > Marciniszyn, Mike <mike.marciniszyn@intel.com>; stable@vger.kernel.org; > Wan, Kaike <kaike.wan@intel.com> > Subject: Re: [PATCH for-rc or next 2/3] IB/hfi1: Do not destroy link_wq when > the device is shut down > > On Mon, May 11, 2020 at 11:13:22PM -0400, Dennis Dalessandro wrote: > > From: Kaike Wan <kaike.wan@intel.com> > > > > The workqueue link_wq should only be destroyed when the hfi1 driver is > > unloaded, not when the device is shut down. > > It really doesn't make sense to keep workqueue if no devices exist. > Only to keep consistent with the other workqueue: hfi1_wq. Both workqueues are created when the probe function of the pci_driver is called and destroyed when the remove function is called. In addition, we try not to free any data structure in the shutdown function, which is intended to change the power state of a device before reboot (include/linux/pci.h comment). Kaike
diff --git a/drivers/infiniband/hw/hfi1/init.c b/drivers/infiniband/hw/hfi1/init.c index 10fb5c6..49a4566 100644 --- a/drivers/infiniband/hw/hfi1/init.c +++ b/drivers/infiniband/hw/hfi1/init.c @@ -844,6 +844,10 @@ static void destroy_workqueues(struct hfi1_devdata *dd) destroy_workqueue(ppd->hfi1_wq); ppd->hfi1_wq = NULL; } + if (ppd->link_wq) { + destroy_workqueue(ppd->link_wq); + ppd->link_wq = NULL; + } } } @@ -1120,11 +1124,6 @@ static void shutdown_device(struct hfi1_devdata *dd) * We can't count on interrupts since we are stopping. */ hfi1_quiet_serdes(ppd); - - if (ppd->link_wq) { - destroy_workqueue(ppd->link_wq); - ppd->link_wq = NULL; - } } sdma_exit(dd); }