lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1452230332-14926-2-git-send-email-danielwa@cisco.com>
Date:	Thu,  7 Jan 2016 21:18:52 -0800
From:	Daniel Walker <danielwa@...co.com>
To:	Tejun Heo <tj@...nel.org>
Cc:	Anil Veliyankara Madam <aveliyan@...co.com>,
	xe-kernel@...ernal.cisco.com, Shikha Jain <shikjain@...co.com>,
	linux-ide@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH 2/2] drivers: libata-core: Use usleep_range() instead of msleep() for short sleeps (<20 ms)

From: Anil Veliyankara Madam <aveliyan@...co.com>

Since msleep() may sleep longer than intended time for values less
than 20ms, this patch allows the use of usleep_range for waits less
that 20ms. usleep_range is a finer precision implementation of
msleep and is designed to be a drop-in replacement for udelay
where a precise sleep/busy-wait is unnecessary.

More details can be found at http://lkml.org/lkml/2007/8/3/250
and in Documentation/timers/timers-howto.txt.

This change has been done to improve the performace in PIO6 mode
which is used by viking flash.

Cc: xe-kernel@...ernal.cisco.com
Signed-off-by: Anil Veliyankara Madam <aveliyan@...co.com>
Signed-off-by: Shikha Jain <shikjain@...co.com>
---
 drivers/ata/libata-core.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index b79cb10..3abf0ea 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -50,6 +50,7 @@
 #include <linux/blkdev.h>
 #include <linux/delay.h>
 #include <linux/timer.h>
+#include <linux/time.h>
 #include <linux/interrupt.h>
 #include <linux/completion.h>
 #include <linux/suspend.h>
@@ -6697,7 +6698,12 @@ void ata_msleep(struct ata_port *ap, unsigned int msecs)
 	if (owns_eh)
 		ata_eh_release(ap);
 
-	msleep(msecs);
+	if (msecs < 20) {
+		unsigned long usecs = msecs * USEC_PER_MSEC;
+		usleep_range(usecs, usecs + 50);
+	} else {
+		msleep(msecs);
+	}
 
 	if (owns_eh)
 		ata_eh_acquire(ap);
-- 
2.1.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ