IB: Convert msleep below 20ms to usleep_range
Subsystems (3)
PATCH 1/1 IB: Convert msleep below 20ms to usleep_range
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
The msleep(1) may do not sleep 1 ms as expected and will sleep longer. The simple conversion from msleep to usleep_range between 1ms and 2ms can solve an issue.
The full and comprehensive explanation can be found at [1] and [2].
[1] https://lkml.org/lkml/2007/8/3/250
[2] Documentation/timers/timers-howto.txt
--- drivers/infiniband/hw/hns/hns_roce_hw_v1.c | 3 ++- drivers/infiniband/hw/mlx4/main.c | 2 +- drivers/infiniband/hw/mlx4/mcg.c | 2 +- drivers/infiniband/hw/nes/nes_hw.c | 4 ++-- drivers/infiniband/ulp/ipoib/ipoib_cm.c | 4 ++-- drivers/infiniband/ulp/ipoib/ipoib_ib.c | 2 +- 6 files changed, 9 insertions(+), 8 deletions(-)
drivers/infiniband/hw/hns/hns_roce_hw_v1.c +2 -1
@@ -995,7 +995,8 @@ static void hns_roce_v1_mr_free_work_fn(struct work_struct *work) goto free_work; } ne -= ret; -msleep (HNS_ROCE_V1_FREE_MR_WAIT_VALUE ); +usleep_range (HNS_ROCE_V1_FREE_MR_WAIT_VALUE *1000 , + (1 +HNS_ROCE_V1_FREE_MR_WAIT_VALUE ) *1000 ); }while (ne &&time_before_eq (jiffies, end));if (ne !=0 )
drivers/infiniband/hw/mlx4/main.c +1 -1
@@ -1156,7 +1156,7 @@ static void mlx4_ib_disassociate_ucontext(struct ib_ucontext *ibcontext)* call to mlx4_ib_vma_close. */ put_task_struct (owning_process); -msleep (1 ); +usleep_range (1000 ,2000 ); owning_process =get_pid_task (ibcontext->tgid,PIDTYPE_PID ); if (!owning_process ||
drivers/infiniband/hw/mlx4/mcg.c +1 -1
@@ -1091,7 +1091,7 @@ static void _mlx4_ib_mcg_port_cleanup(struct mlx4_ib_demux_ctx *ctx, int destroyif (!count)break ; -msleep (1 ); +usleep_range (1000 ,2000 ); }while (time_after (end, jiffies));flush_workqueue (ctx->mcg_wq);
drivers/infiniband/hw/nes/nes_hw.c +2 -2
@@ -551,7 +551,7 @@ struct nes_adapter *nes_init_adapter(struct nes_device *nesdev, u8 hw_rev) {if ((0x0F000100 == (pcs_control_status0 &0x0F000100 )) || (0x0F000100 == (pcs_control_status1 &0x0F000100 ))) int_cnt++; -msleep (1 ); +usleep_range (1000 ,2000 ); }if (int_cnt >1 ) {spin_lock_irqsave (&nesadapter->phy_lock, flags);
@@ -592,7 +592,7 @@ struct nes_adapter *nes_init_adapter(struct nes_device *nesdev, u8 hw_rev) {break ; } } -msleep (1 ); +usleep_range (1000 ,2000 ); } } }
drivers/infiniband/ulp/ipoib/ipoib_cm.c +2 -2
@@ -954,7 +954,7 @@ void ipoib_cm_dev_stop(struct net_device *dev)break ; }spin_unlock_irq (&priv->lock); -msleep (1 ); +usleep_range (1000 ,2000 );ipoib_drain_cq (dev);spin_lock_irq (&priv->lock); }
@@ -1206,7 +1206,7 @@ static void ipoib_cm_tx_destroy(struct ipoib_cm_tx *p) goto timeout; } -msleep (1 ); +usleep_range (1000 ,2000 ); } }
drivers/infiniband/ulp/ipoib/ipoib_ib.c +1 -1
@@ -770,7 +770,7 @@ int ipoib_ib_dev_stop_default(struct net_device *dev)ipoib_drain_cq (dev); -msleep (1 ); +usleep_range (1000 ,2000 ); }ipoib_dbg (priv,"All sends and receives done.\n" );
--
2.12.2
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 20170523082942.13314-1-leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org
Quoted 7 lines · Leon Romanovsky
From: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/[email protected]>
The msleep(1) may do not sleep 1 ms as expected and will sleep longer. The simple conversion from msleep to
usleep_rangebetween 1ms and 2ms can solve an issue.
Quoted 7 lines
The full and comprehensive explanation can be found at [1] and [2].
[1] https://lkml.org/lkml/2007/8/3/250
[2]Documentation/timers/timers-howto.txt
This has been accepted into 4.13-rc, thanks.
Signature · 3 lines
Doug Ledford <[email protected]> GPG Key ID: B826A3330E572FDD Key fingerprint = AE6B 1BDA 122B 23B4 265B 1274 B826 A333 0E57 2FDD