All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] e1000: changed some expensive calls of udelay to usleep_range
@ 2017-08-22 21:02 ` nxf23276
  0 siblings, 0 replies; 4+ messages in thread
From: nxf23276 @ 2017-08-22 21:02 UTC (permalink / raw)
  To: jeffrey.t.kirsher
  Cc: michael.kardonik, shannon.nelson, carolyn.wyborny,
	donald.c.skidmore, bruce.w.allan, john.ronciak, mitch.a.williams,
	intel-wired-lan, netdev, linux-kernel, nxf23276

    Calls to udelay are not preemtable by userspace so userspace
    applications experience a large (~200us) latency when running on core
    0. Instead usleep_range can be used to be more friendly to userspace
    since it is preemtable. This is due to udelay using busy-wait loops
    while usleep_rang uses hrtimers instead. It is recommended to use
    udelay when the delay is <10us since at that precision overhead of
    usleep_range hrtimer setup causes issues. However, the replaced calls
    are for 50us and 100us so this should not be not an issue.

Signed-off-by: nxf23276 <matthew.tan_1@nxp.com>
---
 drivers/net/ethernet/intel/e1000e/phy.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/intel/e1000e/phy.c b/drivers/net/ethernet/intel/e1000e/phy.c
index de13aea..ee6ab53 100644
--- a/drivers/net/ethernet/intel/e1000e/phy.c
+++ b/drivers/net/ethernet/intel/e1000e/phy.c
@@ -158,7 +158,7 @@ s32 e1000e_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data)
 	 * the lower time out
 	 */
 	for (i = 0; i < (E1000_GEN_POLL_TIMEOUT * 3); i++) {
-		udelay(50);
+		usleep_range(40, 60);
 		mdic = er32(MDIC);
 		if (mdic & E1000_MDIC_READY)
 			break;
@@ -183,7 +183,7 @@ s32 e1000e_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data)
 	 * reading duplicate data in the next MDIC transaction.
 	 */
 	if (hw->mac.type == e1000_pch2lan)
-		udelay(100);
+		usleep_range(90, 110);
 
 	return 0;
 }
@@ -222,7 +222,7 @@ s32 e1000e_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data)
 	 * the lower time out
 	 */
 	for (i = 0; i < (E1000_GEN_POLL_TIMEOUT * 3); i++) {
-		udelay(50);
+		usleep_range(40, 60);
 		mdic = er32(MDIC);
 		if (mdic & E1000_MDIC_READY)
 			break;
@@ -246,7 +246,7 @@ s32 e1000e_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data)
 	 * reading duplicate data in the next MDIC transaction.
 	 */
 	if (hw->mac.type == e1000_pch2lan)
-		udelay(100);
+		usleep_range(90, 110);
 
 	return 0;
 }
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Intel-wired-lan] [PATCH] e1000: changed some expensive calls of udelay to usleep_range
@ 2017-08-22 21:02 ` nxf23276
  0 siblings, 0 replies; 4+ messages in thread
From: nxf23276 @ 2017-08-22 21:02 UTC (permalink / raw)
  To: intel-wired-lan

    Calls to udelay are not preemtable by userspace so userspace
    applications experience a large (~200us) latency when running on core
    0. Instead usleep_range can be used to be more friendly to userspace
    since it is preemtable. This is due to udelay using busy-wait loops
    while usleep_rang uses hrtimers instead. It is recommended to use
    udelay when the delay is <10us since at that precision overhead of
    usleep_range hrtimer setup causes issues. However, the replaced calls
    are for 50us and 100us so this should not be not an issue.

Signed-off-by: nxf23276 <matthew.tan_1@nxp.com>
---
 drivers/net/ethernet/intel/e1000e/phy.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/intel/e1000e/phy.c b/drivers/net/ethernet/intel/e1000e/phy.c
index de13aea..ee6ab53 100644
--- a/drivers/net/ethernet/intel/e1000e/phy.c
+++ b/drivers/net/ethernet/intel/e1000e/phy.c
@@ -158,7 +158,7 @@ s32 e1000e_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data)
 	 * the lower time out
 	 */
 	for (i = 0; i < (E1000_GEN_POLL_TIMEOUT * 3); i++) {
-		udelay(50);
+		usleep_range(40, 60);
 		mdic = er32(MDIC);
 		if (mdic & E1000_MDIC_READY)
 			break;
@@ -183,7 +183,7 @@ s32 e1000e_read_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 *data)
 	 * reading duplicate data in the next MDIC transaction.
 	 */
 	if (hw->mac.type == e1000_pch2lan)
-		udelay(100);
+		usleep_range(90, 110);
 
 	return 0;
 }
@@ -222,7 +222,7 @@ s32 e1000e_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data)
 	 * the lower time out
 	 */
 	for (i = 0; i < (E1000_GEN_POLL_TIMEOUT * 3); i++) {
-		udelay(50);
+		usleep_range(40, 60);
 		mdic = er32(MDIC);
 		if (mdic & E1000_MDIC_READY)
 			break;
@@ -246,7 +246,7 @@ s32 e1000e_write_phy_reg_mdic(struct e1000_hw *hw, u32 offset, u16 data)
 	 * reading duplicate data in the next MDIC transaction.
 	 */
 	if (hw->mac.type == e1000_pch2lan)
-		udelay(100);
+		usleep_range(90, 110);
 
 	return 0;
 }
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] e1000: changed some expensive calls of udelay to usleep_range
  2017-08-22 21:02 ` [Intel-wired-lan] " nxf23276
@ 2017-08-23  0:30   ` Jeff Kirsher
  -1 siblings, 0 replies; 4+ messages in thread
From: Jeff Kirsher @ 2017-08-23  0:30 UTC (permalink / raw)
  To: nxf23276
  Cc: michael.kardonik, shannon.nelson, carolyn.wyborny,
	donald.c.skidmore, bruce.w.allan, john.ronciak, mitch.a.williams,
	intel-wired-lan, netdev, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1057 bytes --]

On Tue, 2017-08-22 at 16:02 -0500, nxf23276 wrote:
>     Calls to udelay are not preemtable by userspace so userspace
>     applications experience a large (~200us) latency when running on
> core
>     0. Instead usleep_range can be used to be more friendly to
> userspace
>     since it is preemtable. This is due to udelay using busy-wait
> loops
>     while usleep_rang uses hrtimers instead. It is recommended to use
>     udelay when the delay is <10us since at that precision overhead
> of
>     usleep_range hrtimer setup causes issues. However, the replaced
> calls
>     are for 50us and 100us so this should not be not an issue.
> 
> Signed-off-by: nxf23276 <matthew.tan_1@nxp.com>
> ---
>  drivers/net/ethernet/intel/e1000e/phy.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

First of all, your name is nxf23276?  Really??

Second, you titled your patch that you were makeding changes to e1000
driver, yet you are asking to modify e1000e.  Just based on these 2
needed changes, I am dropping your patch.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Intel-wired-lan] [PATCH] e1000: changed some expensive calls of udelay to usleep_range
@ 2017-08-23  0:30   ` Jeff Kirsher
  0 siblings, 0 replies; 4+ messages in thread
From: Jeff Kirsher @ 2017-08-23  0:30 UTC (permalink / raw)
  To: intel-wired-lan

On Tue, 2017-08-22 at 16:02 -0500, nxf23276 wrote:
>     Calls to udelay are not preemtable by userspace so userspace
>     applications experience a large (~200us) latency when running on
> core
>     0. Instead usleep_range can be used to be more friendly to
> userspace
>     since it is preemtable. This is due to udelay using busy-wait
> loops
>     while usleep_rang uses hrtimers instead. It is recommended to use
>     udelay when the delay is <10us since@that precision overhead
> of
>     usleep_range hrtimer setup causes issues. However, the replaced
> calls
>     are for 50us and 100us so this should not be not an issue.
> 
> Signed-off-by: nxf23276 <matthew.tan_1@nxp.com>
> ---
>  drivers/net/ethernet/intel/e1000e/phy.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)

First of all, your name is nxf23276?  Really??

Second, you titled your patch that you were makeding changes to e1000
driver, yet you are asking to modify e1000e.  Just based on these 2
needed changes, I am dropping your patch.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.osuosl.org/pipermail/intel-wired-lan/attachments/20170822/082cc422/attachment.asc>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-08-23  0:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-22 21:02 [PATCH] e1000: changed some expensive calls of udelay to usleep_range nxf23276
2017-08-22 21:02 ` [Intel-wired-lan] " nxf23276
2017-08-23  0:30 ` Jeff Kirsher
2017-08-23  0:30   ` [Intel-wired-lan] " Jeff Kirsher

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.