All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v2 0/1] ide-test: tidy up after pio race fix
@ 2015-11-24 19:36 John Snow
  2015-11-24 19:36 ` [Qemu-devel] [PATCH v2 1/1] ide-test: fix timeouts John Snow
  2015-11-24 19:43 ` [Qemu-devel] [PATCH v2 0/1] ide-test: tidy up after pio race fix John Snow
  0 siblings, 2 replies; 4+ messages in thread
From: John Snow @ 2015-11-24 19:36 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, John Snow, pl

Post-rc1 cleanup of the ATAPI tests that were problematic during the
rc0 testing window. This set does two things:

(1) Fix the timeouts to be more deterministic, and
(2) Finish tidying up the PIO loop.

v2:
 - Clarify the commit message on patch 1, and remove the second
   needless stack variable.

John Snow (1):
  ide-test: fix timeouts

 tests/ide-test.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

-- 
2.4.3

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

* [Qemu-devel] [PATCH v2 1/1] ide-test: fix timeouts
  2015-11-24 19:36 [Qemu-devel] [PATCH v2 0/1] ide-test: tidy up after pio race fix John Snow
@ 2015-11-24 19:36 ` John Snow
  2015-11-25  9:22   ` Kevin Wolf
  2015-11-24 19:43 ` [Qemu-devel] [PATCH v2 0/1] ide-test: tidy up after pio race fix John Snow
  1 sibling, 1 reply; 4+ messages in thread
From: John Snow @ 2015-11-24 19:36 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, John Snow, pl

Use explicit timeouts instead of trying to approximate it by counting
the cumulative duration of nsleep calls.

In practice, the timeout if inb() dwarfed the nsleep delays, and as a
result the real timeout value became a lot larger than 5 seconds.

So: change the semantics from "Not sooner than 5 seconds" to "no more
than 5 seconds" to ensure we don't hang the tester for very long.

Signed-off-by: John Snow <jsnow@redhat.com>
---
 tests/ide-test.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/tests/ide-test.c b/tests/ide-test.c
index fc1ce52..c14910b 100644
--- a/tests/ide-test.c
+++ b/tests/ide-test.c
@@ -642,15 +642,19 @@ static void nsleep(int64_t nsecs)
 
 static uint8_t ide_wait_clear(uint8_t flag)
 {
-    int i;
     uint8_t data;
+    time_t st;
 
     /* Wait with a 5 second timeout */
-    for (i = 0; i <= 12500000; i++) {
+    time(&st);
+    while (true) {
         data = inb(IDE_BASE + reg_status);
         if (!(data & flag)) {
             return data;
         }
+        if (difftime(time(NULL), st) > 5.0) {
+            break;
+        }
         nsleep(400);
     }
     g_assert_not_reached();
@@ -658,14 +662,18 @@ static uint8_t ide_wait_clear(uint8_t flag)
 
 static void ide_wait_intr(int irq)
 {
-    int i;
+    time_t st;
     bool intr;
 
-    for (i = 0; i <= 12500000; i++) {
+    time(&st);
+    while (true) {
         intr = get_irq(irq);
         if (intr) {
             return;
         }
+        if (difftime(time(NULL), st) > 5.0) {
+            break;
+        }
         nsleep(400);
     }
 
-- 
2.4.3

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

* Re: [Qemu-devel] [PATCH v2 0/1] ide-test: tidy up after pio race fix
  2015-11-24 19:36 [Qemu-devel] [PATCH v2 0/1] ide-test: tidy up after pio race fix John Snow
  2015-11-24 19:36 ` [Qemu-devel] [PATCH v2 1/1] ide-test: fix timeouts John Snow
@ 2015-11-24 19:43 ` John Snow
  1 sibling, 0 replies; 4+ messages in thread
From: John Snow @ 2015-11-24 19:43 UTC (permalink / raw)
  To: qemu-devel; +Cc: kwolf, pl



On 11/24/2015 02:36 PM, John Snow wrote:
> Post-rc1 cleanup of the ATAPI tests that were problematic during the
> rc0 testing window. This set does two things:
> 
> (1) Fix the timeouts to be more deterministic, and
> (2) Finish tidying up the PIO loop.
> 
> v2:
>  - Clarify the commit message on patch 1, and remove the second
>    needless stack variable.
> 
> John Snow (1):
>   ide-test: fix timeouts
> 
>  tests/ide-test.c | 16 ++++++++++++----
>  1 file changed, 12 insertions(+), 4 deletions(-)
> 

Script goofed up and didn't send the second one, but since Kevin already
reviewed it, I'll just stage it.

--js

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

* Re: [Qemu-devel] [PATCH v2 1/1] ide-test: fix timeouts
  2015-11-24 19:36 ` [Qemu-devel] [PATCH v2 1/1] ide-test: fix timeouts John Snow
@ 2015-11-25  9:22   ` Kevin Wolf
  0 siblings, 0 replies; 4+ messages in thread
From: Kevin Wolf @ 2015-11-25  9:22 UTC (permalink / raw)
  To: John Snow; +Cc: pl, qemu-devel

Am 24.11.2015 um 20:36 hat John Snow geschrieben:
> Use explicit timeouts instead of trying to approximate it by counting
> the cumulative duration of nsleep calls.
> 
> In practice, the timeout if inb() dwarfed the nsleep delays, and as a
> result the real timeout value became a lot larger than 5 seconds.
> 
> So: change the semantics from "Not sooner than 5 seconds" to "no more
> than 5 seconds" to ensure we don't hang the tester for very long.
> 
> Signed-off-by: John Snow <jsnow@redhat.com>

Reviewed-by: Kevin Wolf <kwolf@redhat.com>

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

end of thread, other threads:[~2015-11-25  9:22 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-24 19:36 [Qemu-devel] [PATCH v2 0/1] ide-test: tidy up after pio race fix John Snow
2015-11-24 19:36 ` [Qemu-devel] [PATCH v2 1/1] ide-test: fix timeouts John Snow
2015-11-25  9:22   ` Kevin Wolf
2015-11-24 19:43 ` [Qemu-devel] [PATCH v2 0/1] ide-test: tidy up after pio race fix John Snow

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.